Skip to content

Commit

Permalink
staging: comedi: ni_670x: cleanup ni_670x_dio_insn_bits()
Browse files Browse the repository at this point in the history
Add local variable for the io_addr, mask. and bits used in this
function so that the comments are not needed and the writel/readl
calls are a bit cleaner.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 6, 2012
1 parent 04b136b commit ebbc097
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/staging/comedi/drivers/ni_670x.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,19 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev,
struct comedi_insn *insn, unsigned int *data)
{
struct ni_670x_private *devpriv = dev->private;
void __iomem *io_addr = devpriv->mite->daq_io_addr +
DIO_PORT0_DATA_OFFSET;
unsigned int mask = data[0];
unsigned int bits = data[1];

/* The insn data is a mask in data[0] and the new data
* in data[1], each channel cooresponding to a bit. */
if (data[0]) {
s->state &= ~data[0];
s->state |= data[0] & data[1];
writel(s->state,
devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET);
if (mask) {
s->state &= ~mask;
s->state |= (bits & mask);

writel(s->state, io_addr);
}

/* on return, data[1] contains the value of the digital
* input lines. */
data[1] = readl(devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET);
data[1] = readl(io_addr);

return insn->n;
}
Expand Down

0 comments on commit ebbc097

Please sign in to comment.