diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-08-06 09:32:33 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-12 15:17:45 -0700 |
commit | ddf62f2c7bd041d35095b525ab33e3a3e0829aaa (patch) | |
tree | bd0ca1676c62fb3cfd2cda8762aab92c75c7d8e1 /drivers/staging/comedi/drivers/usbduxsigma.c | |
parent | f3508b2294516d39d60d68ddab67dd658721bdc9 (diff) |
staging: comedi: drivers: use comedi_dio_insn_config() for simple cases
Convert the drivers with simple, per channel programmable i/o, to use the
comedi_dio_insn_config() helper function.
All of these pass a 'mask' of '0' to comedi_dio_insn_config() this causes
the per channel mask to be used to configure the i/o direction.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/usbduxsigma.c')
-rw-r--r-- | drivers/staging/comedi/drivers/usbduxsigma.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index fca89c367a68..c47f4087568f 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1040,23 +1040,11 @@ static int usbduxsigma_dio_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int mask = 1 << chan; + int ret; - switch (data[0]) { - case INSN_CONFIG_DIO_OUTPUT: - s->io_bits |= mask; - break; - case INSN_CONFIG_DIO_INPUT: - s->io_bits &= ~mask; - break; - case INSN_CONFIG_DIO_QUERY: - data[1] = (s->io_bits & mask) ? COMEDI_OUTPUT : COMEDI_INPUT; - break; - default: - return -EINVAL; - break; - } + ret = comedi_dio_insn_config(dev, s, insn, data, 0); + if (ret) + return ret; /* * We don't tell the firmware here as it would take 8 frames |