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

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

staging: comedi: usbduxsigma: tidy up usbdux_dio_insn_config()



Rename the function so it has namespace associated with the driver.
Rename the local variable used for the private data pointer.
Add a local variable for the channel mask.

Remove the unnecessary comments and clean up the multi-line comment
at the end.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 77a52e69
Loading
Loading
Loading
Loading
+15 −16
Original line number Original line Diff line number Diff line
@@ -1113,34 +1113,33 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
	return 0;
	return 0;
}
}


static int usbdux_dio_insn_config(struct comedi_device *dev,
static int usbduxsigma_dio_insn_config(struct comedi_device *dev,
				       struct comedi_subdevice *s,
				       struct comedi_subdevice *s,
				  struct comedi_insn *insn, unsigned int *data)
				       struct comedi_insn *insn,
				       unsigned int *data)
{
{
	int chan = CR_CHAN(insn->chanspec);
	unsigned int chan = CR_CHAN(insn->chanspec);

	unsigned int mask = 1 << chan;
	/* The input or output configuration of each digital line is
	 * configured by a special insn_config instruction.  chanspec
	 * contains the channel to be changed, and data[0] contains the
	 * value COMEDI_INPUT or COMEDI_OUTPUT. */


	switch (data[0]) {
	switch (data[0]) {
	case INSN_CONFIG_DIO_OUTPUT:
	case INSN_CONFIG_DIO_OUTPUT:
		s->io_bits |= 1 << chan;	/* 1 means Out */
		s->io_bits |= mask;
		break;
		break;
	case INSN_CONFIG_DIO_INPUT:
	case INSN_CONFIG_DIO_INPUT:
		s->io_bits &= ~(1 << chan);
		s->io_bits &= ~mask;
		break;
		break;
	case INSN_CONFIG_DIO_QUERY:
	case INSN_CONFIG_DIO_QUERY:
		data[1] =
		data[1] = (s->io_bits & mask) ? COMEDI_OUTPUT : COMEDI_INPUT;
		    (s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT;
		break;
		break;
	default:
	default:
		return -EINVAL;
		return -EINVAL;
		break;
		break;
	}
	}
	/* we don't tell the firmware here as it would take 8 frames */

	/* to submit the information. We do it in the insn_bits. */
	/*
	 * We don't tell the firmware here as it would take 8 frames
	 * to submit the information. We do it in the (*insn_bits).
	 */
	return insn->n;
	return insn->n;
}
}


@@ -1516,7 +1515,7 @@ static int usbduxsigma_attach_common(struct comedi_device *dev)
	s->maxdata	= 1;
	s->maxdata	= 1;
	s->range_table	= &range_digital;
	s->range_table	= &range_digital;
	s->insn_bits	= usbduxsigma_dio_insn_bits;
	s->insn_bits	= usbduxsigma_dio_insn_bits;
	s->insn_config	= usbdux_dio_insn_config;
	s->insn_config	= usbduxsigma_dio_insn_config;


	if (devpriv->high_speed) {
	if (devpriv->high_speed) {
		/* Timer / pwm subdevice */
		/* Timer / pwm subdevice */