usb-serial: use new registration API in [i-j]* drivers
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 23 Feb 2012 19:56:57 +0000 (14:56 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Feb 2012 20:39:18 +0000 (12:39 -0800)
This patch (as1525) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

io_edgeport, io_ti, ipaq, ipw, ir-usb, and iuu_phoenix.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_tables.h
drivers/usb/serial/io_ti.c
drivers/usb/serial/ipaq.c
drivers/usb/serial/ipw.c
drivers/usb/serial/ir-usb.c
drivers/usb/serial/iuu_phoenix.c

index 616b078..55afa23 100644 (file)
@@ -3189,35 +3189,12 @@ static int __init edgeport_init(void)
 {
        int retval;
 
-       retval = usb_serial_register(&edgeport_2port_device);
-       if (retval)
-               goto failed_2port_device_register;
-       retval = usb_serial_register(&edgeport_4port_device);
-       if (retval)
-               goto failed_4port_device_register;
-       retval = usb_serial_register(&edgeport_8port_device);
-       if (retval)
-               goto failed_8port_device_register;
-       retval = usb_serial_register(&epic_device);
-       if (retval)
-               goto failed_epic_device_register;
-       retval = usb_register(&io_driver);
-       if (retval)
-               goto failed_usb_register;
-       atomic_set(&CmdUrbs, 0);
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-       return 0;
-
-failed_usb_register:
-       usb_serial_deregister(&epic_device);
-failed_epic_device_register:
-       usb_serial_deregister(&edgeport_8port_device);
-failed_8port_device_register:
-       usb_serial_deregister(&edgeport_4port_device);
-failed_4port_device_register:
-       usb_serial_deregister(&edgeport_2port_device);
-failed_2port_device_register:
+       retval = usb_serial_register_drivers(&io_driver, serial_drivers);
+       if (retval == 0) {
+               atomic_set(&CmdUrbs, 0);
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
+       }
        return retval;
 }
 
@@ -3228,11 +3205,7 @@ failed_2port_device_register:
  ****************************************************************************/
 static void __exit edgeport_exit (void)
 {
-       usb_deregister(&io_driver);
-       usb_serial_deregister(&edgeport_2port_device);
-       usb_serial_deregister(&edgeport_4port_device);
-       usb_serial_deregister(&edgeport_8port_device);
-       usb_serial_deregister(&epic_device);
+       usb_serial_deregister_drivers(&io_driver, serial_drivers);
 }
 
 module_init(edgeport_init);
index 178b22e..d0e7c9a 100644 (file)
@@ -100,7 +100,6 @@ static struct usb_driver io_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table_combined,
-       .no_dynamic_id =        1,
 };
 
 static struct usb_serial_driver edgeport_2port_device = {
@@ -109,7 +108,6 @@ static struct usb_serial_driver edgeport_2port_device = {
                .name           = "edgeport_2",
        },
        .description            = "Edgeport 2 port adapter",
-       .usb_driver             = &io_driver,
        .id_table               = edgeport_2port_id_table,
        .num_ports              = 2,
        .open                   = edge_open,
@@ -139,7 +137,6 @@ static struct usb_serial_driver edgeport_4port_device = {
                .name           = "edgeport_4",
        },
        .description            = "Edgeport 4 port adapter",
-       .usb_driver             = &io_driver,
        .id_table               = edgeport_4port_id_table,
        .num_ports              = 4,
        .open                   = edge_open,
@@ -169,7 +166,6 @@ static struct usb_serial_driver edgeport_8port_device = {
                .name           = "edgeport_8",
        },
        .description            = "Edgeport 8 port adapter",
-       .usb_driver             = &io_driver,
        .id_table               = edgeport_8port_id_table,
        .num_ports              = 8,
        .open                   = edge_open,
@@ -199,7 +195,6 @@ static struct usb_serial_driver epic_device = {
                .name           = "epic",
        },
        .description            = "EPiC device",
-       .usb_driver             = &io_driver,
        .id_table               = Epic_port_id_table,
        .num_ports              = 1,
        .open                   = edge_open,
@@ -223,5 +218,10 @@ static struct usb_serial_driver epic_device = {
        .write_bulk_callback    = edge_bulk_out_data_callback,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &edgeport_2port_device, &edgeport_4port_device,
+       &edgeport_8port_device, &epic_device, NULL
+};
+
 #endif
 
index 58a3697..484db33 100644 (file)
@@ -202,7 +202,6 @@ static struct usb_driver io_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table_combined,
-       .no_dynamic_id =        1,
 };
 
 
@@ -2725,7 +2724,6 @@ static struct usb_serial_driver edgeport_1port_device = {
                .name           = "edgeport_ti_1",
        },
        .description            = "Edgeport TI 1 port adapter",
-       .usb_driver             = &io_driver,
        .id_table               = edgeport_1port_id_table,
        .num_ports              = 1,
        .open                   = edge_open,
@@ -2757,7 +2755,6 @@ static struct usb_serial_driver edgeport_2port_device = {
                .name           = "edgeport_ti_2",
        },
        .description            = "Edgeport TI 2 port adapter",
-       .usb_driver             = &io_driver,
        .id_table               = edgeport_2port_id_table,
        .num_ports              = 2,
        .open                   = edge_open,
@@ -2782,35 +2779,25 @@ static struct usb_serial_driver edgeport_2port_device = {
        .write_bulk_callback    = edge_bulk_out_callback,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &edgeport_1port_device, &edgeport_2port_device, NULL
+};
+
 
 static int __init edgeport_init(void)
 {
        int retval;
-       retval = usb_serial_register(&edgeport_1port_device);
-       if (retval)
-               goto failed_1port_device_register;
-       retval = usb_serial_register(&edgeport_2port_device);
-       if (retval)
-               goto failed_2port_device_register;
-       retval = usb_register(&io_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(&edgeport_2port_device);
-failed_2port_device_register:
-       usb_serial_deregister(&edgeport_1port_device);
-failed_1port_device_register:
+
+       retval = usb_serial_register_drivers(&io_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 static void __exit edgeport_exit(void)
 {
-       usb_deregister(&io_driver);
-       usb_serial_deregister(&edgeport_1port_device);
-       usb_serial_deregister(&edgeport_2port_device);
+       usb_serial_deregister_drivers(&io_driver, serial_drivers);
 }
 
 module_init(edgeport_init);
index 06053a9..10c02b8 100644 (file)
@@ -510,7 +510,6 @@ static struct usb_driver ipaq_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     ipaq_id_table,
-       .no_dynamic_id =        1,
 };
 
 
@@ -521,7 +520,6 @@ static struct usb_serial_driver ipaq_device = {
                .name =         "ipaq",
        },
        .description =          "PocketPC PDA",
-       .usb_driver =           &ipaq_driver,
        .id_table =             ipaq_id_table,
        .bulk_in_size =         256,
        .bulk_out_size =        256,
@@ -530,6 +528,10 @@ static struct usb_serial_driver ipaq_device = {
        .calc_num_ports =       ipaq_calc_num_ports,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &ipaq_device, NULL
+};
+
 static int ipaq_open(struct tty_struct *tty,
                        struct usb_serial_port *port)
 {
@@ -624,30 +626,22 @@ static int ipaq_startup(struct usb_serial *serial)
 static int __init ipaq_init(void)
 {
        int retval;
-       retval = usb_serial_register(&ipaq_device);
-       if (retval)
-               goto failed_usb_serial_register;
+
        if (vendor) {
                ipaq_id_table[0].idVendor = vendor;
                ipaq_id_table[0].idProduct = product;
        }
-       retval = usb_register(&ipaq_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(&ipaq_device);
-failed_usb_serial_register:
+
+       retval = usb_serial_register_drivers(&ipaq_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 static void __exit ipaq_exit(void)
 {
-       usb_deregister(&ipaq_driver);
-       usb_serial_deregister(&ipaq_device);
+       usb_serial_deregister_drivers(&ipaq_driver, serial_drivers);
 }
 
 
index 6f9356f..27b8886 100644 (file)
@@ -144,7 +144,6 @@ static struct usb_driver usb_ipw_driver = {
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     usb_ipw_ids,
-       .no_dynamic_id =        1,
 };
 
 static bool debug;
@@ -318,7 +317,6 @@ static struct usb_serial_driver ipw_device = {
                .name =         "ipw",
        },
        .description =          "IPWireless converter",
-       .usb_driver =           &usb_ipw_driver,
        .id_table =             usb_ipw_ids,
        .num_ports =            1,
        .disconnect =           usb_wwan_disconnect,
@@ -331,29 +329,25 @@ static struct usb_serial_driver ipw_device = {
        .write =                usb_wwan_write,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &ipw_device, NULL
+};
 
 
 static int __init usb_ipw_init(void)
 {
        int retval;
 
-       retval = usb_serial_register(&ipw_device);
-       if (retval)
-               return retval;
-       retval = usb_register(&usb_ipw_driver);
-       if (retval) {
-               usb_serial_deregister(&ipw_device);
-               return retval;
-       }
-       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
-              DRIVER_DESC "\n");
-       return 0;
+       retval = usb_serial_register_drivers(&usb_ipw_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
+       return retval;
 }
 
 static void __exit usb_ipw_exit(void)
 {
-       usb_deregister(&usb_ipw_driver);
-       usb_serial_deregister(&ipw_device);
+       usb_serial_deregister_drivers(&usb_ipw_driver, serial_drivers);
 }
 
 module_init(usb_ipw_init);
index 84a396e..84965cd 100644 (file)
@@ -82,7 +82,6 @@ static struct usb_driver ir_driver = {
        .probe          = usb_serial_probe,
        .disconnect     = usb_serial_disconnect,
        .id_table       = ir_id_table,
-       .no_dynamic_id  = 1,
 };
 
 static struct usb_serial_driver ir_device = {
@@ -91,7 +90,6 @@ static struct usb_serial_driver ir_device = {
                .name   = "ir-usb",
        },
        .description            = "IR Dongle",
-       .usb_driver             = &ir_driver,
        .id_table               = ir_id_table,
        .num_ports              = 1,
        .set_termios            = ir_set_termios,
@@ -101,6 +99,10 @@ static struct usb_serial_driver ir_device = {
        .process_read_urb       = ir_process_read_urb,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &ir_device, NULL
+};
+
 static inline void irda_usb_dump_class_desc(struct usb_irda_cs_descriptor *desc)
 {
        dbg("bLength=%x", desc->bLength);
@@ -445,30 +447,16 @@ static int __init ir_init(void)
                ir_device.bulk_out_size = buffer_size;
        }
 
-       retval = usb_serial_register(&ir_device);
-       if (retval)
-               goto failed_usb_serial_register;
-
-       retval = usb_register(&ir_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(&ir_device);
-
-failed_usb_serial_register:
+       retval = usb_serial_register_drivers(&ir_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 static void __exit ir_exit(void)
 {
-       usb_deregister(&ir_driver);
-       usb_serial_deregister(&ir_device);
+       usb_serial_deregister_drivers(&ir_driver, serial_drivers);
 }
 
 
index 3077a44..97a7ea2 100644 (file)
@@ -56,7 +56,6 @@ static struct usb_driver iuu_driver = {
        .probe = usb_serial_probe,
        .disconnect = usb_serial_disconnect,
        .id_table = id_table,
-       .no_dynamic_id = 1,
 };
 
 /* turbo parameter */
@@ -1274,7 +1273,6 @@ static struct usb_serial_driver iuu_device = {
                   .name = "iuu_phoenix",
                   },
        .id_table = id_table,
-       .usb_driver = &iuu_driver,
        .num_ports = 1,
        .bulk_in_size = 512,
        .bulk_out_size = 512,
@@ -1292,28 +1290,24 @@ static struct usb_serial_driver iuu_device = {
        .release = iuu_release,
 };
 
+static struct usb_serial_driver * const serial_drivers[] = {
+       &iuu_device, NULL
+};
+
 static int __init iuu_init(void)
 {
        int retval;
-       retval = usb_serial_register(&iuu_device);
-       if (retval)
-               goto failed_usb_serial_register;
-       retval = usb_register(&iuu_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(&iuu_device);
-failed_usb_serial_register:
+
+       retval = usb_serial_register_drivers(&iuu_driver, serial_drivers);
+       if (retval == 0)
+               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+                              DRIVER_DESC "\n");
        return retval;
 }
 
 static void __exit iuu_exit(void)
 {
-       usb_deregister(&iuu_driver);
-       usb_serial_deregister(&iuu_device);
+       usb_serial_deregister_drivers(&iuu_driver, serial_drivers);
 }
 
 module_init(iuu_init);