From 68e24113457e437b1576670f2419b77ed0531e9e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 8 May 2012 15:46:14 -0700 Subject: USB: serial: rework usb_serial_register/deregister_drivers() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reworks the usb_serial_register_drivers() and usb_serial_deregister_drivers() to not need a pointer to a struct usb_driver anymore. The usb_driver structure is now created dynamically and registered and unregistered as needed. This saves lines of code in each usb-serial driver. All in-kernel users of these functions were also fixed up at this time. The pl2303 driver was tested that everything worked properly. Thanks for the idea to do this from Alan Stern. Cc: Adhir Ramjiawan Cc: Alan Stern Cc: Al Borchers Cc: Aleksey Babahin Cc: Andrew Morton Cc: Andrew Worsley Cc: Bart Hartgers Cc: Bill Pemberton Cc: Dan Carpenter Cc: Dan Williams Cc: Donald Lee Cc: Eric Dumazet Cc: "Eric W. Biederman" Cc: Felipe Balbi Cc: Gary Brubaker Cc: Jesper Juhl Cc: Jiri Kosina Cc: Johan Hovold Cc: Julia Lawall Cc: Kautuk Consul Cc: Kuninori Morimoto Cc: Lonnie Mendez Cc: Matthias Bruestle and Harald Welte Cc: Matthias Urlichs Cc: Mauro Carvalho Chehab Cc: Michal Sroczynski Cc: "Michał Wróbel" Cc: Oliver Neukum Cc: Paul Gortmaker Cc: Peter Berger Cc: Preston Fick Cc: "Rafael J. Wysocki" Cc: Rigbert Hamisch Cc: Rusty Russell Cc: Simon Arlott Cc: Support Department Cc: Thomas Tuttle Cc: Uwe Bonnes Cc: Wang YanQing Cc: William Greathouse Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ipw.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers/usb/serial/ipw.c') diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 76901336cfeb..5811d34b6c6b 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -132,17 +132,11 @@ enum { #define IPW_WANTS_TO_SEND 0x30 -static const struct usb_device_id usb_ipw_ids[] = { +static const struct usb_device_id id_table[] = { { USB_DEVICE(IPW_VID, IPW_PID) }, { }, }; - -MODULE_DEVICE_TABLE(usb, usb_ipw_ids); - -static struct usb_driver usb_ipw_driver = { - .name = "ipwtty", - .id_table = usb_ipw_ids, -}; +MODULE_DEVICE_TABLE(usb, id_table); static bool debug; @@ -313,7 +307,7 @@ static struct usb_serial_driver ipw_device = { .name = "ipw", }, .description = "IPWireless converter", - .id_table = usb_ipw_ids, + .id_table = id_table, .num_ports = 1, .disconnect = usb_wwan_disconnect, .open = ipw_open, @@ -329,7 +323,7 @@ static struct usb_serial_driver * const serial_drivers[] = { &ipw_device, NULL }; -module_usb_serial_driver(usb_ipw_driver, serial_drivers); +module_usb_serial_driver(serial_drivers, id_table); /* Module information */ MODULE_AUTHOR(DRIVER_AUTHOR); -- cgit v1.2.3-59-g8ed1b