Skip to content

Commit

Permalink
staging: comedi: daqboard2000: store the pci_dev in the comedi_device
Browse files Browse the repository at this point in the history
Use the hw_dev pointer in the comedi_device struct to hold the
pci_dev instead of carrying it in the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 19, 2012
1 parent f55354b commit ad196be
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/staging/comedi/drivers/daqboard2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ struct daqboard2000_private {
enum {
card_daqboard_2000
} card;
struct pci_dev *pci_dev;
void *daq;
void *plx;
unsigned int ao_readback[2];
Expand Down Expand Up @@ -751,7 +750,7 @@ static int daqboard2000_attach(struct comedi_device *dev,
pcidev = daqboard2000_find_pci_dev(dev, it);
if (!pcidev)
return -EIO;
devpriv->pci_dev = pcidev;
comedi_set_hw_dev(dev, &pcidev->dev);

result = comedi_pci_enable(pcidev, "daqboard2000");
if (result < 0) {
Expand Down Expand Up @@ -833,6 +832,8 @@ static int daqboard2000_attach(struct comedi_device *dev,

static void daqboard2000_detach(struct comedi_device *dev)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);

if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 2);
if (dev->irq)
Expand All @@ -842,11 +843,11 @@ static void daqboard2000_detach(struct comedi_device *dev)
iounmap(devpriv->daq);
if (devpriv->plx)
iounmap(devpriv->plx);
if (devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
}
if (pcidev) {
if (dev->iobase)
comedi_pci_disable(pcidev);
pci_dev_put(pcidev);
}
}

Expand Down

0 comments on commit ad196be

Please sign in to comment.