Commit 594985d6 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: gsc_hpdi: don't store physical base addresses

In `struct hpdi_private`, the `plx9080_phys_iobase` and
`hpdi_phys_iobase` hold the physical memory addresses from the PCI
BARs used by this driver.  The physical addresses are only really needed
when ioremapping the resources when the device is being attached by
`hpdi_auto_attach()`.  A non-zero value of the `hpdi_phys_iobase` is
also used to indicate that a call to `comedi_pci_enable()` was
successful so that `comedi_pci_disable()` should be called when the
device is detached by `hpdi_detach()`.

Remove the `plx9080_phys_iobase` and `hpdi_phys_iobase` members and use
`dev->iobase` as a flag to indicate whether `comedi_pci_disable()` needs
to be called by `hpdi_detach()`.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fd67ad44
...@@ -213,9 +213,6 @@ static inline struct hpdi_board *board(const struct comedi_device *dev) ...@@ -213,9 +213,6 @@ static inline struct hpdi_board *board(const struct comedi_device *dev)
} }
struct hpdi_private { struct hpdi_private {
/* base addresses (physical) */
resource_size_t plx9080_phys_iobase;
resource_size_t hpdi_phys_iobase;
/* base addresses (ioremapped) */ /* base addresses (ioremapped) */
void __iomem *plx9080_iobase; void __iomem *plx9080_iobase;
void __iomem *hpdi_iobase; void __iomem *hpdi_iobase;
...@@ -506,23 +503,18 @@ static int __devinit hpdi_auto_attach(struct comedi_device *dev, ...@@ -506,23 +503,18 @@ static int __devinit hpdi_auto_attach(struct comedi_device *dev,
"failed enable PCI device and request regions\n"); "failed enable PCI device and request regions\n");
return -EIO; return -EIO;
} }
dev->iobase = 1; /* the "detach" needs this */
pci_set_master(pcidev); pci_set_master(pcidev);
/* Initialize dev->board_name */ /* Initialize dev->board_name */
dev->board_name = board(dev)->name; dev->board_name = board(dev)->name;
devpriv->plx9080_phys_iobase = devpriv->plx9080_iobase =
pci_resource_start(pcidev, PLX9080_BADDRINDEX); ioremap(pci_resource_start(pcidev, PLX9080_BADDRINDEX),
devpriv->hpdi_phys_iobase = pci_resource_len(pcidev, PLX9080_BADDRINDEX));
pci_resource_start(pcidev, HPDI_BADDRINDEX);
/* remap, won't work with 2.0 kernels but who cares */
devpriv->plx9080_iobase = ioremap(devpriv->plx9080_phys_iobase,
pci_resource_len(pcidev,
PLX9080_BADDRINDEX));
devpriv->hpdi_iobase = devpriv->hpdi_iobase =
ioremap(devpriv->hpdi_phys_iobase, ioremap(pci_resource_start(pcidev, HPDI_BADDRINDEX),
pci_resource_len(pcidev, HPDI_BADDRINDEX)); pci_resource_len(pcidev, HPDI_BADDRINDEX));
if (!devpriv->plx9080_iobase || !devpriv->hpdi_iobase) { if (!devpriv->plx9080_iobase || !devpriv->hpdi_iobase) {
dev_warn(dev->class_dev, "failed to remap io memory\n"); dev_warn(dev->class_dev, "failed to remap io memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -606,7 +598,7 @@ static void hpdi_detach(struct comedi_device *dev) ...@@ -606,7 +598,7 @@ static void hpdi_detach(struct comedi_device *dev)
NUM_DMA_DESCRIPTORS, NUM_DMA_DESCRIPTORS,
devpriv->dma_desc, devpriv->dma_desc,
devpriv->dma_desc_phys_addr); devpriv->dma_desc_phys_addr);
if (devpriv->hpdi_phys_iobase) if (dev->iobase)
comedi_pci_disable(pcidev); comedi_pci_disable(pcidev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment