struct contec_private {
int data;
-
- struct pci_dev *pci_dev;
-
};
#define devpriv ((struct contec_private *)dev->private)
pcidev = contec_find_pci_dev(dev, it);
if (!pcidev)
return -EIO;
- devpriv->pci_dev = pcidev;
+ comedi_set_hw_dev(dev, &pcidev->dev);
if (comedi_pci_enable(pcidev, "contec_pci_dio")) {
printk("error enabling PCI device and request regions!\n");
static void contec_detach(struct comedi_device *dev)
{
- if (devpriv && devpriv->pci_dev) {
+ struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+
+ if (pcidev) {
if (dev->iobase)
- comedi_pci_disable(devpriv->pci_dev);
- pci_dev_put(devpriv->pci_dev);
+ comedi_pci_disable(pcidev);
+ pci_dev_put(pcidev);
}
}