From 08a4f6bc2e7046ce50849d7589b7d0763926d808 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 23 Feb 2012 14:56:17 -0500 Subject: usb-serial: use new registration API in [a-c]* drivers This patch (as1523) modifies the following usb-serial drivers to utilize the new usb_serial_{de}register_drivers() routines: aircable, ark3116, belkin_sa, ch341, cp210x, cyberjack, and cypress_m8. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ch341.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'drivers/usb/serial/ch341.c') diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 5e53cc59e652..23de3b039a28 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -625,7 +625,6 @@ static struct usb_driver ch341_driver = { .resume = usb_serial_resume, .reset_resume = ch341_reset_resume, .id_table = id_table, - .no_dynamic_id = 1, .supports_autosuspend = 1, }; @@ -635,7 +634,6 @@ static struct usb_serial_driver ch341_device = { .name = "ch341-uart", }, .id_table = id_table, - .usb_driver = &ch341_driver, .num_ports = 1, .open = ch341_open, .dtr_rts = ch341_dtr_rts, @@ -650,23 +648,18 @@ static struct usb_serial_driver ch341_device = { .attach = ch341_attach, }; +static struct usb_serial_driver * const serial_drivers[] = { + &ch341_device, NULL +}; + static int __init ch341_init(void) { - int retval; - - retval = usb_serial_register(&ch341_device); - if (retval) - return retval; - retval = usb_register(&ch341_driver); - if (retval) - usb_serial_deregister(&ch341_device); - return retval; + return usb_serial_register_drivers(&ch341_driver, serial_drivers); } static void __exit ch341_exit(void) { - usb_deregister(&ch341_driver); - usb_serial_deregister(&ch341_device); + usb_serial_deregister_drivers(&ch341_driver, serial_drivers); } module_init(ch341_init); -- cgit v1.2.3 From a5f5e6c2d80d073e09918e7a02f3355503ff3922 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 28 Feb 2012 13:11:37 -0800 Subject: USB: serial: ch341.c: use module_usb_serial_driver This converts the ch341.c driver to use the module_usb_serial_driver() call instead of having to have a module_init/module_exit function, saving a lot of duplicated code. CC: Johan Hovold CC: Rusty Russell CC: Alan Stern CC: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ch341.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'drivers/usb/serial/ch341.c') diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 23de3b039a28..aaab32db31d0 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -652,21 +652,9 @@ static struct usb_serial_driver * const serial_drivers[] = { &ch341_device, NULL }; -static int __init ch341_init(void) -{ - return usb_serial_register_drivers(&ch341_driver, serial_drivers); -} - -static void __exit ch341_exit(void) -{ - usb_serial_deregister_drivers(&ch341_driver, serial_drivers); -} +module_usb_serial_driver(ch341_driver, serial_drivers); -module_init(ch341_init); -module_exit(ch341_exit); MODULE_LICENSE("GPL"); module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); - -/* EOF ch341.c */ -- cgit v1.2.3