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 <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alan Stern
2012-02-23 14:56:17 -05:00
committed by Greg Kroah-Hartman
parent 765e0ba626
commit 08a4f6bc2e
7 changed files with 60 additions and 125 deletions

View File

@@ -94,7 +94,6 @@ static struct usb_driver cypress_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
enum packet_format {
@@ -163,7 +162,6 @@ static struct usb_serial_driver cypress_earthmate_device = {
.name = "earthmate",
},
.description = "DeLorme Earthmate USB",
.usb_driver = &cypress_driver,
.id_table = id_table_earthmate,
.num_ports = 1,
.attach = cypress_earthmate_startup,
@@ -190,7 +188,6 @@ static struct usb_serial_driver cypress_hidcom_device = {
.name = "cyphidcom",
},
.description = "HID->COM RS232 Adapter",
.usb_driver = &cypress_driver,
.id_table = id_table_cyphidcomrs232,
.num_ports = 1,
.attach = cypress_hidcom_startup,
@@ -217,7 +214,6 @@ static struct usb_serial_driver cypress_ca42v2_device = {
.name = "nokiaca42v2",
},
.description = "Nokia CA-42 V2 Adapter",
.usb_driver = &cypress_driver,
.id_table = id_table_nokiaca42v2,
.num_ports = 1,
.attach = cypress_ca42v2_startup,
@@ -238,6 +234,11 @@ static struct usb_serial_driver cypress_ca42v2_device = {
.write_int_callback = cypress_write_int_callback,
};
static struct usb_serial_driver * const serial_drivers[] = {
&cypress_earthmate_device, &cypress_hidcom_device,
&cypress_ca42v2_device, NULL
};
/*****************************************************************************
* Cypress serial helper functions
*****************************************************************************/
@@ -1356,30 +1357,10 @@ static int __init cypress_init(void)
dbg("%s", __func__);
retval = usb_serial_register(&cypress_earthmate_device);
if (retval)
goto failed_em_register;
retval = usb_serial_register(&cypress_hidcom_device);
if (retval)
goto failed_hidcom_register;
retval = usb_serial_register(&cypress_ca42v2_device);
if (retval)
goto failed_ca42v2_register;
retval = usb_register(&cypress_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(&cypress_ca42v2_device);
failed_ca42v2_register:
usb_serial_deregister(&cypress_hidcom_device);
failed_hidcom_register:
usb_serial_deregister(&cypress_earthmate_device);
failed_em_register:
retval = usb_serial_register_drivers(&cypress_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
@@ -1388,10 +1369,7 @@ static void __exit cypress_exit(void)
{
dbg("%s", __func__);
usb_deregister(&cypress_driver);
usb_serial_deregister(&cypress_earthmate_device);
usb_serial_deregister(&cypress_hidcom_device);
usb_serial_deregister(&cypress_ca42v2_device);
usb_serial_deregister_drivers(&cypress_driver, serial_drivers);
}