From 78b469387d961bd8f6c2bc3a5be1aaf1a2c27087 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 29 Jul 2014 15:01:21 -0700 Subject: [PATCH] staging: comedi: 8255_pci: use the comedi_device 'mmio' member 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255_pci.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index e4cec932aef9..f21e6567ac2f 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -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); } -- 2.11.0