From dc38fa42e2f688bdb3ba55468c74b3379feb49cc Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 29 May 2012 16:08:03 +0100 Subject: [PATCH] amplc_pc263: Change DIO subdevice to DO. This is a relay output card with no inputs. Its subdevice is currently configured as a DIO subdevice. Change it to a DO subdevice and remove the insn_config hook. Also removed the deprecated SDF_RT flag. Leave the SDF_READABLE flag. Some drivers set this for DO subdevices and some don't. Signed-off-by: Ian Abbott --- comedi/drivers/amplc_pc263.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/comedi/drivers/amplc_pc263.c b/comedi/drivers/amplc_pc263.c index 2b907535..d0992953 100644 --- a/comedi/drivers/amplc_pc263.c +++ b/comedi/drivers/amplc_pc263.c @@ -146,9 +146,7 @@ static comedi_driver driver_amplc_pc263 = { static int pc263_request_region(unsigned minor, unsigned long from, unsigned long extent); -static int pc263_dio_insn_bits(comedi_device * dev, comedi_subdevice * s, - comedi_insn * insn, lsampl_t * data); -static int pc263_dio_insn_config(comedi_device * dev, comedi_subdevice * s, +static int pc263_do_insn_bits(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data); /* @@ -301,16 +299,13 @@ static int pc263_attach(comedi_device * dev, comedi_devconfig * it) } s = dev->subdevices + 0; - /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_RT; + /* digital output subdevice */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = pc263_dio_insn_bits; - s->insn_config = pc263_dio_insn_config; - /* all outputs */ - s->io_bits = 0xffff; + s->insn_bits = pc263_do_insn_bits; /* read initial relay state */ s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8); @@ -381,12 +376,12 @@ static int pc263_request_region(unsigned minor, unsigned long from, return 0; } -/* DIO devices are slightly special. Although it is possible to +/* DI/DO/DIO subdevices are slightly special. Although it is possible to * implement the insn_read/insn_write interface, it is much more * useful to applications if you implement the insn_bits interface. * This allows packed reading/writing of the DIO channels. The * comedi core can convert between insn_bits and insn_read/write */ -static int pc263_dio_insn_bits(comedi_device * dev, comedi_subdevice * s, +static int pc263_do_insn_bits(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) { if (insn->n != 2) @@ -411,14 +406,6 @@ static int pc263_dio_insn_bits(comedi_device * dev, comedi_subdevice * s, return 2; } -static int pc263_dio_insn_config(comedi_device * dev, comedi_subdevice * s, - comedi_insn * insn, lsampl_t * data) -{ - if (insn->n != 1) - return -EINVAL; - return 1; -} - /* * A convenient macro that defines init_module() and cleanup_module(), * as necessary. -- 2.26.2