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 <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2014-07-29 15:01:21 -07:00 committed by Greg Kroah-Hartman
parent d7e6dc1338
commit 78b469387d
1 changed files with 5 additions and 16 deletions

View 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);
}