[PATCH v2 01/17] staging: comedi: initialize subdevice s->io_bits in postconfig
abbotti at mev.co.uk
Fri Aug 30 09:46:51 UTC 2013
On 2013-08-30 01:47, H Hartley Sweeten wrote:
> 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 the 'io_bits' are 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 at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
> index 317a821..1c81d65 100644
> --- a/drivers/staging/comedi/drivers.c
> +++ b/drivers/staging/comedi/drivers.c
> @@ -285,6 +285,9 @@ static int __comedi_device_postconfig(struct comedi_device *dev)
> if (s->type == COMEDI_SUBD_UNUSED)
> + if (s->type == COMEDI_SUBD_DO)
> + s->io_bits = (1 << s->n_chan) - 1;
As pointed out by Dan Carpenter, this won't work for s->n_chan >= 32.
We definitely care about it working for s->n_chan == 32, so like in your
original patch, s->io_bits should be set to 0xffffffff when s->n_chan >=
32. It's my fault for leading you astray.
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti at mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
More information about the devel