diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-08-30 17:47:03 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-17 14:47:40 (GMT) |
commit | 09567cb4373e962a3079bb06352e1e5452d9a340 (patch) | |
tree | 74b4ffb9a80917018f76e821df5f1e6af5b91cf8 /drivers/staging/comedi/drivers.c | |
parent | cb30fc50feb70762d7d82dab9f832ede3de1d067 (diff) | |
download | linux-09567cb4373e962a3079bb06352e1e5452d9a340.tar.xz |
staging: comedi: initialize subdevice s->io_bits in postconfig
The subdevice 'io_bits' is a bit mask of the i/o configuration for
digital subdevices. '0' values indicate that a channel is configured
as an input and '1' values that the channel is an output. Since the
subdevice data is kzalloc()'d, all channels default as inputs.
Modify __comedi_device_postconfig() so that 'io_bits' is correctly
initialized for Digital Output subdevices.
Remove all the unnecessary initializations of 's->io_bits' from the
drivers. Also, remove the unnecessary initialization of the 's->state'.
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.c')
-rw-r--r-- | drivers/staging/comedi/drivers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 317a821..aeef594 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -285,6 +285,13 @@ static int __comedi_device_postconfig(struct comedi_device *dev) if (s->type == COMEDI_SUBD_UNUSED) continue; + if (s->type == COMEDI_SUBD_DO) { + if (s->n_chan < 32) + s->io_bits = (1 << s->n_chan) - 1; + else + s->io_bits = 0xffffffff; + } + if (s->len_chanlist == 0) s->len_chanlist = 1; |