]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
staging: comedi_pci: pass comedi_device to comedi_pci_enable()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 13 Mar 2013 17:36:31 +0000 (10:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Mar 2013 20:56:19 +0000 (13:56 -0700)
Make comedi_pci_enable() use the same parameter type as
comedi_pci_disable(). This also allows comedi_pci_enable
to automatically determine the resource name passed to
pci_request_regions().

Make sure the errno value returned is passed on instead of
assuming an errno. Also, remove any kernel noise that is
generated when the call fails.

The National Instruments drivers that use the mite module
currently enable the PCI device in the mite module. For
those drivers move the call to comedi_pci_enable into the
driver.

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>
53 files changed:
drivers/staging/comedi/comedi_pci.c
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers/8255_pci.c
drivers/staging/comedi/drivers/addi-data/addi_common.c
drivers/staging/comedi/drivers/addi_apci_1032.c
drivers/staging/comedi/drivers/addi_apci_1516.c
drivers/staging/comedi/drivers/addi_apci_16xx.c
drivers/staging/comedi/drivers/addi_apci_1710.c
drivers/staging/comedi/drivers/addi_apci_2032.c
drivers/staging/comedi/drivers/addi_apci_2200.c
drivers/staging/comedi/drivers/addi_apci_3120.c
drivers/staging/comedi/drivers/addi_apci_3501.c
drivers/staging/comedi/drivers/adl_pci6208.c
drivers/staging/comedi/drivers/adl_pci7x3x.c
drivers/staging/comedi/drivers/adl_pci8164.c
drivers/staging/comedi/drivers/adl_pci9111.c
drivers/staging/comedi/drivers/adl_pci9118.c
drivers/staging/comedi/drivers/adv_pci1710.c
drivers/staging/comedi/drivers/adv_pci1723.c
drivers/staging/comedi/drivers/adv_pci1724.c
drivers/staging/comedi/drivers/adv_pci_dio.c
drivers/staging/comedi/drivers/amplc_dio200.c
drivers/staging/comedi/drivers/amplc_pc236.c
drivers/staging/comedi/drivers/amplc_pc263.c
drivers/staging/comedi/drivers/amplc_pci224.c
drivers/staging/comedi/drivers/amplc_pci230.c
drivers/staging/comedi/drivers/cb_pcidas.c
drivers/staging/comedi/drivers/cb_pcidas64.c
drivers/staging/comedi/drivers/cb_pcidda.c
drivers/staging/comedi/drivers/cb_pcimdas.c
drivers/staging/comedi/drivers/cb_pcimdda.c
drivers/staging/comedi/drivers/contec_pci_dio.c
drivers/staging/comedi/drivers/daqboard2000.c
drivers/staging/comedi/drivers/das08_pci.c
drivers/staging/comedi/drivers/dt3000.c
drivers/staging/comedi/drivers/dyna_pci10xx.c
drivers/staging/comedi/drivers/gsc_hpdi.c
drivers/staging/comedi/drivers/icp_multi.c
drivers/staging/comedi/drivers/jr3_pci.c
drivers/staging/comedi/drivers/ke_counter.c
drivers/staging/comedi/drivers/me4000.c
drivers/staging/comedi/drivers/me_daq.c
drivers/staging/comedi/drivers/mite.c
drivers/staging/comedi/drivers/ni_6527.c
drivers/staging/comedi/drivers/ni_65xx.c
drivers/staging/comedi/drivers/ni_660x.c
drivers/staging/comedi/drivers/ni_670x.c
drivers/staging/comedi/drivers/ni_labpc.c
drivers/staging/comedi/drivers/ni_pcidio.c
drivers/staging/comedi/drivers/ni_pcimio.c
drivers/staging/comedi/drivers/rtd520.c
drivers/staging/comedi/drivers/s626.c
drivers/staging/comedi/drivers/skel.c

index bee012c1e6a248624b8b4727b24cdbaaaeb6a098..b164b0353ebeaf15be0f5e5f6430f5a3b8d21864 100644 (file)
@@ -36,18 +36,23 @@ EXPORT_SYMBOL_GPL(comedi_to_pci_dev);
 
 /**
  * comedi_pci_enable() - Enable the PCI device and request the regions.
- * @pcidev: pci_dev struct
- * @res_name: name for the requested reqource
+ * @dev: comedi_device struct
  */
-int comedi_pci_enable(struct pci_dev *pcidev, const char *res_name)
+int comedi_pci_enable(struct comedi_device *dev)
 {
+       struct pci_dev *pcidev = comedi_to_pci_dev(dev);
        int rc;
 
+       if (!pcidev)
+               return -ENODEV;
+
        rc = pci_enable_device(pcidev);
        if (rc < 0)
                return rc;
 
-       rc = pci_request_regions(pcidev, res_name);
+       rc = pci_request_regions(pcidev, dev->board_name
+                                               ? dev->board_name
+                                               : dev->driver->driver_name);
        if (rc < 0)
                pci_disable_device(pcidev);
 
index 9846c2ecc916dd421b31002f074ec94761b427a6..f638381fe4249fd5b177f2bfd5154720d304b45b 100644 (file)
@@ -384,7 +384,7 @@ struct pci_driver;
 
 struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
 
-int comedi_pci_enable(struct pci_dev *, const char *);
+int comedi_pci_enable(struct comedi_device *);
 void comedi_pci_disable(struct comedi_device *);
 
 int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *,
@@ -421,7 +421,7 @@ static inline struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev)
        return NULL;
 }
 
-static inline int comedi_pci_enable(struct pci_dev *dev, const char *name)
+static inline int comedi_pci_enable(struct comedi_device *dev)
 {
        return -ENOSYS;
 }
index a546dff61925fd6933fb2a274075e28777dfbd05..808460bbd32ea1e2a29119bd0da34542a6c3c17e 100644 (file)
@@ -204,7 +204,7 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        iobase = pci_resource_start(pcidev, board->dio_badr);
index 704a56eec6b75e01b453f9911f21d74de6683389..cb9b590f63b923a976366534275f18380db73ca1 100644 (file)
@@ -101,7 +101,7 @@ static int addi_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index 4da6e8b14dc17b1f77dcb3645b310504dc327a16..3d32448e4e69f555f49ba02cac630269dbfb7c0a 100644 (file)
@@ -303,7 +303,7 @@ static int apci1032_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index a7e449db46936fcf1c0ca320a8af7bbbe7cdd3e4..e66ff4e05cdb75ed384f51395cc53c187f10bc09 100644 (file)
@@ -148,7 +148,7 @@ static int apci1516_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index e2f9357d4c35f42c54a167d850269c308bab9ac7..4c6a9b5a06aeeb31c29f54031e163d261dfb82dd 100644 (file)
@@ -142,7 +142,7 @@ static int apci16xx_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index 05e1b9c391e68c86bd7de5000baa013711451346..f36ad00cee4a1a5af2e8a012497c2e1febf549d3 100644 (file)
@@ -42,7 +42,7 @@ static int apci1710_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index 6e4ee0ae67aa03e52afd677e119218e9b20cc59d..59e092eab9f3455b723eb151314f9d84a32c235a 100644 (file)
@@ -289,7 +289,7 @@ static int apci2032_auto_attach(struct comedi_device *dev,
 
        dev->board_name = dev->driver->driver_name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 1);
index aea0abb1a0af8bdf15ff8a8140f859009f7d0a64..0953f65ab0ad67f5a8f370f003856ffe732d139a 100644 (file)
@@ -90,7 +90,7 @@ static int apci2200_auto_attach(struct comedi_device *dev,
 
        dev->board_name = dev->driver->driver_name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index 056153157e51223ccb5230d8f2b2e85b3b7c6a4c..1c5ac16aad156226b1b928aec6508d074279a6eb 100644 (file)
@@ -70,7 +70,7 @@ static int apci3120_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        pci_set_master(pcidev);
index 8bd3d72df0a6ef816bcfb7aa500656195c65094a..75a36e364932fd094102b87b0dc61b6c8ddf20d2 100644 (file)
@@ -346,7 +346,7 @@ static int apci3501_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index 8939bbdaee5f0f7e4c8009e4f15cc3789e908f01..8a438ff1bd45979f7ec391b0a9d88e5d58221f81 100644 (file)
@@ -181,7 +181,7 @@ static int pci6208_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 2);
index bd2e58415d77aa9316489d26c6887187b8012c24..e3960745f506ed671041b86ebbf48bb8353a7db3 100644 (file)
@@ -164,7 +164,7 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 2);
index 008f89aea4babf88b11960ce1d8de6a154d1ec7a..469a51d97b82cc407078cec01fbaef229b6e3dd0 100644 (file)
@@ -80,7 +80,7 @@ static int adl_pci8164_auto_attach(struct comedi_device *dev,
 
        dev->board_name = dev->driver->driver_name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 2);
index ee45ee8c03c4a43a8585150bfcd5740e06dec86e..9c27e981db0c5255f545cf63bfc3c2b8b0b3857c 100644 (file)
@@ -872,7 +872,7 @@ static int pci9111_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = dev_private;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev_private->lcr_io_base = pci_resource_start(pcidev, 1);
index 2bf00e83454068f3256fe703b24d6f06fe1b6278..cb4ef2dcbf020133bd78580ee33faf62b074a7bc 100644 (file)
@@ -1970,12 +1970,9 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq,
        u16 u16w;
 
        dev->board_name = this_board->name;
-       ret = comedi_pci_enable(pcidev, dev->board_name);
-       if (ret) {
-               dev_err(dev->class_dev,
-                       "cannot enable PCI device %s\n", pci_name(pcidev));
+       ret = comedi_pci_enable(dev);
+       if (ret)
                return ret;
-       }
        if (master)
                pci_set_master(pcidev);
 
index af302fe3f5cb54ca4ceba34defcff0a7b2613149..52672c53e11edc6f89a9ef56f5b5170503d3528e 100644 (file)
@@ -1248,7 +1248,7 @@ static int pci1710_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 2);
index 25f4cba5a75b69bbfe5293a976ced67078da6d3d..9e81e58a6e695d4a3f4ebc4f691aa121427c4f15 100644 (file)
@@ -249,7 +249,7 @@ static int pci1723_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 2);
index c799308adfb40f1c7c3d8d40c2c302f3d0fff3c4..a33929e87a2f34ee112b2b67c9e62fd6f90324c5 100644 (file)
@@ -360,7 +360,7 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev,
 
        dev->board_name = dev->driver->driver_name;
 
-       retval = comedi_pci_enable(pcidev, dev->board_name);
+       retval = comedi_pci_enable(dev);
        if (retval)
                return retval;
 
index 79f72d6d7de1381f556f5934738cc68903ae406c..3a05fbca9299d8b95ab84e2fd71218d54e99e2a0 100644 (file)
@@ -1104,7 +1104,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, this_board->main_pci_region);
index d13a6dddcd09165bd2cdeb6287727d1a2d0b6362..652494289a13cafa7bdade07f1d4a636b77e5433 100644 (file)
@@ -1950,12 +1950,11 @@ static int dio200_auto_attach(struct comedi_device *dev,
                return -EINVAL;
        }
        thisboard = comedi_board(dev);
-       ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME);
-       if (ret < 0) {
-               dev_err(dev->class_dev,
-                       "error! cannot enable PCI device and request regions!\n");
+
+       ret = comedi_pci_enable(dev);
+       if (ret)
                return ret;
-       }
+
        bar = thisboard->mainbar;
        base = pci_resource_start(pci_dev, bar);
        len = pci_resource_len(pci_dev, bar);
index 45168488503d9691d59fa8adae93a4101eb2e1ee..4507f92e15795b344a2a125734885de139bebe91 100644 (file)
@@ -470,12 +470,10 @@ static int pc236_pci_common_attach(struct comedi_device *dev,
 
        comedi_set_hw_dev(dev, &pci_dev->dev);
 
-       ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME);
-       if (ret < 0) {
-               dev_err(dev->class_dev,
-                       "error! cannot enable PCI device and request regions!\n");
+       ret = comedi_pci_enable(dev);
+       if (ret)
                return ret;
-       }
+
        devpriv->lcr_iobase = pci_resource_start(pci_dev, 1);
        iobase = pci_resource_start(pci_dev, 2);
        return pc236_common_attach(dev, iobase, pci_dev->irq, IRQF_SHARED);
index d825414994b8f158c808a0277d74695d47d4457c..b8449433eee755111d5f4af93aabecaadc702537 100644 (file)
@@ -249,13 +249,11 @@ static int pc263_pci_common_attach(struct comedi_device *dev,
 
        comedi_set_hw_dev(dev, &pci_dev->dev);
 
-       ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME);
-       if (ret < 0) {
-               dev_err(dev->class_dev,
-                       "error! cannot enable PCI device and request regions!\n");
+       ret = comedi_pci_enable(dev);
+       if (ret)
                return ret;
-       }
        iobase = pci_resource_start(pci_dev, 2);
+
        return pc263_common_attach(dev, iobase);
 }
 
index 3d5c1332eb34847bbc403cf025e2ec8dfc8eb905..4d7eab9b55658c0866a1b2be54d2213be0632a39 100644 (file)
@@ -1280,13 +1280,10 @@ static int pci224_attach_common(struct comedi_device *dev,
 
        comedi_set_hw_dev(dev, &pci_dev->dev);
 
-       ret = comedi_pci_enable(pci_dev, DRIVER_NAME);
-       if (ret < 0) {
-               dev_err(dev->class_dev,
-                       "error! cannot enable PCI device and request regions!\n"
-                       );
+       ret = comedi_pci_enable(dev);
+       if (ret)
                return ret;
-       }
+
        spin_lock_init(&devpriv->ao_spinlock);
 
        devpriv->iobase1 = pci_resource_start(pci_dev, 2);
index 1bfe893b4cb27930e71a540c855edbc24f358d43..b6e4af444ef5718588178048acc591eb04af75b7 100644 (file)
@@ -2645,12 +2645,11 @@ static int pci230_attach_common(struct comedi_device *dev,
        comedi_set_hw_dev(dev, &pci_dev->dev);
 
        dev->board_name = thisboard->name;
-       /* Enable PCI device and reserve I/O spaces. */
-       if (comedi_pci_enable(pci_dev, "amplc_pci230") < 0) {
-               dev_err(dev->class_dev,
-                       "failed to enable PCI device and request regions\n");
-               return -EIO;
-       }
+
+       rc = comedi_pci_enable(dev);
+       if (rc)
+               return rc;
+
        /* Read base addresses of the PCI230's two I/O regions from PCI
         * configuration register. */
        iobase1 = pci_resource_start(pci_dev, 2);
index 04aa8d948a8b1c7b124099536733efb155f33e1a..7a23d56645e7024e740157fa4402f3274d6b28e1 100644 (file)
@@ -1455,7 +1455,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = 1;
index 15a97212b15849a5b8288ad3c8e252640a2b53e3..46b6af4c517d8811b0f83119723263b726bcf146 100644 (file)
@@ -4059,11 +4059,9 @@ static int auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
-               dev_warn(dev->class_dev,
-                        "failed to enable PCI device and request regions\n");
-               return -EIO;
-       }
+       retval = comedi_pci_enable(dev);
+       if (retval)
+               return retval;
        pci_set_master(pcidev);
 
        /* Initialize dev->board_name */
index aff16171ca938833ab5e5de9d3136d2fbf5b9ddd..2da6bd663affc4869e4118331c3c46e892792f4e 100644 (file)
@@ -357,7 +357,7 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 3);
index 8a8677f2525ebea3bce8ab5ba7fee5fca8c3ec73..f6d99a3a972e404b4c4dde01999f60fa5a43e9ce 100644 (file)
@@ -222,7 +222,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
 
index 7b8adec5e7b92105866c1a09292729120005e34a..d00f7f629d36fc8ab7f5d203792f8eb5b5344e10 100644 (file)
@@ -168,7 +168,7 @@ static int cb_pcimdda_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 3);
index b8c56a60cda972017f19f987ec0706534a775a98..da0be62aef600097abd09d0efe983eeb31a52b60 100644 (file)
@@ -79,7 +79,7 @@ static int contec_auto_attach(struct comedi_device *dev,
 
        dev->board_name = dev->driver->driver_name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 0);
index 077f9a5eb7c87f927e782e5d2700bdf3bd204570..7c549eb442f89491b9a8ab8fe6ea716e40e0d2f3 100644 (file)
@@ -709,8 +709,8 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       result = comedi_pci_enable(pcidev, dev->driver->driver_name);
-       if (result < 0)
+       result = comedi_pci_enable(dev);
+       if (result)
                return result;
        dev->iobase = 1;        /* the "detach" needs this */
 
index c64fb2775b8cded9c4e89ae420c1b8f29d313ef2..53fa943dd0b7038393c6d58bbe81754c32a892f5 100644 (file)
@@ -71,7 +71,7 @@ static int das08_pci_auto_attach(struct comedi_device *dev,
        /* The das08 driver needs the board_ptr */
        dev->board_ptr = &das08_pci_boards[0];
 
-       ret = comedi_pci_enable(pdev, dev->driver->driver_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pdev, 2);
index 296c5205ac9f2f617de0933bc56ca87792953532..edbcd89aff9d67f945204c8babd11c8902d5804a 100644 (file)
@@ -735,7 +735,7 @@ static int dt3000_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret < 0)
                return ret;
        dev->iobase = 1;        /* the "detach" needs this */
index 9f83dfbcf2956ddd547034363dbbda2d0f4310fa..17f9ec2a9072fc6b7358a762fb66645297192d18 100644 (file)
@@ -194,7 +194,7 @@ static int dyna_pci10xx_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 2);
index f0e92143ac8982780064caf211cab1fcbfae62eb..16b4cc050d3537776b98409850b97a609a18fb09 100644 (file)
@@ -499,11 +499,9 @@ static int hpdi_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       if (comedi_pci_enable(pcidev, dev->board_name)) {
-               dev_warn(dev->class_dev,
-                        "failed enable PCI device and request regions\n");
-               return -EIO;
-       }
+       retval = comedi_pci_enable(dev);
+       if (retval)
+               return retval;
        dev->iobase = 1;        /* the "detach" needs this */
        pci_set_master(pcidev);
 
index 65265c3ce3ff69a4c162c51b152100261a69544e..f29a797fd9d5741da712f1532f7e55cb89b41ed1 100644 (file)
@@ -510,7 +510,7 @@ static int icp_multi_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        iobase = pci_resource_start(pcidev, 2);
index f1ae9a814d8fd1fb4109c2b0aae99595372a9362..36659e500f40d8d7bcaa8debd481553a33db577d 100644 (file)
@@ -702,11 +702,11 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
        }
        dev->board_name = "jr3_pci";
 
-       result = comedi_pci_enable(pcidev, "jr3_pci");
-       if (result < 0)
+       result = comedi_pci_enable(dev);
+       if (result)
                return result;
-
        dev->iobase = 1;        /* the "detach" needs this */
+
        devpriv->iobase = ioremap(pci_resource_start(pcidev, 0),
                                  offsetof(struct jr3_t,
                                           channel[devpriv->n_channels]));
index 74318f204e25b8801b3e28d6a292c3fcf5bdd0b2..bca29e5f4fc5e798b01aab348c5b300a96c91a1d 100644 (file)
@@ -98,7 +98,7 @@ static int cnt_auto_attach(struct comedi_device *dev,
 
        dev->board_name = dev->driver->driver_name;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = pci_resource_start(pcidev, 0);
index 6bc1347eaf68271f614ed08465ef6a4602d8b38c..e415db2d069eb69706049144290e21056b094cae 100644 (file)
@@ -1571,7 +1571,7 @@ static int me4000_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = info;
 
-       result = comedi_pci_enable(pcidev, dev->board_name);
+       result = comedi_pci_enable(dev);
        if (result)
                return result;
 
index 8951a673c2d1b5cd66409897e8acc838928dfe24..fbbac1259ebd0d70e9486942d5a47718ae27a65a 100644 (file)
@@ -511,7 +511,7 @@ static int me_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = dev_private;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = 1;        /* detach needs this */
index 5a3b14fb4de19520afe6f3d5f282be19942a1556..9a456624ab4e1bb3b7c73f0957371c26949454b9 100644 (file)
@@ -109,11 +109,6 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
        u32 csigr_bits;
        unsigned unknown_dma_burst_bits;
 
-       if (comedi_pci_enable(mite->pcidev, "mite")) {
-               dev_err(&mite->pcidev->dev,
-                       "error enabling mite and requesting io regions\n");
-               return -EIO;
-       }
        pci_set_master(mite->pcidev);
 
        addr = pci_resource_start(mite->pcidev, 0);
index 194eac63dd3e75ad30f9b626628518990fa3b1d4..65dd1c68721a1f996ff795c469dfdf4a36882bf4 100644 (file)
@@ -336,6 +336,11 @@ static int ni6527_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
                return -ENOMEM;
@@ -350,7 +355,6 @@ static int ni6527_auto_attach(struct comedi_device *dev,
                dev_err(dev->class_dev, "error setting up mite\n");
                return ret;
        }
-       dev->iobase = 1;
 
        dev_info(dev->class_dev, "board: %s, ID=0x%02x\n", dev->board_name,
                 readb(devpriv->mite->daq_io_addr + ID_Register));
index b882a5f5b035e684dc5456232f7f96448d4241de..eec712e5e1387272c7bd2d481277249948d7be13 100644 (file)
@@ -600,6 +600,11 @@ static int ni_65xx_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
                return -ENOMEM;
@@ -614,7 +619,6 @@ static int ni_65xx_auto_attach(struct comedi_device *dev,
                dev_warn(dev->class_dev, "error setting up mite\n");
                return ret;
        }
-       dev->iobase = 1;
 
        dev->irq = mite_irq(devpriv->mite);
        dev_info(dev->class_dev, "board: %s, ID=0x%02x", dev->board_name,
index cc82106af7f02bf578f3951989333b9b94aba0c3..f97a668143d86fe247beef1abe3c0c23b2881e22 100644 (file)
@@ -1174,6 +1174,11 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        ret = ni_660x_allocate_private(dev);
        if (ret < 0)
                return ret;
@@ -1188,7 +1193,6 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
                dev_warn(dev->class_dev, "error setting up mite\n");
                return ret;
        }
-       dev->iobase = 1;
 
        ret = ni_660x_alloc_mite_rings(dev);
        if (ret < 0)
index 5ec6f829a924aa865bf9b0aa082b079d1051bb93..524f6cd7268754c00d42397010a5897570a6e47d 100644 (file)
@@ -208,6 +208,11 @@ static int ni_670x_auto_attach(struct comedi_device *dev,
        dev->board_ptr = thisboard;
        dev->board_name = thisboard->name;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
                return -ENOMEM;
@@ -222,7 +227,6 @@ static int ni_670x_auto_attach(struct comedi_device *dev,
                dev_warn(dev->class_dev, "error setting up mite\n");
                return ret;
        }
-       dev->iobase = 1;
 
        ret = comedi_alloc_subdevices(dev, 2);
        if (ret)
index 9082eca09499356e572a22c0eed73752bbc614bb..78f01709e22205d3a6c1ad2e3a69725758ce48d0 100644 (file)
@@ -708,6 +708,11 @@ static int labpc_auto_attach(struct comedi_device *dev,
        if (!IS_ENABLED(CONFIG_COMEDI_PCI_DRIVERS))
                return -ENODEV;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
                return -ENOMEM;
@@ -722,7 +727,6 @@ static int labpc_auto_attach(struct comedi_device *dev,
        ret = mite_setup(devpriv->mite);
        if (ret < 0)
                return ret;
-       dev->iobase = 1;
        iobase = (unsigned long)devpriv->mite->daq_io_addr;
        irq = mite_irq(devpriv->mite);
        return labpc_common_attach(dev, iobase, irq, 0);
index 8f743751507b476c93797c018447b1074c2f26b9..2298d6ee12ef0b946622e02211ea0349bcceb01b 100644 (file)
@@ -1112,6 +1112,11 @@ static int nidio_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
                return -ENOMEM;
@@ -1128,7 +1133,6 @@ static int nidio_auto_attach(struct comedi_device *dev,
                dev_warn(dev->class_dev, "error setting up mite\n");
                return ret;
        }
-       dev->iobase = 1;
 
        devpriv->di_mite_ring = mite_alloc_ring(devpriv->mite);
        if (devpriv->di_mite_ring == NULL)
index 0f18f8dda5fb84c6d73e9d0e2290abd350401f33..098c398f2bea6f78114999a5c5b1510a3923cdea 100644 (file)
@@ -1488,6 +1488,11 @@ static int pcimio_auto_attach(struct comedi_device *dev,
        dev->board_ptr = board;
        dev->board_name = board->name;
 
+       ret = comedi_pci_enable(dev);
+       if (ret)
+               return ret;
+       dev->iobase = 1;
+
        ret = ni_alloc_private(dev);
        if (ret)
                return ret;
@@ -1514,7 +1519,6 @@ static int pcimio_auto_attach(struct comedi_device *dev,
                pr_warn("error setting up mite\n");
                return ret;
        }
-       dev->iobase = 1;
 
        devpriv->ai_mite_ring = mite_alloc_ring(devpriv->mite);
        if (devpriv->ai_mite_ring == NULL)
index 5b0676817726364ee40fff61d8267fa91b29f371..c0935d4a89c1b27a88bbb5a0d477da7b7bcc38b4 100644 (file)
@@ -1283,7 +1283,7 @@ static int rtd_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = 1;        /* the "detach" needs this */
index 92338791f4a255bc743c62c8ab6eba496a9322f7..cd164ee3a5e1a880271e0a675165a5ff63da55e3 100644 (file)
@@ -2673,7 +2673,7 @@ static int s626_auto_attach(struct comedi_device *dev,
                return -ENOMEM;
        dev->private = devpriv;
 
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;
        dev->iobase = 1;        /* detach needs this */
index f5d708c3aa5bf96ef745d5734f1d2a3da692686f..6fb7d5d220946c4c313e3a74f9e77678cca0b6d6 100644 (file)
@@ -567,7 +567,7 @@ static int skel_auto_attach(struct comedi_device *dev,
        dev->private = devpriv;
 
        /* Enable the PCI device. */
-       ret = comedi_pci_enable(pcidev, dev->board_name);
+       ret = comedi_pci_enable(dev);
        if (ret)
                return ret;