From 176db588e2a36d8183e3cd9a373273b36ead35a1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 29 Jul 2014 15:01:32 -0700 Subject: [PATCH] staging: comedi: ni_670x: 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 --- drivers/staging/comedi/drivers/ni_670x.c | 28 ++++++++++-------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index a054bd51ed21..f5caefad0b59 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -81,7 +81,6 @@ static const struct ni_670x_board ni_670x_boards[] = { }; struct ni_670x_private { - void __iomem *mmio; int boardtype; int dio; unsigned int ao_readback[32]; @@ -109,9 +108,9 @@ static int ni_670x_ao_winsn(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { /* First write in channel register which channel to use */ writel(((chan & 15) << 1) | ((chan & 16) >> 4), - devpriv->mmio + AO_CHAN_OFFSET); + dev->mmio + AO_CHAN_OFFSET); /* write channel value */ - writel(data[i], devpriv->mmio + AO_VALUE_OFFSET); + writel(data[i], dev->mmio + AO_VALUE_OFFSET); devpriv->ao_readback[chan] = data[i]; } @@ -137,13 +136,10 @@ 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->mmio + DIO_PORT0_DATA_OFFSET; - if (comedi_dio_update_state(s, data)) - writel(s->state, io_addr); + writel(s->state, dev->mmio + DIO_PORT0_DATA_OFFSET); - data[1] = readl(io_addr); + data[1] = readl(dev->mmio + DIO_PORT0_DATA_OFFSET); return insn->n; } @@ -153,14 +149,13 @@ static int ni_670x_dio_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct ni_670x_private *devpriv = dev->private; int ret; ret = comedi_dio_insn_config(dev, s, insn, data, 0); if (ret) return ret; - writel(s->io_bits, devpriv->mmio + DIO_PORT0_DIR_OFFSET); + writel(s->io_bits, dev->mmio + DIO_PORT0_DIR_OFFSET); return insn->n; } @@ -217,8 +212,8 @@ static int ni_670x_auto_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->mmio = pci_ioremap_bar(pcidev, 1); - if (!devpriv->mmio) + dev->mmio = pci_ioremap_bar(pcidev, 1); + if (!dev->mmio) return -ENOMEM; ret = comedi_alloc_subdevices(dev, 2); @@ -260,16 +255,15 @@ static int ni_670x_auto_attach(struct comedi_device *dev, s->insn_config = ni_670x_dio_insn_config; /* Config of misc registers */ - writel(0x10, devpriv->mmio + MISC_CONTROL_OFFSET); + writel(0x10, dev->mmio + MISC_CONTROL_OFFSET); /* Config of ao registers */ - writel(0x00, devpriv->mmio + AO_CONTROL_OFFSET); + writel(0x00, dev->mmio + AO_CONTROL_OFFSET); return 0; } static void ni_670x_detach(struct comedi_device *dev) { - struct ni_670x_private *devpriv = dev->private; struct comedi_subdevice *s; if (dev->n_subdevices) { @@ -277,8 +271,8 @@ static void ni_670x_detach(struct comedi_device *dev) if (s) kfree(s->range_table_list); } - if (devpriv && devpriv->mmio) - iounmap(devpriv->mmio); + if (dev->mmio) + iounmap(dev->mmio); comedi_pci_disable(dev); } -- 2.20.1