From 69276a33bd1d272dc9c3bd577038954811bd1831 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 23 Feb 2012 14:57:37 -0500 Subject: usb-serial: use new registration API in staging drivers This patch (as1530) modifies the following usb-serial drivers from drivers/staging to utilize the new usb_serial_{de}register_drivers() routines: quatech_usb2 and serqt_usb2. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/staging/quatech_usb2/quatech_usb2.c | 32 +++++++++-------------------- drivers/staging/serqt_usb2/serqt_usb2.c | 30 ++++++++------------------- 2 files changed, 19 insertions(+), 43 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c index 897a3a99c794..b8a078abd6c7 100644 --- a/drivers/staging/quatech_usb2/quatech_usb2.c +++ b/drivers/staging/quatech_usb2/quatech_usb2.c @@ -135,7 +135,6 @@ static struct usb_driver quausb2_usb_driver = { .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, .id_table = quausb2_id_table, - .no_dynamic_id = 1, }; /** @@ -1942,7 +1941,6 @@ static struct usb_serial_driver quatech2_device = { .name = "quatech_usb2", }, .description = DRIVER_DESC, - .usb_driver = &quausb2_usb_driver, .id_table = quausb2_id_table, .num_ports = 8, .open = qt2_open, @@ -1964,37 +1962,27 @@ static struct usb_serial_driver quatech2_device = { .write_bulk_callback = qt2_write_bulk_callback, }; +static struct usb_serial_driver * const serial_drivers[] = { + &quatech2_device, NULL +}; + static int __init quausb2_usb_init(void) { int retval; dbg("%s\n", __func__); - /* register with usb-serial */ - retval = usb_serial_register(&quatech2_device); - - if (retval) - goto failed_usb_serial_register; - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - - /* register with usb */ - - retval = usb_register(&quausb2_usb_driver); + retval = usb_serial_register_drivers(&quausb2_usb_driver, + serial_drivers); if (retval == 0) - return 0; - - /* if we're here, usb_register() failed */ - usb_serial_deregister(&quatech2_device); -failed_usb_serial_register: - return retval; + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); + return retval; } static void __exit quausb2_usb_exit(void) { - usb_deregister(&quausb2_usb_driver); - usb_serial_deregister(&quatech2_device); + usb_serial_deregister_drivers(&quausb2_usb_driver, serial_drivers); } module_init(quausb2_usb_init); diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 1c5780f1571b..04b6be86df1a 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -200,7 +200,6 @@ static struct usb_driver serqt_usb_driver = { .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, .id_table = serqt_id_table, - .no_dynamic_id = 1, }; static int port_paranoia_check(struct usb_serial_port *port, @@ -1590,7 +1589,6 @@ static struct usb_serial_driver quatech_device = { .name = "serqt", }, .description = DRIVER_DESC, - .usb_driver = &serqt_usb_driver, .id_table = serqt_id_table, .num_ports = 8, .open = qt_open, @@ -1610,37 +1608,27 @@ static struct usb_serial_driver quatech_device = { .release = qt_release, }; +static struct usb_serial_driver * const serial_drivers[] = { + &quatech_device, NULL +}; + static int __init serqt_usb_init(void) { int retval; dbg("%s\n", __func__); - /* register with usb-serial */ - retval = usb_serial_register(&quatech_device); - - if (retval) - goto failed_usb_serial_register; - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - - /* register with usb */ - - retval = usb_register(&serqt_usb_driver); + retval = usb_serial_register_drivers(&serqt_usb_driver, + serial_drivers); if (retval == 0) - return 0; - - /* if we're here, usb_register() failed */ - usb_serial_deregister(&quatech_device); -failed_usb_serial_register: + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); return retval; } static void __exit serqt_usb_exit(void) { - usb_deregister(&serqt_usb_driver); - usb_serial_deregister(&quatech_device); + usb_serial_deregister_drivers(&serqt_usb_driver, serial_drivers); } module_init(serqt_usb_init); -- cgit v1.2.2 From 7ac4704c099125214a4f0a4bd54ce94d15be2ffb Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Sat, 25 Feb 2012 18:28:09 +0100 Subject: usb/storage: a couple defines from drivers/usb/storage/transport.h to include/linux/usb/storage.h This moves the BOT data structures for CBW and CSW from drivers internal header file to global include able file in include/. The storage gadget is using the same name for CSW but a different for CBW so I fix it up properly. The same goes for the ub driver and keucr driver in staging. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Greg Kroah-Hartman --- drivers/staging/keucr/transport.h | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/keucr/transport.h b/drivers/staging/keucr/transport.h index 4ae57d0145b2..2a11a98375d7 100644 --- a/drivers/staging/keucr/transport.h +++ b/drivers/staging/keucr/transport.h @@ -3,43 +3,6 @@ #include -/* Bulk only data structures */ - -/* command block wrapper */ -struct bulk_cb_wrap { - __le32 Signature; /* contains 'USBC' */ - __u32 Tag; /* unique per command id */ - __le32 DataTransferLength; /* size of data */ - __u8 Flags; /* direction in bit 0 */ - __u8 Lun; /* LUN normally 0 */ - __u8 Length; /* of of the CDB */ - __u8 CDB[16]; /* max command */ -}; - -#define US_BULK_CB_WRAP_LEN 31 -#define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */ -#define US_BULK_FLAG_IN 1 -#define US_BULK_FLAG_OUT 0 - -/* command status wrapper */ -struct bulk_cs_wrap { - __le32 Signature; /* should = 'USBS' */ - __u32 Tag; /* same as original command */ - __le32 Residue; /* amount not transferred */ - __u8 Status; /* see below */ - __u8 Filler[18]; -}; - -#define US_BULK_CS_WRAP_LEN 13 -#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */ -#define US_BULK_STAT_OK 0 -#define US_BULK_STAT_FAIL 1 -#define US_BULK_STAT_PHASE 2 - -/* bulk-only class specific requests */ -#define US_BULK_RESET_REQUEST 0xff -#define US_BULK_GET_MAX_LUN 0xfe - /* usb_stor_bulk_transfer_xxx() return codes, in order of severity */ #define USB_STOR_XFER_GOOD 0 /* good transfer */ #define USB_STOR_XFER_SHORT 1 /* transferred less than expected */ -- cgit v1.2.2 From f136e8b61c205fa6dccdc45fbda372f3acb2b5ab Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 28 Feb 2012 13:11:27 -0800 Subject: USB: serial: quatech_usb2.c: use module_usb_serial_driver This converts the quatech_usb2.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: Lucas De Marchi CC: Rusty Russell CC: Alan Stern CC: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/quatech_usb2/quatech_usb2.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c index b8a078abd6c7..bb977e00cc86 100644 --- a/drivers/staging/quatech_usb2/quatech_usb2.c +++ b/drivers/staging/quatech_usb2/quatech_usb2.c @@ -1966,27 +1966,7 @@ static struct usb_serial_driver * const serial_drivers[] = { &quatech2_device, NULL }; -static int __init quausb2_usb_init(void) -{ - int retval; - - dbg("%s\n", __func__); - - retval = usb_serial_register_drivers(&quausb2_usb_driver, - serial_drivers); - if (retval == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return retval; -} - -static void __exit quausb2_usb_exit(void) -{ - usb_serial_deregister_drivers(&quausb2_usb_driver, serial_drivers); -} - -module_init(quausb2_usb_init); -module_exit(quausb2_usb_exit); +module_usb_serial_driver(quausb2_usb_driver, serial_drivers); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -- cgit v1.2.2 From e42f85f3d410a5457a2db61d883437ac9e32cecc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 28 Feb 2012 13:11:30 -0800 Subject: USB: serial: serqt_usb2.c: use module_usb_serial_driver This converts the serqt_usb2.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: Bill Pemberton CC: Rusty Russell CC: Alan Stern CC: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/serqt_usb2/serqt_usb2.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 04b6be86df1a..ae1d815e2a53 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c @@ -1612,27 +1612,7 @@ static struct usb_serial_driver * const serial_drivers[] = { &quatech_device, NULL }; -static int __init serqt_usb_init(void) -{ - int retval; - - dbg("%s\n", __func__); - - retval = usb_serial_register_drivers(&serqt_usb_driver, - serial_drivers); - if (retval == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return retval; -} - -static void __exit serqt_usb_exit(void) -{ - usb_serial_deregister_drivers(&serqt_usb_driver, serial_drivers); -} - -module_init(serqt_usb_init); -module_exit(serqt_usb_exit); +module_usb_serial_driver(serqt_usb_driver, serial_drivers); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); -- cgit v1.2.2