For aesthetics, rename this function to follow the typical naming convention for comedi drivers. Tidy the function up a bit. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregk@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/adv_pci1710.c | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 63f643b..0afb573 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -669,28 +669,28 @@ static int pci171x_insn_counter_config(struct comedi_device *dev, return 1; } -/* -============================================================================== -*/ -static int pci1720_insn_write_ao(struct comedi_device *dev, +static int pci1720_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { struct pci1710_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); unsigned int val; - int n, rangereg; + int i; - rangereg = devpriv->da_ranges & (~(0x03 << (chan << 1))); - rangereg |= (range << (chan << 1)); - if (rangereg != devpriv->da_ranges) { - outb(rangereg, dev->iobase + PCI1720_RANGE); - devpriv->da_ranges = rangereg; + /* set the channel range only if it changed */ + val = devpriv->da_ranges; + val &= ~(3 << (chan * 2)); + val |= (range << (chan * 2)); + if (val != devpriv->da_ranges) { + outb(val, dev->iobase + PCI1720_RANGE); + devpriv->da_ranges = val; } - for (n = 0; n < insn->n; n++) { - val = data[n]; + for (i = 0; i < insn->n; i++) { + val = data[i]; devpriv->ao_data[chan] = val; /* bipolar codes are two's complement values */ @@ -700,7 +700,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev, outw(val, dev->iobase + PCI1720_AO_REG(chan)); } - return n; + return insn->n; } /* @@ -1196,7 +1196,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->range_table = this_board->rangelist_ao; switch (this_board->cardtype) { case TYPE_PCI1720: - s->insn_write = pci1720_insn_write_ao; + s->insn_write = pci1720_ao_insn_write; break; default: s->insn_write = pci171x_insn_write_ao; -- 1.9.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel