Commit 39ed05b7 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: rtd520: remove 'got_regions' from private data

The 'got_regions' variable in the private data is used as a flag
for the detach to know if the pci device has been enabled.

Typically the dev->iobase variable is used to indicate this in
all the other comedi drivers. Do the same here for consistancy.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 82590696
...@@ -312,7 +312,6 @@ struct rtdPrivate { ...@@ -312,7 +312,6 @@ struct rtdPrivate {
/* PCI device info */ /* PCI device info */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
int got_regions; /* non-zero if PCI regions owned */
/* channel list info */ /* channel list info */
/* chanBipolar tracks whether a channel is bipolar (and needs +2048) */ /* chanBipolar tracks whether a channel is bipolar (and needs +2048) */
...@@ -1623,7 +1622,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1623,7 +1622,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
struct rtdPrivate *devpriv; struct rtdPrivate *devpriv;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret; int ret;
resource_size_t physLas0; /* configuration */
resource_size_t physLas1; /* data area */ resource_size_t physLas1; /* data area */
resource_size_t physLcfg; /* PLX9080 */ resource_size_t physLcfg; /* PLX9080 */
#ifdef USE_DMA #ifdef USE_DMA
...@@ -1658,18 +1656,17 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1658,18 +1656,17 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); printk(KERN_INFO "Failed to enable PCI device and request regions.\n");
return ret; return ret;
} }
devpriv->got_regions = 1;
/* /*
* Initialize base addresses * Initialize base addresses
*/ */
/* Get the physical address from PCI config */ /* Get the physical address from PCI config */
physLas0 = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); dev->iobase = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX);
physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX); physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX);
physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX); physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX);
/* Now have the kernel map this into memory */ /* Now have the kernel map this into memory */
/* ASSUME page aligned */ /* ASSUME page aligned */
devpriv->las0 = ioremap_nocache(physLas0, LAS0_PCISIZE); devpriv->las0 = ioremap_nocache(dev->iobase, LAS0_PCISIZE);
devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE); devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE);
devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE); devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE);
...@@ -2000,7 +1997,7 @@ static void rtd_detach(struct comedi_device *dev) ...@@ -2000,7 +1997,7 @@ static void rtd_detach(struct comedi_device *dev)
if (devpriv->lcfg) if (devpriv->lcfg)
iounmap(devpriv->lcfg); iounmap(devpriv->lcfg);
if (devpriv->pci_dev) { if (devpriv->pci_dev) {
if (devpriv->got_regions) if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev); comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev);
} }
......
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