Pass the subdevice pointer to encoder_reset() from the attach instead
of accessing the dev->subdevices array directly to get the pointer.

Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/multiq3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index 3ca755e..81e6559 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -197,9 +197,9 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
        return n;
 }
 
-static void encoder_reset(struct comedi_device *dev)
+static void encoder_reset(struct comedi_device *dev,
+                         struct comedi_subdevice *s)
 {
-       struct comedi_subdevice *s = &dev->subdevices[4];
        int chan;
 
        for (chan = 0; chan < s->n_chan; chan++) {
@@ -282,7 +282,7 @@ static int multiq3_attach(struct comedi_device *dev,
        s->maxdata = 0xffffff;
        s->range_table = &range_unknown;
 
-       encoder_reset(dev);
+       encoder_reset(dev, s);
 
        return 0;
 }
-- 
1.8.4.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to