Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eeca0caa authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: ni_mio_common: only reset the ai/ao subdevices if they exist



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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent caedecfa
Loading
Loading
Loading
Loading
+6 −8
Original line number Original line Diff line number Diff line
@@ -5544,6 +5544,9 @@ static int ni_E_init(struct comedi_device *dev,
			if (devpriv->mite)
			if (devpriv->mite)
				s->async_dma_dir = DMA_FROM_DEVICE;
				s->async_dma_dir = DMA_FROM_DEVICE;
		}
		}

		/* reset the analog input configuration */
		ni_ai_reset(dev, s);
	} else {
	} else {
		s->type		= COMEDI_SUBD_UNUSED;
		s->type		= COMEDI_SUBD_UNUSED;
	}
	}
@@ -5582,6 +5585,9 @@ static int ni_E_init(struct comedi_device *dev,


		if (devpriv->is_67xx)
		if (devpriv->is_67xx)
			init_ao_67xx(dev, s);
			init_ao_67xx(dev, s);

		/* reset the analog output configuration */
		ni_ao_reset(dev, s);
	} else {
	} else {
		s->type		= COMEDI_SUBD_UNUSED;
		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_write = &ni_freq_out_insn_write;
	s->insn_config = &ni_freq_out_insn_config;
	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) {
	if (dev->irq) {
		ni_stc_writew(dev,
		ni_stc_writew(dev,
			      (irq_polarity ? Interrupt_Output_Polarity : 0) |
			      (irq_polarity ? Interrupt_Output_Polarity : 0) |