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

staging: comedi: cb_pcidda: store the pci_dev in the comedi_device

Use the hw_dev pointer in the comedi_device struct to hold the
pci_dev instead of carrying it in the private data.

Save the pci bar in dev->iobase so the detach is consistent with
the other comedi pci drivers.
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 5b7c52a7
...@@ -216,9 +216,6 @@ static const struct cb_pcidda_board cb_pcidda_boards[] = { ...@@ -216,9 +216,6 @@ static const struct cb_pcidda_board cb_pcidda_boards[] = {
struct cb_pcidda_private { struct cb_pcidda_private {
int data; int data;
/* would be useful for a PCI device */
struct pci_dev *pci_dev;
unsigned long digitalio; unsigned long digitalio;
unsigned long dac; unsigned long dac;
...@@ -306,7 +303,7 @@ static int cb_pcidda_attach(struct comedi_device *dev, ...@@ -306,7 +303,7 @@ static int cb_pcidda_attach(struct comedi_device *dev,
pcidev = cb_pcidda_find_pci_dev(dev, it); pcidev = cb_pcidda_find_pci_dev(dev, it);
if (!pcidev) if (!pcidev)
return -EIO; return -EIO;
devpriv->pci_dev = pcidev; comedi_set_hw_dev(dev, &pcidev->dev);
/* /*
* Enable PCI device and request regions. * Enable PCI device and request regions.
...@@ -320,9 +317,9 @@ static int cb_pcidda_attach(struct comedi_device *dev, ...@@ -320,9 +317,9 @@ static int cb_pcidda_attach(struct comedi_device *dev,
/* /*
* Allocate the I/O ports. * Allocate the I/O ports.
*/ */
devpriv->digitalio = devpriv->digitalio = pci_resource_start(pcidev, DIGITALIO_BADRINDEX);
pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX); devpriv->dac = pci_resource_start(pcidev, DAC_BADRINDEX);
devpriv->dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX); dev->iobase = devpriv->dac;
/* /*
* Warn about the status of the driver. * Warn about the status of the driver.
...@@ -377,12 +374,12 @@ static int cb_pcidda_attach(struct comedi_device *dev, ...@@ -377,12 +374,12 @@ static int cb_pcidda_attach(struct comedi_device *dev,
static void cb_pcidda_detach(struct comedi_device *dev) static void cb_pcidda_detach(struct comedi_device *dev)
{ {
if (devpriv) { struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (devpriv->pci_dev) {
if (devpriv->dac) if (pcidev) {
comedi_pci_disable(devpriv->pci_dev); if (dev->iobase)
pci_dev_put(devpriv->pci_dev); comedi_pci_disable(pcidev);
} pci_dev_put(pcidev);
} }
if (dev->subdevices) { if (dev->subdevices) {
subdev_8255_cleanup(dev, dev->subdevices + 1); subdev_8255_cleanup(dev, dev->subdevices + 1);
......
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