]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: ni_mio_common: only reset the ai/ao subdevices if they exist
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 14 Jul 2014 19:24:00 +0000 (12:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:24:43 +0000 (13:24 -0700)
So of the boards supported by this driver do not have analog inputs and
some don't have analog outputs. Move the calls that reset these subdevices
during the (*attach) by ni_E_init() so they only happen if the subdevices
are present.

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>
drivers/staging/comedi/drivers/ni_mio_common.c

index 6d1754f98c2e9c4108ee5d9054a80be65a66949a..e60b9e6962336bb6ce1cd9e2d91f6109ae2da410 100644 (file)
@@ -5544,6 +5544,9 @@ static int ni_E_init(struct comedi_device *dev,
                        if (devpriv->mite)
                                s->async_dma_dir = DMA_FROM_DEVICE;
                }
+
+               /* reset the analog input configuration */
+               ni_ai_reset(dev, s);
        } else {
                s->type         = COMEDI_SUBD_UNUSED;
        }
@@ -5582,6 +5585,9 @@ static int ni_E_init(struct comedi_device *dev,
 
                if (devpriv->is_67xx)
                        init_ao_67xx(dev, s);
+
+               /* reset the analog output configuration */
+               ni_ao_reset(dev, s);
        } else {
                s->type         = COMEDI_SUBD_UNUSED;
        }
@@ -5779,14 +5785,6 @@ static int ni_E_init(struct comedi_device *dev,
        s->insn_write = &ni_freq_out_insn_write;
        s->insn_config = &ni_freq_out_insn_config;
 
-       /* ai configuration */
-       s = &dev->subdevices[NI_AI_SUBDEV];
-       ni_ai_reset(dev, s);
-
-       /* analog output configuration */
-       s = &dev->subdevices[NI_AO_SUBDEV];
-       ni_ao_reset(dev, s);
-
        if (dev->irq) {
                ni_stc_writew(dev,
                              (irq_polarity ? Interrupt_Output_Polarity : 0) |