staging: comedi: me4000: store the pci_dev in the comedi_device
authorH Hartley Sweeten <hartleys@visionengravers.com>
Sat, 8 Sep 2012 00:46:51 +0000 (17:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Sep 2012 04:53:01 +0000 (21:53 -0700)
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>
drivers/staging/comedi/drivers/me4000.c
drivers/staging/comedi/drivers/me4000.h

index 01557e2df1da1d0be56ebf5af606da35c3023c86..39eb7750a5e94c10f6aba7269d9e035c3af0bd1e 100644 (file)
@@ -1778,7 +1778,6 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
                                        }
                                        dev->board_ptr = me4000_boards + i;
                                        board = comedi_board(dev);
-                                       info->pci_dev_p = pci_device;
                                        goto found;
                                }
                        }
@@ -1787,6 +1786,7 @@ static int me4000_probe(struct comedi_device *dev, struct comedi_devconfig *it)
        return -ENODEV;
 
 found:
+       comedi_set_hw_dev(dev, &pci_device->dev);
        dev->board_name = board->name;
 
        result = comedi_pci_enable(pci_device, dev->board_name);
@@ -1944,15 +1944,14 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 static void me4000_detach(struct comedi_device *dev)
 {
-       struct me4000_info *info = dev->private;
+       struct pci_dev *pcidev = comedi_to_pci_dev(dev);
 
-       if (info) {
-               if (info->pci_dev_p) {
+       if (pcidev) {
+               if (dev->iobase) {
                        reset_board(dev);
-                       if (info->plx_regbase)
-                               comedi_pci_disable(info->pci_dev_p);
-                       pci_dev_put(info->pci_dev_p);
+                       comedi_pci_disable(pcidev);
                }
+               pci_dev_put(pcidev);
        }
 }
 
index a04c20960d5d5bd1bda3e422e7c63a68be4d9fd0..b6d8e3bdcb21421be31672abe6f7e0dd4e0da37e 100644 (file)
@@ -222,8 +222,6 @@ struct me4000_info {
        unsigned long timer_regbase;    /*  Base address of the timer circuit */
        unsigned long program_regbase;  /*  Base address to set the program pin for the xilinx */
 
-       struct pci_dev *pci_dev_p;      /*  General PCI information */
-
        unsigned int ao_readback[4];
 };