Commit 08a4f6bc authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 765e0ba6
...@@ -175,7 +175,6 @@ static struct usb_driver aircable_driver = { ...@@ -175,7 +175,6 @@ static struct usb_driver aircable_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,
}; };
static struct usb_serial_driver aircable_device = { static struct usb_serial_driver aircable_device = {
...@@ -183,7 +182,6 @@ static struct usb_serial_driver aircable_device = { ...@@ -183,7 +182,6 @@ static struct usb_serial_driver aircable_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "aircable", .name = "aircable",
}, },
.usb_driver = &aircable_driver,
.id_table = id_table, .id_table = id_table,
.num_ports = 1, .num_ports = 1,
.bulk_out_size = HCI_COMPLETE_FRAME, .bulk_out_size = HCI_COMPLETE_FRAME,
...@@ -194,27 +192,18 @@ static struct usb_serial_driver aircable_device = { ...@@ -194,27 +192,18 @@ static struct usb_serial_driver aircable_device = {
.unthrottle = usb_serial_generic_unthrottle, .unthrottle = usb_serial_generic_unthrottle,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&aircable_device, NULL
};
static int __init aircable_init(void) static int __init aircable_init(void)
{ {
int retval; return usb_serial_register_drivers(&aircable_driver, serial_drivers);
retval = usb_serial_register(&aircable_device);
if (retval)
goto failed_serial_register;
retval = usb_register(&aircable_driver);
if (retval)
goto failed_usb_register;
return 0;
failed_usb_register:
usb_serial_deregister(&aircable_device);
failed_serial_register:
return retval;
} }
static void __exit aircable_exit(void) static void __exit aircable_exit(void)
{ {
usb_deregister(&aircable_driver); usb_serial_deregister_drivers(&aircable_driver, serial_drivers);
usb_serial_deregister(&aircable_device);
} }
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
......
...@@ -719,7 +719,6 @@ static struct usb_driver ark3116_driver = { ...@@ -719,7 +719,6 @@ static struct usb_driver ark3116_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,
}; };
static struct usb_serial_driver ark3116_device = { static struct usb_serial_driver ark3116_device = {
...@@ -728,7 +727,6 @@ static struct usb_serial_driver ark3116_device = { ...@@ -728,7 +727,6 @@ static struct usb_serial_driver ark3116_device = {
.name = "ark3116", .name = "ark3116",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &ark3116_driver,
.num_ports = 1, .num_ports = 1,
.attach = ark3116_attach, .attach = ark3116_attach,
.release = ark3116_release, .release = ark3116_release,
...@@ -745,28 +743,27 @@ static struct usb_serial_driver ark3116_device = { ...@@ -745,28 +743,27 @@ static struct usb_serial_driver ark3116_device = {
.process_read_urb = ark3116_process_read_urb, .process_read_urb = ark3116_process_read_urb,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&ark3116_device, NULL
};
static int __init ark3116_init(void) static int __init ark3116_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&ark3116_device); retval = usb_serial_register_drivers(&ark3116_driver, serial_drivers);
if (retval)
return retval;
retval = usb_register(&ark3116_driver);
if (retval == 0) { if (retval == 0) {
printk(KERN_INFO "%s:" printk(KERN_INFO "%s:"
DRIVER_VERSION ":" DRIVER_VERSION ":"
DRIVER_DESC "\n", DRIVER_DESC "\n",
KBUILD_MODNAME); KBUILD_MODNAME);
} else }
usb_serial_deregister(&ark3116_device);
return retval; return retval;
} }
static void __exit ark3116_exit(void) static void __exit ark3116_exit(void)
{ {
usb_deregister(&ark3116_driver); usb_serial_deregister_drivers(&ark3116_driver, serial_drivers);
usb_serial_deregister(&ark3116_device);
} }
module_init(ark3116_init); module_init(ark3116_init);
......
...@@ -78,7 +78,6 @@ static struct usb_driver belkin_driver = { ...@@ -78,7 +78,6 @@ static struct usb_driver belkin_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,
}; };
/* All of the device info needed for the serial converters */ /* All of the device info needed for the serial converters */
...@@ -88,7 +87,6 @@ static struct usb_serial_driver belkin_device = { ...@@ -88,7 +87,6 @@ static struct usb_serial_driver belkin_device = {
.name = "belkin", .name = "belkin",
}, },
.description = "Belkin / Peracom / GoHubs USB Serial Adapter", .description = "Belkin / Peracom / GoHubs USB Serial Adapter",
.usb_driver = &belkin_driver,
.id_table = id_table_combined, .id_table = id_table_combined,
.num_ports = 1, .num_ports = 1,
.open = belkin_sa_open, .open = belkin_sa_open,
...@@ -103,6 +101,10 @@ static struct usb_serial_driver belkin_device = { ...@@ -103,6 +101,10 @@ static struct usb_serial_driver belkin_device = {
.release = belkin_sa_release, .release = belkin_sa_release,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&belkin_device, NULL
};
struct belkin_sa_private { struct belkin_sa_private {
spinlock_t lock; spinlock_t lock;
unsigned long control_state; unsigned long control_state;
...@@ -526,25 +528,17 @@ static int belkin_sa_tiocmset(struct tty_struct *tty, ...@@ -526,25 +528,17 @@ static int belkin_sa_tiocmset(struct tty_struct *tty,
static int __init belkin_sa_init(void) static int __init belkin_sa_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&belkin_device);
if (retval) retval = usb_serial_register_drivers(&belkin_driver, serial_drivers);
goto failed_usb_serial_register; if (retval == 0)
retval = usb_register(&belkin_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(&belkin_device);
failed_usb_serial_register:
return retval; return retval;
} }
static void __exit belkin_sa_exit (void) static void __exit belkin_sa_exit (void)
{ {
usb_deregister(&belkin_driver); usb_serial_deregister_drivers(&belkin_driver, serial_drivers);
usb_serial_deregister(&belkin_device);
} }
......
...@@ -625,7 +625,6 @@ static struct usb_driver ch341_driver = { ...@@ -625,7 +625,6 @@ static struct usb_driver ch341_driver = {
.resume = usb_serial_resume, .resume = usb_serial_resume,
.reset_resume = ch341_reset_resume, .reset_resume = ch341_reset_resume,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1,
.supports_autosuspend = 1, .supports_autosuspend = 1,
}; };
...@@ -635,7 +634,6 @@ static struct usb_serial_driver ch341_device = { ...@@ -635,7 +634,6 @@ static struct usb_serial_driver ch341_device = {
.name = "ch341-uart", .name = "ch341-uart",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &ch341_driver,
.num_ports = 1, .num_ports = 1,
.open = ch341_open, .open = ch341_open,
.dtr_rts = ch341_dtr_rts, .dtr_rts = ch341_dtr_rts,
...@@ -650,23 +648,18 @@ static struct usb_serial_driver ch341_device = { ...@@ -650,23 +648,18 @@ static struct usb_serial_driver ch341_device = {
.attach = ch341_attach, .attach = ch341_attach,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&ch341_device, NULL
};
static int __init ch341_init(void) static int __init ch341_init(void)
{ {
int retval; return usb_serial_register_drivers(&ch341_driver, serial_drivers);
retval = usb_serial_register(&ch341_device);
if (retval)
return retval;
retval = usb_register(&ch341_driver);
if (retval)
usb_serial_deregister(&ch341_device);
return retval;
} }
static void __exit ch341_exit(void) static void __exit ch341_exit(void)
{ {
usb_deregister(&ch341_driver); usb_serial_deregister_drivers(&ch341_driver, serial_drivers);
usb_serial_deregister(&ch341_device);
} }
module_init(ch341_init); module_init(ch341_init);
......
...@@ -154,7 +154,6 @@ static struct usb_driver cp210x_driver = { ...@@ -154,7 +154,6 @@ static struct usb_driver cp210x_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,
}; };
static struct usb_serial_driver cp210x_device = { static struct usb_serial_driver cp210x_device = {
...@@ -162,7 +161,6 @@ static struct usb_serial_driver cp210x_device = { ...@@ -162,7 +161,6 @@ static struct usb_serial_driver cp210x_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "cp210x", .name = "cp210x",
}, },
.usb_driver = &cp210x_driver,
.id_table = id_table, .id_table = id_table,
.num_ports = 1, .num_ports = 1,
.bulk_in_size = 256, .bulk_in_size = 256,
...@@ -177,6 +175,10 @@ static struct usb_serial_driver cp210x_device = { ...@@ -177,6 +175,10 @@ static struct usb_serial_driver cp210x_device = {
.dtr_rts = cp210x_dtr_rts .dtr_rts = cp210x_dtr_rts
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&cp210x_device, NULL
};
/* Config request types */ /* Config request types */
#define REQTYPE_HOST_TO_DEVICE 0x41 #define REQTYPE_HOST_TO_DEVICE 0x41
#define REQTYPE_DEVICE_TO_HOST 0xc1 #define REQTYPE_DEVICE_TO_HOST 0xc1
...@@ -852,27 +854,16 @@ static int __init cp210x_init(void) ...@@ -852,27 +854,16 @@ static int __init cp210x_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&cp210x_device); retval = usb_serial_register_drivers(&cp210x_driver, serial_drivers);
if (retval) if (retval == 0)
return retval; /* Failed to register */ printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
retval = usb_register(&cp210x_driver); return retval;
if (retval) {
/* Failed to register */
usb_serial_deregister(&cp210x_device);
return retval;
}
/* Success */
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return 0;
} }
static void __exit cp210x_exit(void) static void __exit cp210x_exit(void)
{ {
usb_deregister(&cp210x_driver); usb_serial_deregister_drivers(&cp210x_driver, serial_drivers);
usb_serial_deregister(&cp210x_device);
} }
module_init(cp210x_init); module_init(cp210x_init);
......
...@@ -82,7 +82,6 @@ static struct usb_driver cyberjack_driver = { ...@@ -82,7 +82,6 @@ static struct usb_driver cyberjack_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,
}; };
static struct usb_serial_driver cyberjack_device = { static struct usb_serial_driver cyberjack_device = {
...@@ -91,7 +90,6 @@ static struct usb_serial_driver cyberjack_device = { ...@@ -91,7 +90,6 @@ static struct usb_serial_driver cyberjack_device = {
.name = "cyberjack", .name = "cyberjack",
}, },
.description = "Reiner SCT Cyberjack USB card reader", .description = "Reiner SCT Cyberjack USB card reader",
.usb_driver = &cyberjack_driver,
.id_table = id_table, .id_table = id_table,
.num_ports = 1, .num_ports = 1,
.attach = cyberjack_startup, .attach = cyberjack_startup,
...@@ -106,6 +104,10 @@ static struct usb_serial_driver cyberjack_device = { ...@@ -106,6 +104,10 @@ static struct usb_serial_driver cyberjack_device = {
.write_bulk_callback = cyberjack_write_bulk_callback, .write_bulk_callback = cyberjack_write_bulk_callback,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&cyberjack_device, NULL
};
struct cyberjack_private { struct cyberjack_private {
spinlock_t lock; /* Lock for SMP */ spinlock_t lock; /* Lock for SMP */
short rdtodo; /* Bytes still to read */ short rdtodo; /* Bytes still to read */
...@@ -476,28 +478,19 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -476,28 +478,19 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
static int __init cyberjack_init(void) static int __init cyberjack_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&cyberjack_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&cyberjack_driver);
if (retval)
goto failed_usb_register;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION " "
DRIVER_AUTHOR "\n");
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
return 0; retval = usb_serial_register_drivers(&cyberjack_driver, serial_drivers);
failed_usb_register: if (retval == 0) {
usb_serial_deregister(&cyberjack_device); printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION " "
failed_usb_serial_register: DRIVER_AUTHOR "\n");
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
}
return retval; return retval;
} }
static void __exit cyberjack_exit(void) static void __exit cyberjack_exit(void)
{ {
usb_deregister(&cyberjack_driver); usb_serial_deregister_drivers(&cyberjack_driver, serial_drivers);
usb_serial_deregister(&cyberjack_device);
} }
module_init(cyberjack_init); module_init(cyberjack_init);
......
...@@ -94,7 +94,6 @@ static struct usb_driver cypress_driver = { ...@@ -94,7 +94,6 @@ static struct usb_driver cypress_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,
}; };
enum packet_format { enum packet_format {
...@@ -163,7 +162,6 @@ static struct usb_serial_driver cypress_earthmate_device = { ...@@ -163,7 +162,6 @@ static struct usb_serial_driver cypress_earthmate_device = {
.name = "earthmate", .name = "earthmate",
}, },
.description = "DeLorme Earthmate USB", .description = "DeLorme Earthmate USB",
.usb_driver = &cypress_driver,
.id_table = id_table_earthmate, .id_table = id_table_earthmate,
.num_ports = 1, .num_ports = 1,
.attach = cypress_earthmate_startup, .attach = cypress_earthmate_startup,
...@@ -190,7 +188,6 @@ static struct usb_serial_driver cypress_hidcom_device = { ...@@ -190,7 +188,6 @@ static struct usb_serial_driver cypress_hidcom_device = {
.name = "cyphidcom", .name = "cyphidcom",
}, },
.description = "HID->COM RS232 Adapter", .description = "HID->COM RS232 Adapter",
.usb_driver = &cypress_driver,
.id_table = id_table_cyphidcomrs232, .id_table = id_table_cyphidcomrs232,
.num_ports = 1, .num_ports = 1,
.attach = cypress_hidcom_startup, .attach = cypress_hidcom_startup,
...@@ -217,7 +214,6 @@ static struct usb_serial_driver cypress_ca42v2_device = { ...@@ -217,7 +214,6 @@ static struct usb_serial_driver cypress_ca42v2_device = {
.name = "nokiaca42v2", .name = "nokiaca42v2",
}, },
.description = "Nokia CA-42 V2 Adapter", .description = "Nokia CA-42 V2 Adapter",
.usb_driver = &cypress_driver,
.id_table = id_table_nokiaca42v2, .id_table = id_table_nokiaca42v2,
.num_ports = 1, .num_ports = 1,
.attach = cypress_ca42v2_startup, .attach = cypress_ca42v2_startup,
...@@ -238,6 +234,11 @@ static struct usb_serial_driver cypress_ca42v2_device = { ...@@ -238,6 +234,11 @@ static struct usb_serial_driver cypress_ca42v2_device = {
.write_int_callback = cypress_write_int_callback, .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 * Cypress serial helper functions
*****************************************************************************/ *****************************************************************************/
...@@ -1356,30 +1357,10 @@ static int __init cypress_init(void) ...@@ -1356,30 +1357,10 @@ static int __init cypress_init(void)
dbg("%s", __func__); dbg("%s", __func__);
retval = usb_serial_register(&cypress_earthmate_device); retval = usb_serial_register_drivers(&cypress_driver, serial_drivers);
if (retval) if (retval == 0)
goto failed_em_register; printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
retval = usb_serial_register(&cypress_hidcom_device); DRIVER_DESC "\n");
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:
return retval; return retval;
} }
...@@ -1388,10 +1369,7 @@ static void __exit cypress_exit(void) ...@@ -1388,10 +1369,7 @@ static void __exit cypress_exit(void)
{ {
dbg("%s", __func__); dbg("%s", __func__);
usb_deregister(&cypress_driver); usb_serial_deregister_drivers(&cypress_driver, serial_drivers);
usb_serial_deregister(&cypress_earthmate_device);
usb_serial_deregister(&cypress_hidcom_device);
usb_serial_deregister(&cypress_ca42v2_device);
} }
......
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