staging: comedi/drivers: use auto_attach instead of attach_usb
authorIan Abbott <abbotti@mev.co.uk>
Tue, 30 Oct 2012 13:30:03 +0000 (13:30 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Oct 2012 17:53:50 +0000 (10:53 -0700)
Change the usbdux, usbduxfast and usbduxsigma drivers to use the new
`auto_attach()` method instead of the `attach_usb()` method.  I plan to
remove the `attach_usb()` and `attach_pci()` methods from `struct
comedi_driver` once nothing is using them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/usbdux.c
drivers/staging/comedi/drivers/usbduxfast.c
drivers/staging/comedi/drivers/usbduxsigma.c

index e89f4e2..9629b4f 100644 (file)
@@ -2375,9 +2375,10 @@ static int usbdux_attach_common(struct comedi_device *dev,
        return 0;
 }
 
-static int usbdux_attach_usb(struct comedi_device *dev,
-                            struct usb_interface *uinterf)
+static int usbdux_auto_attach(struct comedi_device *dev,
+                             unsigned long context_unused)
 {
+       struct usb_interface *uinterf = comedi_to_usb_interface(dev);
        int ret;
        struct usbduxsub *this_usbduxsub;
 
@@ -2387,11 +2388,11 @@ static int usbdux_attach_usb(struct comedi_device *dev,
        this_usbduxsub = usb_get_intfdata(uinterf);
        if (!this_usbduxsub || !this_usbduxsub->probed) {
                dev_err(dev->class_dev,
-                       "usbdux: error: attach_usb failed, not connected\n");
+                       "usbdux: error: auto_attach failed, not connected\n");
                ret = -ENODEV;
        } else if (this_usbduxsub->attached) {
                dev_err(dev->class_dev,
-                       "error: attach_usb failed, already attached\n");
+                       "error: auto_attach failed, already attached\n");
                ret = -ENODEV;
        } else
                ret = usbdux_attach_common(dev, this_usbduxsub);
@@ -2415,7 +2416,7 @@ static void usbdux_detach(struct comedi_device *dev)
 static struct comedi_driver usbdux_driver = {
        .driver_name    = "usbdux",
        .module         = THIS_MODULE,
-       .attach_usb     = usbdux_attach_usb,
+       .auto_attach    = usbdux_auto_attach,
        .detach         = usbdux_detach,
 };
 
index b4e987b..845f240 100644 (file)
@@ -1444,9 +1444,10 @@ static int usbduxfast_attach_common(struct comedi_device *dev,
        return 0;
 }
 
-static int usbduxfast_attach_usb(struct comedi_device *dev,
-                                struct usb_interface *uinterf)
+static int usbduxfast_auto_attach(struct comedi_device *dev,
+                                 unsigned long context_unused)
 {
+       struct usb_interface *uinterf = comedi_to_usb_interface(dev);
        int ret;
        struct usbduxfastsub_s *udfs;
 
@@ -1455,11 +1456,11 @@ static int usbduxfast_attach_usb(struct comedi_device *dev,
        udfs = usb_get_intfdata(uinterf);
        if (!udfs || !udfs->probed) {
                dev_err(dev->class_dev,
-                       "usbduxfast: error: attach_usb failed, not connected\n");
+                       "usbduxfast: error: auto_attach failed, not connected\n");
                ret = -ENODEV;
        } else if (udfs->attached) {
                dev_err(dev->class_dev,
-                      "usbduxfast: error: attach_usb failed, already attached\n");
+                      "usbduxfast: error: auto_attach failed, already attached\n");
                ret = -ENODEV;
        } else
                ret = usbduxfast_attach_common(dev, udfs);
@@ -1485,7 +1486,7 @@ static void usbduxfast_detach(struct comedi_device *dev)
 static struct comedi_driver usbduxfast_driver = {
        .driver_name    = "usbduxfast",
        .module         = THIS_MODULE,
-       .attach_usb     = usbduxfast_attach_usb,
+       .auto_attach    = usbduxfast_auto_attach,
        .detach         = usbduxfast_detach,
 };
 
index b169412..9720170 100644 (file)
@@ -2359,9 +2359,10 @@ static int usbduxsigma_attach_common(struct comedi_device *dev,
        return 0;
 }
 
-static int usbduxsigma_attach_usb(struct comedi_device *dev,
-                                 struct usb_interface *uinterf)
+static int usbduxsigma_auto_attach(struct comedi_device *dev,
+                                  unsigned long context_unused)
 {
+       struct usb_interface *uinterf = comedi_to_usb_interface(dev);
        int ret;
        struct usbduxsub *uds;
 
@@ -2370,11 +2371,11 @@ static int usbduxsigma_attach_usb(struct comedi_device *dev,
        uds = usb_get_intfdata(uinterf);
        if (!uds || !uds->probed) {
                dev_err(dev->class_dev,
-                       "usbduxsigma: error: attach_usb failed, not connected\n");
+                       "usbduxsigma: error: auto_attach failed, not connected\n");
                ret = -ENODEV;
        } else if (uds->attached) {
                dev_err(dev->class_dev,
-                      "usbduxsigma: error: attach_usb failed, already attached\n");
+                      "usbduxsigma: error: auto_attach failed, already attached\n");
                ret = -ENODEV;
        } else
                ret = usbduxsigma_attach_common(dev, uds);
@@ -2398,7 +2399,7 @@ static void usbduxsigma_detach(struct comedi_device *dev)
 static struct comedi_driver usbduxsigma_driver = {
        .driver_name    = "usbduxsigma",
        .module         = THIS_MODULE,
-       .attach_usb     = usbduxsigma_attach_usb,
+       .auto_attach    = usbduxsigma_auto_attach,
        .detach         = usbduxsigma_detach,
 };