From: H Hartley Sweeten Date: Tue, 4 Nov 2014 17:54:42 +0000 (-0700) Subject: staging: comedi: addi_apci_3120: move apci3120_ao_insn_write() to driver source X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5cf5fa957946a7d25dc4ce25dba9c8a20f8b8def;p=linux-beck.git staging: comedi: addi_apci_3120: move apci3120_ao_insn_write() to driver source Move this function, and its helper function, from the included hwdrv_apci31210.c source file to the main driver source file. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index a206d5e583d5..929ef0b4620c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1017,41 +1017,3 @@ static int apci3120_read_insn_timer(struct comedi_device *dev, } return insn->n; } - -static int apci3120_ao_ready(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) -{ - unsigned int status; - - status = inw(dev->iobase + APCI3120_STATUS_REG); - if (status & APCI3120_STATUS_DA_READY) - return 0; - return -EBUSY; -} - -static int apci3120_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); - int i; - - for (i = 0; i < insn->n; i++) { - unsigned int val = data[i]; - int ret; - - ret = comedi_timeout(dev, s, insn, apci3120_ao_ready, 0); - if (ret) - return ret; - - outw(APCI3120_AO_MUX(chan) | APCI3120_AO_DATA(val), - dev->iobase + APCI3120_AO_REG(chan)); - - s->readback[chan] = val; - } - - return insn->n; -} diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 7033b0bd3ddb..c17a8408749f 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -281,6 +281,44 @@ static void apci3120_ai_reset_fifo(struct comedi_device *dev) #include "addi-data/hwdrv_apci3120.c" +static int apci3120_ao_ready(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned long context) +{ + unsigned int status; + + status = inw(dev->iobase + APCI3120_STATUS_REG); + if (status & APCI3120_STATUS_DA_READY) + return 0; + return -EBUSY; +} + +static int apci3120_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); + int i; + + for (i = 0; i < insn->n; i++) { + unsigned int val = data[i]; + int ret; + + ret = comedi_timeout(dev, s, insn, apci3120_ao_ready, 0); + if (ret) + return ret; + + outw(APCI3120_AO_MUX(chan) | APCI3120_AO_DATA(val), + dev->iobase + APCI3120_AO_REG(chan)); + + s->readback[chan] = val; + } + + return insn->n; +} + static int apci3120_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn,