]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb-serial: use new registration API in [d-h]* drivers
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 23 Feb 2012 19:56:32 +0000 (14:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Feb 2012 20:39:18 +0000 (12:39 -0800)
This patch (as1524) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

digi_acceleport, empeg, ftdi_sio, funsoft, garmin_gps,
and hp4x.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/empeg.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/funsoft.c
drivers/usb/serial/garmin_gps.c
drivers/usb/serial/hp4x.c

index 2b1da0cc071a042f0754c57449724ce3ede75019..f0e776bb1ffbc89cf1768d0ace5fb2862cf13e1a 100644 (file)
@@ -276,7 +276,6 @@ static struct usb_driver digi_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table_combined,
-       .no_dynamic_id =        1,
 };
 
 
@@ -288,7 +287,6 @@ static struct usb_serial_driver digi_acceleport_2_device = {
                .name =                 "digi_2",
        },
        .description =                  "Digi 2 port USB adapter",
-       .usb_driver =                   &digi_driver,
        .id_table =                     id_table_2,
        .num_ports =                    3,
        .open =                         digi_open,
@@ -316,7 +314,6 @@ static struct usb_serial_driver digi_acceleport_4_device = {
                .name =                 "digi_4",
        },
        .description =                  "Digi 4 port USB adapter",
-       .usb_driver =                   &digi_driver,
        .id_table =                     id_table_4,
        .num_ports =                    4,
        .open =                         digi_open,
@@ -337,6 +334,9 @@ static struct usb_serial_driver digi_acceleport_4_device = {
        .release =                      digi_release,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &digi_acceleport_2_device, &digi_acceleport_4_device, NULL
+};
 
 /* Functions */
 
@@ -1583,31 +1583,17 @@ static int digi_read_oob_callback(struct urb *urb)
 static int __init digi_init(void)
 {
        int retval;
-       retval = usb_serial_register(&digi_acceleport_2_device);
-       if (retval)
-               goto failed_acceleport_2_device;
-       retval = usb_serial_register(&digi_acceleport_4_device);
-       if (retval)
-               goto failed_acceleport_4_device;
-       retval = usb_register(&digi_driver);
-       if (retval)
-               goto failed_usb_register;
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-       return 0;
-failed_usb_register:
-       usb_serial_deregister(&digi_acceleport_4_device);
-failed_acceleport_4_device:
-       usb_serial_deregister(&digi_acceleport_2_device);
-failed_acceleport_2_device:
+
+       retval = usb_serial_register_drivers(&digi_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 static void __exit digi_exit (void)
 {
-       usb_deregister(&digi_driver);
-       usb_serial_deregister(&digi_acceleport_2_device);
-       usb_serial_deregister(&digi_acceleport_4_device);
+       usb_serial_deregister_drivers(&digi_driver, serial_drivers);
 }
 
 
index aced6817bf95dc42d0a6c9be7b50db2552a75be0..51bcbd5d5e8ee5ddcadcb9e465ec622fd41895a1 100644 (file)
@@ -56,7 +56,6 @@ static struct usb_driver empeg_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
-       .no_dynamic_id =        1,
 };
 
 static struct usb_serial_driver empeg_device = {
@@ -65,7 +64,6 @@ static struct usb_serial_driver empeg_device = {
                .name =         "empeg",
        },
        .id_table =             id_table,
-       .usb_driver =           &empeg_driver,
        .num_ports =            1,
        .bulk_out_size =        256,
        .throttle =             usb_serial_generic_throttle,
@@ -74,6 +72,10 @@ static struct usb_serial_driver empeg_device = {
        .init_termios =         empeg_init_termios,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &empeg_device, NULL
+};
+
 static int empeg_startup(struct usb_serial *serial)
 {
        int r;
@@ -140,24 +142,16 @@ static int __init empeg_init(void)
 {
        int retval;
 
-       retval = usb_serial_register(&empeg_device);
-       if (retval)
-               return retval;
-       retval = usb_register(&empeg_driver);
-       if (retval) {
-               usb_serial_deregister(&empeg_device);
-               return retval;
-       }
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-
-       return 0;
+       retval = usb_serial_register_drivers(&empeg_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
+       return retval;
 }
 
 static void __exit empeg_exit(void)
 {
-       usb_deregister(&empeg_driver);
-       usb_serial_deregister(&empeg_device);
+       usb_serial_deregister_drivers(&empeg_driver, serial_drivers);
 }
 
 
index f770415305f8578556c14b2e1ebbcf8facd947ea..615cf2c4915c7bc736766b755f07968658973728 100644 (file)
@@ -857,7 +857,6 @@ static struct usb_driver ftdi_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table_combined,
-       .no_dynamic_id =        1,
 };
 
 static const char *ftdi_chip_name[] = {
@@ -915,7 +914,6 @@ static struct usb_serial_driver ftdi_sio_device = {
                .name =         "ftdi_sio",
        },
        .description =          "FTDI USB Serial Device",
-       .usb_driver =           &ftdi_driver,
        .id_table =             id_table_combined,
        .num_ports =            1,
        .bulk_in_size =         512,
@@ -938,6 +936,10 @@ static struct usb_serial_driver ftdi_sio_device = {
        .break_ctl =            ftdi_break_ctl,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &ftdi_sio_device, NULL
+};
+
 
 #define WDR_TIMEOUT 5000 /* default urb timeout */
 #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */
@@ -2420,19 +2422,10 @@ static int __init ftdi_init(void)
                id_table_combined[i].idVendor = vendor;
                id_table_combined[i].idProduct = product;
        }
-       retval = usb_serial_register(&ftdi_sio_device);
-       if (retval)
-               goto failed_sio_register;
-       retval = usb_register(&ftdi_driver);
-       if (retval)
-               goto failed_usb_register;
-
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-       return 0;
-failed_usb_register:
-       usb_serial_deregister(&ftdi_sio_device);
-failed_sio_register:
+       retval = usb_serial_register_drivers(&ftdi_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
@@ -2440,8 +2433,7 @@ static void __exit ftdi_exit(void)
 {
        dbg("%s", __func__);
 
-       usb_deregister(&ftdi_driver);
-       usb_serial_deregister(&ftdi_sio_device);
+       usb_serial_deregister_drivers(&ftdi_driver, serial_drivers);
 }
 
 
index 5d4b099dcf8b5da5998e6aebaf67ccbff077db50..bb274a244ae9b33c141ee4eb614cb9dac7ad766e 100644 (file)
@@ -29,7 +29,6 @@ static struct usb_driver funsoft_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
-       .no_dynamic_id =        1,
 };
 
 static struct usb_serial_driver funsoft_device = {
@@ -38,27 +37,21 @@ static struct usb_serial_driver funsoft_device = {
                .name =         "funsoft",
        },
        .id_table =             id_table,
-       .usb_driver =           &funsoft_driver,
        .num_ports =            1,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &funsoft_device, NULL
+};
+
 static int __init funsoft_init(void)
 {
-       int retval;
-
-       retval = usb_serial_register(&funsoft_device);
-       if (retval)
-               return retval;
-       retval = usb_register(&funsoft_driver);
-       if (retval)
-               usb_serial_deregister(&funsoft_device);
-       return retval;
+       return usb_serial_register_drivers(&funsoft_driver, serial_drivers);
 }
 
 static void __exit funsoft_exit(void)
 {
-       usb_deregister(&funsoft_driver);
-       usb_serial_deregister(&funsoft_device);
+       usb_serial_deregister_drivers(&funsoft_driver, serial_drivers);
 }
 
 module_init(funsoft_init);
index 21343378c322e1ab3fd044a8f5ccdbefab43bede..69da3abcb3637542a1c1424e665006b2caa6817b 100644 (file)
@@ -224,7 +224,6 @@ static struct usb_driver garmin_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
-       .no_dynamic_id = 1,
 };
 
 
@@ -1497,7 +1496,6 @@ static struct usb_serial_driver garmin_device = {
                .name        = "garmin_gps",
        },
        .description         = "Garmin GPS usb/tty",
-       .usb_driver          = &garmin_driver,
        .id_table            = id_table,
        .num_ports           = 1,
        .open                = garmin_open,
@@ -1514,33 +1512,26 @@ static struct usb_serial_driver garmin_device = {
        .read_int_callback   = garmin_read_int_callback,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &garmin_device, NULL
+};
 
 
 static int __init garmin_init(void)
 {
        int retval;
 
-       retval = usb_serial_register(&garmin_device);
-       if (retval)
-               goto failed_garmin_register;
-       retval = usb_register(&garmin_driver);
-       if (retval)
-               goto failed_usb_register;
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-
-       return 0;
-failed_usb_register:
-       usb_serial_deregister(&garmin_device);
-failed_garmin_register:
+       retval = usb_serial_register_drivers(&garmin_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 
 static void __exit garmin_exit(void)
 {
-       usb_deregister(&garmin_driver);
-       usb_serial_deregister(&garmin_device);
+       usb_serial_deregister_drivers(&garmin_driver, serial_drivers);
 }
 
 
index 809379159b0e67e21a16db13bb0f556b4e7be19a..325cf092b61c2d1b6737e01d32943597311e2370 100644 (file)
@@ -41,7 +41,6 @@ static struct usb_driver hp49gp_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table,
-       .no_dynamic_id =        1,
 };
 
 static struct usb_serial_driver hp49gp_device = {
@@ -50,32 +49,27 @@ static struct usb_serial_driver hp49gp_device = {
                .name =         "hp4X",
        },
        .id_table =             id_table,
-       .usb_driver =           &hp49gp_driver,
        .num_ports =            1,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &hp49gp_device, NULL
+};
+
 static int __init hp49gp_init(void)
 {
        int retval;
-       retval = usb_serial_register(&hp49gp_device);
-       if (retval)
-               goto failed_usb_serial_register;
-       retval = usb_register(&hp49gp_driver);
-       if (retval)
-               goto failed_usb_register;
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-       return 0;
-failed_usb_register:
-       usb_serial_deregister(&hp49gp_device);
-failed_usb_serial_register:
+
+       retval = usb_serial_register_drivers(&hp49gp_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 static void __exit hp49gp_exit(void)
 {
-       usb_deregister(&hp49gp_driver);
-       usb_serial_deregister(&hp49gp_device);
+       usb_serial_deregister_drivers(&hp49gp_driver, serial_drivers);
 }
 
 module_init(hp49gp_init);