]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: 8255_pci: use the comedi_device 'mmio' member
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 29 Jul 2014 22:01:21 +0000 (15:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jul 2014 23:55:14 +0000 (16:55 -0700)
Use the new 'mmio' member in the comedi_device for the ioremap'ed
base address.

Since this was the only member in the private data, remove the struct
and its allocation.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/8255_pci.c

index e4cec932aef9a96494b377cd33039213a2f373b1..f21e6567ac2f81866ea16cf9195150fee1e20bfd 100644 (file)
@@ -167,10 +167,6 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = {
        },
 };
 
-struct pci_8255_private {
-       void __iomem *mmio_base;
-};
-
 /* ripped from mite.h and mite_setup2() to avoid mite dependancy */
 #define MITE_IODWBSR   0xc0     /* IO Device Window Base Size Register */
 #define WENAB          (1 << 7) /* window enable */
@@ -210,7 +206,6 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
 {
        struct pci_dev *pcidev = comedi_to_pci_dev(dev);
        const struct pci_8255_boardinfo *board = NULL;
-       struct pci_8255_private *devpriv;
        struct comedi_subdevice *s;
        bool is_mmio;
        int ret;
@@ -223,10 +218,6 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
-       devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
-       if (!devpriv)
-               return -ENOMEM;
-
        ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
@@ -240,8 +231,8 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
        is_mmio = (pci_resource_flags(pcidev, board->dio_badr) &
                   IORESOURCE_MEM) != 0;
        if (is_mmio) {
-               devpriv->mmio_base = pci_ioremap_bar(pcidev, board->dio_badr);
-               if (!devpriv->mmio_base)
+               dev->mmio = pci_ioremap_bar(pcidev, board->dio_badr);
+               if (!dev->mmio)
                        return -ENOMEM;
        } else {
                dev->iobase = pci_resource_start(pcidev, board->dio_badr);
@@ -261,7 +252,7 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
 
                s = &dev->subdevices[i];
                if (is_mmio) {
-                       iobase = (unsigned long)(devpriv->mmio_base + (i * 4));
+                       iobase = (unsigned long)(dev->mmio + (i * 4));
                        ret = subdev_8255_init(dev, s, pci_8255_mmio, iobase);
                } else {
                        iobase = dev->iobase + (i * 4);
@@ -276,10 +267,8 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
 
 static void pci_8255_detach(struct comedi_device *dev)
 {
-       struct pci_8255_private *devpriv = dev->private;
-
-       if (devpriv && devpriv->mmio_base)
-               iounmap(devpriv->mmio_base);
+       if (dev->mmio)
+               iounmap(dev->mmio);
        comedi_pci_disable(dev);
 }