From 3cb3fc0a0292a720a87651337497af39f77ac64a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 5 Sep 2014 09:25:39 -0700 Subject: [PATCH] staging: comedi: adl_pci9118: move analog output (*insn_write) function For aesthetics, move the analog output (*insn_write) function so it is not located in the middle of the analog input functions. Also, rename it for consistency. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index bd4dee21b302..4a956ccb1acc 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -520,24 +520,6 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, } -static int pci9118_insn_write_ao(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int val = s->readback[chan]; - int i; - - for (i = 0; i < insn->n; i++) { - val = data[i]; - outl(val, dev->iobase + PCI9118_AO_REG(chan)); - } - s->readback[chan] = val; - - return insn->n; -} - static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev) { struct pci9118_private *devpriv = dev->private; @@ -1620,6 +1602,24 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return ret; } +static int pci9118_ao_insn_write(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int val = s->readback[chan]; + int i; + + for (i = 0; i < insn->n; i++) { + val = data[i]; + outl(val, dev->iobase + PCI9118_AO_REG(chan)); + } + s->readback[chan] = val; + + return insn->n; +} + static int pci9118_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -1870,7 +1870,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s->n_chan = 2; s->maxdata = 0x0fff; s->range_table = &range_bipolar10; - s->insn_write = pci9118_insn_write_ao; + s->insn_write = pci9118_ao_insn_write; s->insn_read = comedi_readback_insn_read; ret = comedi_alloc_subdev_readback(s); -- 2.39.5