From: H Hartley Sweeten Date: Tue, 29 Jul 2014 22:01:25 +0000 (-0700) Subject: staging: comedi: mf6x4: use the comedi_device 'mmio' member X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=565700447a57dc28c3a4b887b50a1d633da6810e;p=linux-beck.git staging: comedi: mf6x4: use the comedi_device 'mmio' member Use the new 'mmio' member in the comedi_device for the ioremap'ed base address. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/mf6x4.c b/drivers/staging/comedi/drivers/mf6x4.c index a4f7d6f138df..464f4b4745c7 100644 --- a/drivers/staging/comedi/drivers/mf6x4.c +++ b/drivers/staging/comedi/drivers/mf6x4.c @@ -93,7 +93,6 @@ struct mf6x4_private { * and MF634 yet we will call them 0, 1, 2 */ void __iomem *bar0_mem; - void __iomem *bar1_mem; void __iomem *bar2_mem; /* @@ -108,25 +107,22 @@ struct mf6x4_private { }; static int mf6x4_di_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { - struct mf6x4_private *devpriv = dev->private; - - data[1] = ioread16(devpriv->bar1_mem + MF6X4_DIN_R) & MF6X4_DIN_M; + data[1] = ioread16(dev->mmio + MF6X4_DIN_R) & MF6X4_DIN_M; return insn->n; } static int mf6x4_do_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { - struct mf6x4_private *devpriv = dev->private; - if (comedi_dio_update_state(s, data)) - iowrite16(s->state & MF6X4_DOUT_M, - devpriv->bar1_mem + MF6X4_DOUT_R); + iowrite16(s->state & MF6X4_DOUT_M, dev->mmio + MF6X4_DOUT_R); data[1] = s->state; @@ -149,40 +145,40 @@ static int mf6x4_ai_eoc(struct comedi_device *dev, static int mf6x4_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { - struct mf6x4_private *devpriv = dev->private; int chan = CR_CHAN(insn->chanspec); int ret; int i; int d; /* Set the ADC channel number in the scan list */ - iowrite16((1 << chan) & MF6X4_ADCTRL_M, - devpriv->bar1_mem + MF6X4_ADCTRL_R); + iowrite16((1 << chan) & MF6X4_ADCTRL_M, dev->mmio + MF6X4_ADCTRL_R); for (i = 0; i < insn->n; i++) { /* Trigger ADC conversion by reading ADSTART */ - ioread16(devpriv->bar1_mem + MF6X4_ADSTART_R); + ioread16(dev->mmio + MF6X4_ADSTART_R); ret = comedi_timeout(dev, s, insn, mf6x4_ai_eoc, 0); if (ret) return ret; /* Read the actual value */ - d = ioread16(devpriv->bar1_mem + MF6X4_ADDATA_R); + d = ioread16(dev->mmio + MF6X4_ADDATA_R); d &= s->maxdata; data[i] = d; } - iowrite16(0x0, devpriv->bar1_mem + MF6X4_ADCTRL_R); + iowrite16(0x0, dev->mmio + MF6X4_ADCTRL_R); return insn->n; } static int mf6x4_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 mf6x4_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -195,8 +191,7 @@ static int mf6x4_ao_insn_write(struct comedi_device *dev, devpriv->gpioc_R); for (i = 0; i < insn->n; i++) { - iowrite16(data[i] & MF6X4_DA_M, - devpriv->bar1_mem + MF6X4_DAC_R(chan)); + iowrite16(data[i] & MF6X4_DA_M, dev->mmio + MF6X4_DAC_R(chan)); devpriv->ao_readback[chan] = data[i]; } @@ -246,8 +241,8 @@ static int mf6x4_auto_attach(struct comedi_device *dev, unsigned long context) if (!devpriv->bar0_mem) return -ENODEV; - devpriv->bar1_mem = pci_ioremap_bar(pcidev, board->bar_nums[1]); - if (!devpriv->bar1_mem) + dev->mmio = pci_ioremap_bar(pcidev, board->bar_nums[1]); + if (!dev->mmio) return -ENODEV; devpriv->bar2_mem = pci_ioremap_bar(pcidev, board->bar_nums[2]); @@ -310,8 +305,8 @@ static void mf6x4_detach(struct comedi_device *dev) if (devpriv->bar0_mem) iounmap(devpriv->bar0_mem); - if (devpriv->bar1_mem) - iounmap(devpriv->bar1_mem); + if (dev->mmio) + iounmap(dev->mmio); if (devpriv->bar2_mem) iounmap(devpriv->bar2_mem);