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

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

staging: comedi: ni_mio_common: tidy up the calibration subdevice init



For aesthetics, add some whitespace to the subdevice init.

Refactor the code so that the common parts of the subdevice are initialized
in one place.

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 eeca0caa
Loading
Loading
Loading
Loading
+15 −15
Original line number Original line Diff line number Diff line
@@ -5642,26 +5642,26 @@ static int ni_E_init(struct comedi_device *dev,
	s = &dev->subdevices[NI_UNUSED_SUBDEV];
	s = &dev->subdevices[NI_UNUSED_SUBDEV];
	s->type = COMEDI_SUBD_UNUSED;
	s->type = COMEDI_SUBD_UNUSED;


	/* calibration subdevice -- ai and ao */
	/* Calibration subdevice */
	s = &dev->subdevices[NI_CALIBRATION_SUBDEV];
	s = &dev->subdevices[NI_CALIBRATION_SUBDEV];
	s->type		= COMEDI_SUBD_CALIB;
	s->type		= COMEDI_SUBD_CALIB;
	if (devpriv->is_m_series) {
		/*  internal PWM analog output used for AI nonlinearity calibration */
	s->subdev_flags	= SDF_INTERNAL;
	s->subdev_flags	= SDF_INTERNAL;
		s->insn_config = &ni_m_series_pwm_config;
	s->n_chan	= 1;
	s->n_chan	= 1;
	s->maxdata	= 0;
	s->maxdata	= 0;
	if (devpriv->is_m_series) {
		/* internal PWM output used for AI nonlinearity calibration */
		s->insn_config	= ni_m_series_pwm_config;

		ni_writel(dev, 0x0, M_Offset_Cal_PWM);
		ni_writel(dev, 0x0, M_Offset_Cal_PWM);
	} else if (devpriv->is_6143) {
	} else if (devpriv->is_6143) {
		/*  internal PWM analog output used for AI nonlinearity calibration */
		/* internal PWM output used for AI nonlinearity calibration */
		s->subdev_flags = SDF_INTERNAL;
		s->insn_config	= ni_6143_pwm_config;
		s->insn_config = &ni_6143_pwm_config;
		s->n_chan = 1;
		s->maxdata = 0;
	} else {
	} else {
		s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL;
		s->subdev_flags	|= SDF_WRITABLE;
		s->insn_read = &ni_calib_insn_read;
		s->insn_read	= ni_calib_insn_read;
		s->insn_write = &ni_calib_insn_write;
		s->insn_write	= ni_calib_insn_write;

		/* setup the caldacs and find the real n_chan and maxdata */
		caldac_setup(dev, s);
		caldac_setup(dev, s);
	}
	}