From: H Hartley Sweeten Date: Thu, 16 Aug 2012 00:32:53 +0000 (-0700) Subject: staging: comedi: contec_pci_dio: cleanup contec_do_insn_bits X-Git-Tag: firefly_0821_release~3680^2~1977^2~911 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=00d7a906cdd05b76b059102cacf98cfb853fa109;p=firefly-linux-kernel-4.4.55.git staging: comedi: contec_pci_dio: cleanup contec_do_insn_bits Create local variables for the mask and bits values passed in the data pointer to make this function a bit clearer. Return the state of the output bits (s->state) in data[1] since this is what comedilib is expecting. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c index b7b60d3b6093..12ad9fa32f56 100644 --- a/drivers/staging/comedi/drivers/contec_pci_dio.c +++ b/drivers/staging/comedi/drivers/contec_pci_dio.c @@ -44,12 +44,18 @@ static int contec_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - if (data[0]) { - s->state &= ~data[0]; - s->state |= data[0] & data[1]; + unsigned int mask = data[0]; + unsigned int bits = data[1]; + + if (mask) { + s->state &= ~mask; + s->state |= (bits & mask); outw(s->state, dev->iobase + PIO1616L_DO_REG); } + + data[1] = s->state; + return insn->n; }