Commit 7dbe2460 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

usb-serial: use new registration API in [i-j]* drivers

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 97b6b6d2
...@@ -3189,35 +3189,12 @@ static int __init edgeport_init(void) ...@@ -3189,35 +3189,12 @@ static int __init edgeport_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&edgeport_2port_device); retval = usb_serial_register_drivers(&io_driver, serial_drivers);
if (retval) if (retval == 0) {
goto failed_2port_device_register; atomic_set(&CmdUrbs, 0);
retval = usb_serial_register(&edgeport_4port_device); printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
if (retval) DRIVER_DESC "\n");
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:
return retval; return retval;
} }
...@@ -3228,11 +3205,7 @@ static int __init edgeport_init(void) ...@@ -3228,11 +3205,7 @@ static int __init edgeport_init(void)
****************************************************************************/ ****************************************************************************/
static void __exit edgeport_exit (void) static void __exit edgeport_exit (void)
{ {
usb_deregister(&io_driver); usb_serial_deregister_drivers(&io_driver, serial_drivers);
usb_serial_deregister(&edgeport_2port_device);
usb_serial_deregister(&edgeport_4port_device);
usb_serial_deregister(&edgeport_8port_device);
usb_serial_deregister(&epic_device);
} }
module_init(edgeport_init); module_init(edgeport_init);
......
...@@ -100,7 +100,6 @@ static struct usb_driver io_driver = { ...@@ -100,7 +100,6 @@ static struct usb_driver io_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = id_table_combined, .id_table = id_table_combined,
.no_dynamic_id = 1,
}; };
static struct usb_serial_driver edgeport_2port_device = { static struct usb_serial_driver edgeport_2port_device = {
...@@ -109,7 +108,6 @@ static struct usb_serial_driver edgeport_2port_device = { ...@@ -109,7 +108,6 @@ static struct usb_serial_driver edgeport_2port_device = {
.name = "edgeport_2", .name = "edgeport_2",
}, },
.description = "Edgeport 2 port adapter", .description = "Edgeport 2 port adapter",
.usb_driver = &io_driver,
.id_table = edgeport_2port_id_table, .id_table = edgeport_2port_id_table,
.num_ports = 2, .num_ports = 2,
.open = edge_open, .open = edge_open,
...@@ -139,7 +137,6 @@ static struct usb_serial_driver edgeport_4port_device = { ...@@ -139,7 +137,6 @@ static struct usb_serial_driver edgeport_4port_device = {
.name = "edgeport_4", .name = "edgeport_4",
}, },
.description = "Edgeport 4 port adapter", .description = "Edgeport 4 port adapter",
.usb_driver = &io_driver,
.id_table = edgeport_4port_id_table, .id_table = edgeport_4port_id_table,
.num_ports = 4, .num_ports = 4,
.open = edge_open, .open = edge_open,
...@@ -169,7 +166,6 @@ static struct usb_serial_driver edgeport_8port_device = { ...@@ -169,7 +166,6 @@ static struct usb_serial_driver edgeport_8port_device = {
.name = "edgeport_8", .name = "edgeport_8",
}, },
.description = "Edgeport 8 port adapter", .description = "Edgeport 8 port adapter",
.usb_driver = &io_driver,
.id_table = edgeport_8port_id_table, .id_table = edgeport_8port_id_table,
.num_ports = 8, .num_ports = 8,
.open = edge_open, .open = edge_open,
...@@ -199,7 +195,6 @@ static struct usb_serial_driver epic_device = { ...@@ -199,7 +195,6 @@ static struct usb_serial_driver epic_device = {
.name = "epic", .name = "epic",
}, },
.description = "EPiC device", .description = "EPiC device",
.usb_driver = &io_driver,
.id_table = Epic_port_id_table, .id_table = Epic_port_id_table,
.num_ports = 1, .num_ports = 1,
.open = edge_open, .open = edge_open,
...@@ -223,5 +218,10 @@ static struct usb_serial_driver epic_device = { ...@@ -223,5 +218,10 @@ static struct usb_serial_driver epic_device = {
.write_bulk_callback = edge_bulk_out_data_callback, .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 #endif
...@@ -202,7 +202,6 @@ static struct usb_driver io_driver = { ...@@ -202,7 +202,6 @@ static struct usb_driver io_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = id_table_combined, .id_table = id_table_combined,
.no_dynamic_id = 1,
}; };
...@@ -2725,7 +2724,6 @@ static struct usb_serial_driver edgeport_1port_device = { ...@@ -2725,7 +2724,6 @@ static struct usb_serial_driver edgeport_1port_device = {
.name = "edgeport_ti_1", .name = "edgeport_ti_1",
}, },
.description = "Edgeport TI 1 port adapter", .description = "Edgeport TI 1 port adapter",
.usb_driver = &io_driver,
.id_table = edgeport_1port_id_table, .id_table = edgeport_1port_id_table,
.num_ports = 1, .num_ports = 1,
.open = edge_open, .open = edge_open,
...@@ -2757,7 +2755,6 @@ static struct usb_serial_driver edgeport_2port_device = { ...@@ -2757,7 +2755,6 @@ static struct usb_serial_driver edgeport_2port_device = {
.name = "edgeport_ti_2", .name = "edgeport_ti_2",
}, },
.description = "Edgeport TI 2 port adapter", .description = "Edgeport TI 2 port adapter",
.usb_driver = &io_driver,
.id_table = edgeport_2port_id_table, .id_table = edgeport_2port_id_table,
.num_ports = 2, .num_ports = 2,
.open = edge_open, .open = edge_open,
...@@ -2782,35 +2779,25 @@ static struct usb_serial_driver edgeport_2port_device = { ...@@ -2782,35 +2779,25 @@ static struct usb_serial_driver edgeport_2port_device = {
.write_bulk_callback = edge_bulk_out_callback, .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) static int __init edgeport_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&edgeport_1port_device);
if (retval) retval = usb_serial_register_drivers(&io_driver, serial_drivers);
goto failed_1port_device_register; if (retval == 0)
retval = usb_serial_register(&edgeport_2port_device); printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
if (retval) DRIVER_DESC "\n");
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:
return retval; return retval;
} }
static void __exit edgeport_exit(void) static void __exit edgeport_exit(void)
{ {
usb_deregister(&io_driver); usb_serial_deregister_drivers(&io_driver, serial_drivers);
usb_serial_deregister(&edgeport_1port_device);
usb_serial_deregister(&edgeport_2port_device);
} }
module_init(edgeport_init); module_init(edgeport_init);
......
...@@ -510,7 +510,6 @@ static struct usb_driver ipaq_driver = { ...@@ -510,7 +510,6 @@ static struct usb_driver ipaq_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = ipaq_id_table, .id_table = ipaq_id_table,
.no_dynamic_id = 1,
}; };
...@@ -521,7 +520,6 @@ static struct usb_serial_driver ipaq_device = { ...@@ -521,7 +520,6 @@ static struct usb_serial_driver ipaq_device = {
.name = "ipaq", .name = "ipaq",
}, },
.description = "PocketPC PDA", .description = "PocketPC PDA",
.usb_driver = &ipaq_driver,
.id_table = ipaq_id_table, .id_table = ipaq_id_table,
.bulk_in_size = 256, .bulk_in_size = 256,
.bulk_out_size = 256, .bulk_out_size = 256,
...@@ -530,6 +528,10 @@ static struct usb_serial_driver ipaq_device = { ...@@ -530,6 +528,10 @@ static struct usb_serial_driver ipaq_device = {
.calc_num_ports = ipaq_calc_num_ports, .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, static int ipaq_open(struct tty_struct *tty,
struct usb_serial_port *port) struct usb_serial_port *port)
{ {
...@@ -624,30 +626,22 @@ static int ipaq_startup(struct usb_serial *serial) ...@@ -624,30 +626,22 @@ static int ipaq_startup(struct usb_serial *serial)
static int __init ipaq_init(void) static int __init ipaq_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&ipaq_device);
if (retval)
goto failed_usb_serial_register;
if (vendor) { if (vendor) {
ipaq_id_table[0].idVendor = vendor; ipaq_id_table[0].idVendor = vendor;
ipaq_id_table[0].idProduct = product; ipaq_id_table[0].idProduct = product;
} }
retval = usb_register(&ipaq_driver);
if (retval) retval = usb_serial_register_drivers(&ipaq_driver, serial_drivers);
goto failed_usb_register; if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" DRIVER_DESC "\n");
DRIVER_DESC "\n");
return 0;
failed_usb_register:
usb_serial_deregister(&ipaq_device);
failed_usb_serial_register:
return retval; return retval;
} }
static void __exit ipaq_exit(void) static void __exit ipaq_exit(void)
{ {
usb_deregister(&ipaq_driver); usb_serial_deregister_drivers(&ipaq_driver, serial_drivers);
usb_serial_deregister(&ipaq_device);
} }
......
...@@ -144,7 +144,6 @@ static struct usb_driver usb_ipw_driver = { ...@@ -144,7 +144,6 @@ static struct usb_driver usb_ipw_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = usb_ipw_ids, .id_table = usb_ipw_ids,
.no_dynamic_id = 1,
}; };
static bool debug; static bool debug;
...@@ -318,7 +317,6 @@ static struct usb_serial_driver ipw_device = { ...@@ -318,7 +317,6 @@ static struct usb_serial_driver ipw_device = {
.name = "ipw", .name = "ipw",
}, },
.description = "IPWireless converter", .description = "IPWireless converter",
.usb_driver = &usb_ipw_driver,
.id_table = usb_ipw_ids, .id_table = usb_ipw_ids,
.num_ports = 1, .num_ports = 1,
.disconnect = usb_wwan_disconnect, .disconnect = usb_wwan_disconnect,
...@@ -331,29 +329,25 @@ static struct usb_serial_driver ipw_device = { ...@@ -331,29 +329,25 @@ static struct usb_serial_driver ipw_device = {
.write = usb_wwan_write, .write = usb_wwan_write,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&ipw_device, NULL
};
static int __init usb_ipw_init(void) static int __init usb_ipw_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&ipw_device); retval = usb_serial_register_drivers(&usb_ipw_driver, serial_drivers);
if (retval) if (retval == 0)
return retval; printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
retval = usb_register(&usb_ipw_driver); DRIVER_DESC "\n");
if (retval) { return retval;
usb_serial_deregister(&ipw_device);
return retval;
}
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return 0;
} }
static void __exit usb_ipw_exit(void) static void __exit usb_ipw_exit(void)
{ {
usb_deregister(&usb_ipw_driver); usb_serial_deregister_drivers(&usb_ipw_driver, serial_drivers);
usb_serial_deregister(&ipw_device);
} }
module_init(usb_ipw_init); module_init(usb_ipw_init);
......
...@@ -82,7 +82,6 @@ static struct usb_driver ir_driver = { ...@@ -82,7 +82,6 @@ static struct usb_driver ir_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = ir_id_table, .id_table = ir_id_table,
.no_dynamic_id = 1,
}; };
static struct usb_serial_driver ir_device = { static struct usb_serial_driver ir_device = {
...@@ -91,7 +90,6 @@ static struct usb_serial_driver ir_device = { ...@@ -91,7 +90,6 @@ static struct usb_serial_driver ir_device = {
.name = "ir-usb", .name = "ir-usb",
}, },
.description = "IR Dongle", .description = "IR Dongle",
.usb_driver = &ir_driver,
.id_table = ir_id_table, .id_table = ir_id_table,
.num_ports = 1, .num_ports = 1,
.set_termios = ir_set_termios, .set_termios = ir_set_termios,
...@@ -101,6 +99,10 @@ static struct usb_serial_driver ir_device = { ...@@ -101,6 +99,10 @@ static struct usb_serial_driver ir_device = {
.process_read_urb = ir_process_read_urb, .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) static inline void irda_usb_dump_class_desc(struct usb_irda_cs_descriptor *desc)
{ {
dbg("bLength=%x", desc->bLength); dbg("bLength=%x", desc->bLength);
...@@ -445,30 +447,16 @@ static int __init ir_init(void) ...@@ -445,30 +447,16 @@ static int __init ir_init(void)
ir_device.bulk_out_size = buffer_size; ir_device.bulk_out_size = buffer_size;
} }
retval = usb_serial_register(&ir_device); retval = usb_serial_register_drivers(&ir_driver, serial_drivers);
if (retval) if (retval == 0)
goto failed_usb_serial_register; printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
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:
return retval; return retval;
} }
static void __exit ir_exit(void) static void __exit ir_exit(void)
{ {
usb_deregister(&ir_driver); usb_serial_deregister_drivers(&ir_driver, serial_drivers);
usb_serial_deregister(&ir_device);
} }
......
...@@ -56,7 +56,6 @@ static struct usb_driver iuu_driver = { ...@@ -56,7 +56,6 @@ static struct usb_driver iuu_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1,
}; };
/* turbo parameter */ /* turbo parameter */
...@@ -1274,7 +1273,6 @@ static struct usb_serial_driver iuu_device = { ...@@ -1274,7 +1273,6 @@ static struct usb_serial_driver iuu_device = {
.name = "iuu_phoenix", .name = "iuu_phoenix",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &iuu_driver,
.num_ports = 1, .num_ports = 1,
.bulk_in_size = 512, .bulk_in_size = 512,
.bulk_out_size = 512, .bulk_out_size = 512,
...@@ -1292,28 +1290,24 @@ static struct usb_serial_driver iuu_device = { ...@@ -1292,28 +1290,24 @@ static struct usb_serial_driver iuu_device = {
.release = iuu_release, .release = iuu_release,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&iuu_device, NULL
};
static int __init iuu_init(void) static int __init iuu_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&iuu_device);
if (retval) retval = usb_serial_register_drivers(&iuu_driver, serial_drivers);
goto failed_usb_serial_register; if (retval == 0)
retval = usb_register(&iuu_driver); printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
if (retval) DRIVER_DESC "\n");
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:
return retval; return retval;
} }
static void __exit iuu_exit(void) static void __exit iuu_exit(void)
{ {
usb_deregister(&iuu_driver); usb_serial_deregister_drivers(&iuu_driver, serial_drivers);
usb_serial_deregister(&iuu_device);
} }
module_init(iuu_init); module_init(iuu_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment