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

staging: comedi: daqboard2000: 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 f34ec800
...@@ -320,7 +320,6 @@ struct daqboard2000_private { ...@@ -320,7 +320,6 @@ struct daqboard2000_private {
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
void *daq; void *daq;
void *plx; void *plx;
int got_regions;
unsigned int ao_readback[2]; unsigned int ao_readback[2];
}; };
...@@ -760,11 +759,11 @@ static int daqboard2000_attach(struct comedi_device *dev, ...@@ -760,11 +759,11 @@ static int daqboard2000_attach(struct comedi_device *dev,
"failed to enable PCI device and request regions\n"); "failed to enable PCI device and request regions\n");
return -EIO; return -EIO;
} }
devpriv->got_regions = 1; dev->iobase = pci_resource_start(pcidev, 2);
devpriv->plx = devpriv->plx =
ioremap(pci_resource_start(pcidev, 0), DAQBOARD2000_PLX_SIZE); ioremap(pci_resource_start(pcidev, 0), DAQBOARD2000_PLX_SIZE);
devpriv->daq = devpriv->daq = ioremap(dev->iobase, DAQBOARD2000_DAQ_SIZE);
ioremap(pci_resource_start(pcidev, 2), DAQBOARD2000_DAQ_SIZE);
if (!devpriv->plx || !devpriv->daq) if (!devpriv->plx || !devpriv->daq)
return -ENOMEM; return -ENOMEM;
...@@ -844,7 +843,7 @@ static void daqboard2000_detach(struct comedi_device *dev) ...@@ -844,7 +843,7 @@ static void daqboard2000_detach(struct comedi_device *dev)
if (devpriv->plx) if (devpriv->plx)
iounmap(devpriv->plx); iounmap(devpriv->plx);
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