From: H Hartley Sweeten Date: Thu, 19 Jul 2012 01:57:08 +0000 (-0700) Subject: staging: comedi: daqboard2000: store the pci_dev in the comedi_device X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ad196be73d4c5fd433cec22a306dcbab3fc7e25c;p=linux-beck.git staging: comedi: daqboard2000: 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. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 1d94b58db7c7..ba61e328fd29 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -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]; @@ -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) { @@ -833,6 +832,8 @@ out: 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) @@ -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); } }