USB: serial: rework usb_serial_register/deregister_drivers()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 May 2012 22:46:14 +0000 (15:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 May 2012 22:46:14 +0000 (15:46 -0700)
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 <adhirramjiawan0@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Aleksey Babahin <tamerlan311@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrew Worsley <amworsley@gmail.com>
Cc: Bart Hartgers <bart.hartgers@gmail.com>
Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Donald Lee <donald@asix.com.tw>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Gary Brubaker <xavyer@ix.netcom.com>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Julia Lawall <julia@diku.dk>
Cc: Kautuk Consul <consul.kautuk@gmail.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Lonnie Mendez <dignome@gmail.com>
Cc: Matthias Bruestle and Harald Welte <support@reiner-sct.com>
Cc: Matthias Urlichs <smurf@smurf.noris.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Michal Sroczynski <msroczyn@gmail.com>
Cc: "Michał Wróbel" <michal.wrobel@flytronic.pl>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Berger <pberger@brimson.com>
Cc: Preston Fick <preston.fick@silabs.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Rigbert Hamisch <rigbert@gmx.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Simon Arlott <simon@fire.lp0.eu>
Cc: Support Department <support@connecttech.com>
Cc: Thomas Tuttle <ttuttle@chromium.org>
Cc: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Cc: Wang YanQing <Udknight@gmail.com>
Cc: William Greathouse <wgreathouse@smva.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
56 files changed:
drivers/staging/quatech_usb2/quatech_usb2.c
drivers/staging/serqt_usb2/serqt_usb2.c
drivers/usb/serial/aircable.c
drivers/usb/serial/ark3116.c
drivers/usb/serial/belkin_sa.c
drivers/usb/serial/ch341.c
drivers/usb/serial/cp210x.c
drivers/usb/serial/cyberjack.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/empeg.c
drivers/usb/serial/f81232.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/funsoft.c
drivers/usb/serial/garmin_gps.c
drivers/usb/serial/generic.c
drivers/usb/serial/hp4x.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_tables.h
drivers/usb/serial/io_ti.c
drivers/usb/serial/ipaq.c
drivers/usb/serial/ipw.c
drivers/usb/serial/ir-usb.c
drivers/usb/serial/iuu_phoenix.c
drivers/usb/serial/keyspan.c
drivers/usb/serial/keyspan.h
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/kobil_sct.c
drivers/usb/serial/mct_u232.c
drivers/usb/serial/metro-usb.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/moto_modem.c
drivers/usb/serial/navman.c
drivers/usb/serial/omninet.c
drivers/usb/serial/opticon.c
drivers/usb/serial/option.c
drivers/usb/serial/oti6858.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/qcaux.c
drivers/usb/serial/qcserial.c
drivers/usb/serial/safe_serial.c
drivers/usb/serial/siemens_mpi.c
drivers/usb/serial/sierra.c
drivers/usb/serial/spcp8x5.c
drivers/usb/serial/ssu100.c
drivers/usb/serial/symbolserial.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb_debug.c
drivers/usb/serial/visor.c
drivers/usb/serial/vivopay-serial.c
drivers/usb/serial/whiteheat.c
drivers/usb/serial/zio.c
include/linux/usb/serial.h

index 4e9c00e532612e99150756bb5ec27e7f93619eea..a977acaf73c1caca094ed8f939b4c7421b03358b 100644 (file)
@@ -116,7 +116,7 @@ static bool debug;
 #define FOURTHCHAR     ((unsigned char *)(urb->transfer_buffer))[i + 3]
 #define FIFTHCHAR      ((unsigned char *)(urb->transfer_buffer))[i + 4]
 
-static const struct usb_device_id quausb2_id_table[] = {
+static const struct usb_device_id id_table[] = {
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU2_100)},
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU2_100)},
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU2_400)},
@@ -126,14 +126,7 @@ static const struct usb_device_id quausb2_id_table[] = {
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_ESU2_400)},
        {}      /* Terminating entry */
 };
-
-MODULE_DEVICE_TABLE(usb, quausb2_id_table);
-
-/* custom structures we need go here */
-static struct usb_driver quausb2_usb_driver = {
-       .name = "quatech-usb2-serial",
-       .id_table = quausb2_id_table,
-};
+MODULE_DEVICE_TABLE(usb, id_table);
 
 /**
  * quatech2_port: Structure in which to keep all the messy stuff that this
@@ -1922,7 +1915,7 @@ static struct usb_serial_driver quatech2_device = {
                .name = "quatech_usb2",
        },
        .description = DRIVER_DESC,
-       .id_table = quausb2_id_table,
+       .id_table = id_table,
        .num_ports = 8,
        .open = qt2_open,
        .close = qt2_close,
@@ -1947,7 +1940,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &quatech2_device, NULL
 };
 
-module_usb_serial_driver(quausb2_usb_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 1ffdaefa79befcd1e2cbfc28680259f229461ede..f2ae004da5e59b9fd72da70131c418e977b9f55c 100644 (file)
@@ -125,7 +125,7 @@ static bool debug;
 #define MODEM_CTRL          0x40
 #define RS232_MODE          0x00
 
-static const struct usb_device_id serqt_id_table[] = {
+static const struct usb_device_id id_table[] = {
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU200)},
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU100)},
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU200)},
@@ -152,8 +152,7 @@ static const struct usb_device_id serqt_id_table[] = {
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_ESU100_2)},
        {}                      /* Terminating entry */
 };
-
-MODULE_DEVICE_TABLE(usb, serqt_id_table);
+MODULE_DEVICE_TABLE(usb, id_table);
 
 struct qt_get_device_data {
        __u8 porta;
@@ -195,11 +194,6 @@ struct quatech_port {
        char closePending;
 };
 
-static struct usb_driver serqt_usb_driver = {
-       .name = "quatech-usb-serial",
-       .id_table = serqt_id_table,
-};
-
 static int port_paranoia_check(struct usb_serial_port *port,
                               const char *function)
 {
@@ -1544,7 +1538,7 @@ static struct usb_serial_driver quatech_device = {
                   .name = "serqt",
                   },
        .description = DRIVER_DESC,
-       .id_table = serqt_id_table,
+       .id_table = id_table,
        .num_ports = 8,
        .open = qt_open,
        .close = qt_close,
@@ -1567,7 +1561,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &quatech_device, NULL
 };
 
-module_usb_serial_driver(serqt_usb_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 93aabd292b4833868d80c68a22f1fafdf82458cd..cef5d75151dd50f491f4904f71400bb74bd9480e 100644 (file)
@@ -170,11 +170,6 @@ static void aircable_process_read_urb(struct urb *urb)
        tty_kref_put(tty);
 }
 
-static struct usb_driver aircable_driver = {
-       .name =         "aircable",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver aircable_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -194,7 +189,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &aircable_device, NULL
 };
 
-module_usb_serial_driver(aircable_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 4b79679183ba2d8558c10c2fad499983c91c7dba..9413b7491d4300d20901c140c394dd7d7b18e7fc 100644 (file)
@@ -714,11 +714,6 @@ static void ark3116_process_read_urb(struct urb *urb)
        tty_kref_put(tty);
 }
 
-static struct usb_driver ark3116_driver = {
-       .name =         "ark3116",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver ark3116_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -745,7 +740,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &ark3116_device, NULL
 };
 
-module_usb_serial_driver(ark3116_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_LICENSE("GPL");
 
index 13031bb1e2cbe7e1f7f281a759f2068f545c6407..5965df72cd073d97e51669ddd4bf31fa568cfdbd 100644 (file)
@@ -62,7 +62,7 @@ static int  belkin_sa_tiocmset(struct tty_struct *tty,
                                        unsigned int set, unsigned int clear);
 
 
-static const struct usb_device_id id_table_combined[] = {
+static const struct usb_device_id id_table[] = {
        { USB_DEVICE(BELKIN_SA_VID, BELKIN_SA_PID) },
        { USB_DEVICE(BELKIN_OLD_VID, BELKIN_OLD_PID) },
        { USB_DEVICE(PERACOM_VID, PERACOM_PID) },
@@ -71,12 +71,7 @@ static const struct usb_device_id id_table_combined[] = {
        { USB_DEVICE(BELKIN_DOCKSTATION_VID, BELKIN_DOCKSTATION_PID) },
        { }     /* Terminating entry */
 };
-MODULE_DEVICE_TABLE(usb, id_table_combined);
-
-static struct usb_driver belkin_driver = {
-       .name =         "belkin",
-       .id_table =     id_table_combined,
-};
+MODULE_DEVICE_TABLE(usb, id_table);
 
 /* All of the device info needed for the serial converters */
 static struct usb_serial_driver belkin_device = {
@@ -85,7 +80,7 @@ static struct usb_serial_driver belkin_device = {
                .name =         "belkin",
        },
        .description =          "Belkin / Peracom / GoHubs USB Serial Adapter",
-       .id_table =             id_table_combined,
+       .id_table =             id_table,
        .num_ports =            1,
        .open =                 belkin_sa_open,
        .close =                belkin_sa_close,
@@ -513,7 +508,7 @@ exit:
        return retval;
 }
 
-module_usb_serial_driver(belkin_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 95b25974769799db8fc1bc11689236b1999d58d5..a2b7ea726bfbf7f8476dec6ca85fb7491bd93168 100644 (file)
@@ -589,11 +589,6 @@ static int ch341_resume(struct usb_serial *serial)
        return 0;
 }
 
-static struct usb_driver ch341_driver = {
-       .name           = "ch341",
-       .id_table       = id_table,
-};
-
 static struct usb_serial_driver ch341_device = {
        .driver = {
                .owner  = THIS_MODULE,
@@ -619,7 +614,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &ch341_device, NULL
 };
 
-module_usb_serial_driver(ch341_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_LICENSE("GPL");
 
index 02a1cab924858e5b0d975318abf30a4180bf276e..1b1926200ba791c1335ea9305369258898d955c1 100644 (file)
@@ -156,11 +156,6 @@ struct cp210x_port_private {
        __u8                    bInterfaceNumber;
 };
 
-static struct usb_driver cp210x_driver = {
-       .name           = "cp210x",
-       .id_table       = id_table,
-};
-
 static struct usb_serial_driver cp210x_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -880,7 +875,7 @@ static void cp210x_release(struct usb_serial *serial)
        }
 }
 
-module_usb_serial_driver(cp210x_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_VERSION(DRIVER_VERSION);
index 37fb911c1cc06f427863af63be14baff83d7f823..3aa0b530f68ee8717c4b5c854119338954068c1c 100644 (file)
@@ -77,11 +77,6 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver cyberjack_driver = {
-       .name =         "cyberjack",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver cyberjack_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -455,7 +450,7 @@ exit:
        usb_serial_port_softint(port);
 }
 
-module_usb_serial_driver(cyberjack_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index df53d57edb3f3251b9040c92f862ab708d75662f..b78c34eb5d3f6f976aac101eb15094e8f99370e4 100644 (file)
@@ -89,11 +89,6 @@ static const struct usb_device_id id_table_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver cypress_driver = {
-       .name =         "cypress",
-       .id_table =     id_table_combined,
-};
-
 enum packet_format {
        packet_format_1,  /* b0:status, b1:payload count */
        packet_format_2   /* b0[7:3]:status, b0[2:0]:payload count */
@@ -1308,7 +1303,7 @@ static void cypress_write_int_callback(struct urb *urb)
        cypress_send(port);
 }
 
-module_usb_serial_driver(cypress_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 3b584db1599f7887ef4a6a232a0802d889ff7c04..b5cd838093ef58be7129ff9f78bcb814fc697da0 100644 (file)
@@ -271,12 +271,6 @@ static const struct usb_device_id id_table_4[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver digi_driver = {
-       .name =         "digi_acceleport",
-       .id_table =     id_table_combined,
-};
-
-
 /* device info needed for the Digi serial converter */
 
 static struct usb_serial_driver digi_acceleport_2_device = {
@@ -1553,7 +1547,7 @@ static int digi_read_oob_callback(struct urb *urb)
 
 }
 
-module_usb_serial_driver(digi_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 80447e5a6926da7c62493a49567d10036449678f..cdf61dd0731837fb0acf62fc6cd44f0a199ef38f 100644 (file)
@@ -51,11 +51,6 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver empeg_driver = {
-       .name =         "empeg",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver empeg_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -134,7 +129,7 @@ static void empeg_init_termios(struct tty_struct *tty)
        tty_encode_baud_rate(tty, 115200, 115200);
 }
 
-module_usb_serial_driver(empeg_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 9052ec3cdf704f236a3329c8c275895b837db3b7..5a247ff81908a2e75c255cf95f67e6f3c7e59ca0 100644 (file)
@@ -350,18 +350,12 @@ static void f81232_release(struct usb_serial *serial)
        }
 }
 
-static struct usb_driver f81232_driver = {
-       .name =         "f81232",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver f81232_device = {
        .driver = {
                .owner =        THIS_MODULE,
                .name =         "f81232",
        },
        .id_table =             id_table,
-       .usb_driver =           &f81232_driver,
        .num_ports =            1,
        .bulk_in_size =         256,
        .bulk_out_size =        256,
@@ -385,7 +379,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        NULL,
 };
 
-module_usb_serial_driver(f81232_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION("Fintek F81232 USB to serial adaptor driver");
 MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org");
index e0e2b94e7833678c733c81c85c29cf57c257e130..8c084ea34e264fe056d7430fc3af008f1e0c86b1 100644 (file)
@@ -862,11 +862,6 @@ static struct usb_device_id id_table_combined [] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver ftdi_driver = {
-       .name =         "ftdi_sio",
-       .id_table =     id_table_combined,
-};
-
 static const char *ftdi_chip_name[] = {
        [SIO] = "SIO",  /* the serial part of FT8U100AX */
        [FT8U232AM] = "FT8U232AM",
@@ -2413,7 +2408,7 @@ static int __init ftdi_init(void)
                id_table_combined[i].idVendor = vendor;
                id_table_combined[i].idProduct = product;
        }
-       retval = usb_serial_register_drivers(&ftdi_driver, serial_drivers);
+       retval = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table_combined);
        if (retval == 0)
                printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
                               DRIVER_DESC "\n");
@@ -2422,7 +2417,7 @@ static int __init ftdi_init(void)
 
 static void __exit ftdi_exit(void)
 {
-       usb_serial_deregister_drivers(&ftdi_driver, serial_drivers);
+       usb_serial_deregister_drivers(serial_drivers);
 }
 
 
index 2049911ae75944a0945bca7e233e9de357cbf10c..235707961ca31aff1f256a5538d3ed774bac9987 100644 (file)
@@ -24,11 +24,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver funsoft_driver = {
-       .name =         "funsoft",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver funsoft_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -42,7 +37,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &funsoft_device, NULL
 };
 
-module_usb_serial_driver(funsoft_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_LICENSE("GPL");
 
index 0e595a6521ec75c799c1e71d06fe5f7c62e4b48e..346c15a510663cbda3d4db9f6508b6717cee69fd 100644 (file)
@@ -216,14 +216,8 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(GARMIN_VENDOR_ID, 3) },
        { }                                     /* Terminating entry */
 };
-
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver garmin_driver = {
-       .name =         "garmin_gps",
-       .id_table =     id_table,
-};
-
 
 static inline int getLayerId(const __u8 *usbPacket)
 {
@@ -1495,7 +1489,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &garmin_device, NULL
 };
 
-module_usb_serial_driver(garmin_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 4e5e993771e9bc6cc8a3b6325c7e3868211f9ad4..3644f513a4e0191c12037e0da65e634900699e43 100644 (file)
@@ -46,11 +46,6 @@ static const struct usb_device_id generic_serial_ids[] = {
        {}
 };
 
-static struct usb_driver generic_driver = {
-       .name =         "usbserial_generic",
-       .id_table =     generic_serial_ids,
-};
-
 /* All of the device info needed for the Generic Serial Converter */
 struct usb_serial_driver usb_serial_generic_device = {
        .driver = {
@@ -84,7 +79,7 @@ int usb_serial_generic_register(int _debug)
                USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
 
        /* register our generic driver with ourselves */
-       retval = usb_serial_register_drivers(&generic_driver, serial_drivers);
+       retval = usb_serial_register_drivers(serial_drivers, "usbserial_generic", generic_serial_ids);
 #endif
        return retval;
 }
@@ -93,7 +88,7 @@ void usb_serial_generic_deregister(void)
 {
 #ifdef CONFIG_USB_SERIAL_GENERIC
        /* remove our generic driver */
-       usb_serial_deregister_drivers(&generic_driver, serial_drivers);
+       usb_serial_deregister_drivers(serial_drivers);
 #endif
 }
 
index 37fe402ba830fb585f8ab7f6ff25022ccaeb5311..0bbaf21a9d1ef2d30508e13ca94b5d4fbbac0243 100644 (file)
@@ -36,11 +36,6 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver hp49gp_driver = {
-       .name =         "hp4X",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver hp49gp_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -54,7 +49,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &hp49gp_device, NULL
 };
 
-module_usb_serial_driver(hp49gp_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_VERSION(DRIVER_VERSION);
index 323e872357111a1c73bc328a0a33aa2193a1fbbb..e1f5ccd1e8f8c64a49e12d9ff3463d60e4f9fb01 100644 (file)
@@ -3181,7 +3181,7 @@ static void edge_release(struct usb_serial *serial)
        kfree(edge_serial);
 }
 
-module_usb_serial_driver(io_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 650693b1e18b4b547b7973d8b7ec737b7a2aa17d..350afddb55ba8c1fd276068518de05c78ac280ee 100644 (file)
@@ -95,11 +95,6 @@ static const struct usb_device_id id_table_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver io_driver = {
-       .name =         "io_edgeport",
-       .id_table =     id_table_combined,
-};
-
 static struct usb_serial_driver edgeport_2port_device = {
        .driver = {
                .owner          = THIS_MODULE,
index 643c120143125b6886e4f440f492408b0fecbf78..3936904c641969cd4566ba88ee5dc39d8912e6b9 100644 (file)
@@ -197,12 +197,6 @@ static const struct usb_device_id id_table_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver io_driver = {
-       .name =         "io_ti",
-       .id_table =     id_table_combined,
-};
-
-
 static unsigned char OperationalMajorVersion;
 static unsigned char OperationalMinorVersion;
 static unsigned short OperationalBuildNumber;
@@ -2788,7 +2782,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &edgeport_1port_device, &edgeport_2port_device, NULL
 };
 
-module_usb_serial_driver(io_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 7d1ae700c29d0302e8ea8712fb91b13b9647f0fd..bf440b12523cf88844fed6f767abc5ed8b5d7737 100644 (file)
@@ -502,11 +502,6 @@ static struct usb_device_id ipaq_id_table [] = {
 
 MODULE_DEVICE_TABLE(usb, ipaq_id_table);
 
-static struct usb_driver ipaq_driver = {
-       .name =         "ipaq",
-       .id_table =     ipaq_id_table,
-};
-
 
 /* All of the device info needed for the Compaq iPAQ */
 static struct usb_serial_driver ipaq_device = {
@@ -614,7 +609,7 @@ static int ipaq_startup(struct usb_serial *serial)
        return usb_reset_configuration(serial->dev);
 }
 
-module_usb_serial_driver(ipaq_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, ipaq_id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 76901336cfeb942fe85b608eadf09e30e9dcbf8f..5811d34b6c6bc514fb8474cc9662ad9521471a72 100644 (file)
@@ -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);
index c69a81ec2fd68dad49570f78843d50480852de6b..e9f8e1916f072cec9a7ed572a1cbea253904464e 100644 (file)
@@ -77,11 +77,6 @@ static const struct usb_device_id ir_id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, ir_id_table);
 
-static struct usb_driver ir_driver = {
-       .name           = "ir-usb",
-       .id_table       = ir_id_table,
-};
-
 static struct usb_serial_driver ir_device = {
        .driver = {
                .owner  = THIS_MODULE,
@@ -436,7 +431,7 @@ static int __init ir_init(void)
                ir_device.bulk_out_size = buffer_size;
        }
 
-       retval = usb_serial_register_drivers(&ir_driver, serial_drivers);
+       retval = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ir_id_table);
        if (retval == 0)
                printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
                               DRIVER_DESC "\n");
@@ -445,7 +440,7 @@ static int __init ir_init(void)
 
 static void __exit ir_exit(void)
 {
-       usb_serial_deregister_drivers(&ir_driver, serial_drivers);
+       usb_serial_deregister_drivers(serial_drivers);
 }
 
 
index 500e8fbdd9e524a3348265a9a63b46474d559276..22b1eb5040b7648815be691e215bcfe306cb2d78 100644 (file)
@@ -51,11 +51,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver iuu_driver = {
-       .name = "iuu_phoenix",
-       .id_table = id_table,
-};
-
 /* turbo parameter */
 static int boost = 100;
 static int clockmode = 1;
@@ -1254,7 +1249,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &iuu_device, NULL
 };
 
-module_usb_serial_driver(iuu_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR("Alain Degreffe eczema@ecze.com");
 
index ec46053ad15f2bee3ea86d08918f36914b3243c5..a1b99243dac9e77ac83be2e1b94316ff5014601c 100644 (file)
@@ -130,7 +130,7 @@ struct keyspan_port_private {
 #include "keyspan_usa67msg.h"
 
 
-module_usb_serial_driver(keyspan_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, keyspan_ids_combined);
 
 static void keyspan_break_ctl(struct tty_struct *tty, int break_state)
 {
index bb018dfaaa4aa57b1b22ac1a3b80baf1bfba1c1b..fe1c5d91692cd9a81a033a15df22e094043eabe7 100644 (file)
@@ -487,11 +487,6 @@ static const struct usb_device_id keyspan_ids_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
 
-static struct usb_driver keyspan_driver = {
-       .name =         "keyspan",                
-       .id_table =     keyspan_ids_combined,
-};
-
 /* usb_device_id table for the pre-firmware download keyspan devices */
 static const struct usb_device_id keyspan_pre_ids[] = {
        { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
index 62574cf7e74c0b545c794dd54b279588d6af53e9..a4ac3cfeffc4b84d6fa8ac41236bad5f2bf6e724 100644 (file)
@@ -86,11 +86,6 @@ static const struct usb_device_id id_table_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver keyspan_pda_driver = {
-       .name =         "keyspan_pda",
-       .id_table =     id_table_combined,
-};
-
 static const struct usb_device_id id_table_std[] = {
        { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
        { }                                             /* Terminating entry */
@@ -828,7 +823,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        NULL
 };
 
-module_usb_serial_driver(keyspan_pda_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 26dcfac6f6a8adafb2651003a4888b6813156551..5bed59cd5776d097e210944ed51339c53564faeb 100644 (file)
@@ -86,11 +86,6 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver kl5kusb105d_driver = {
-       .name =         "kl5kusb105d",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver kl5kusb105d_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -681,7 +676,7 @@ static int klsi_105_tiocmset(struct tty_struct *tty,
        return retval;
 }
 
-module_usb_serial_driver(kl5kusb105d_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 68fb36a81b46cbfc8020f25adf0950672f104ce6..fafeabb64c553152946618f6f65d37d46131f2fd 100644 (file)
@@ -81,16 +81,8 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(KOBIL_VENDOR_ID, KOBIL_KAAN_SIM_PRODUCT_ID) },
        { }                     /* Terminating entry */
 };
-
-
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver kobil_driver = {
-       .name =         "kobil",
-       .id_table =     id_table,
-};
-
-
 static struct usb_serial_driver kobil_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -674,7 +666,7 @@ static int kobil_ioctl(struct tty_struct *tty,
        }
 }
 
-module_usb_serial_driver(kobil_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index a63d1e8be91139d325ae957d8920995cdf3e5659..d0ec1aa527199b455e152da7d692c6e126f89a83 100644 (file)
@@ -73,20 +73,14 @@ static void mct_u232_unthrottle(struct tty_struct *tty);
 /*
  * All of the device info needed for the MCT USB-RS232 converter.
  */
-static const struct usb_device_id id_table_combined[] = {
+static const struct usb_device_id id_table[] = {
        { USB_DEVICE(MCT_U232_VID, MCT_U232_PID) },
        { USB_DEVICE(MCT_U232_VID, MCT_U232_SITECOM_PID) },
        { USB_DEVICE(MCT_U232_VID, MCT_U232_DU_H3SP_PID) },
        { USB_DEVICE(MCT_U232_BELKIN_F5U109_VID, MCT_U232_BELKIN_F5U109_PID) },
        { }             /* Terminating entry */
 };
-
-MODULE_DEVICE_TABLE(usb, id_table_combined);
-
-static struct usb_driver mct_u232_driver = {
-       .name =         "mct_u232",
-       .id_table =     id_table_combined,
-};
+MODULE_DEVICE_TABLE(usb, id_table);
 
 static struct usb_serial_driver mct_u232_device = {
        .driver = {
@@ -94,7 +88,7 @@ static struct usb_serial_driver mct_u232_device = {
                .name =         "mct_u232",
        },
        .description =       "MCT U232",
-       .id_table =          id_table_combined,
+       .id_table =          id_table,
        .num_ports =         1,
        .open =              mct_u232_open,
        .close =             mct_u232_close,
@@ -887,7 +881,7 @@ static int  mct_u232_get_icount(struct tty_struct *tty,
        return 0;
 }
 
-module_usb_serial_driver(mct_u232_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 14ad1db38ab598882103951e440c09b319ee2381..81423f7361dbe8f770086c3a03f6aca09b4beb2c 100644 (file)
@@ -419,11 +419,6 @@ static void metrousb_unthrottle(struct tty_struct *tty)
                        result);
 }
 
-static struct usb_driver metrousb_driver = {
-       .name =         "metro-usb",
-       .id_table =     id_table
-};
-
 static struct usb_serial_driver metrousb_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -449,7 +444,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        NULL,
 };
 
-module_usb_serial_driver(metrousb_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Philip Nicastro");
index eef0d844ef7648b9b0e4c64a741e84c317215087..a07dd3c8cfef3e408fbaa4bba593267621ccec71 100644 (file)
@@ -79,12 +79,12 @@ static struct usb_serial_driver moschip7720_2port_driver;
 #define MOSCHIP_DEVICE_ID_7720         0x7720
 #define MOSCHIP_DEVICE_ID_7715         0x7715
 
-static const struct usb_device_id moschip_port_id_table[] = {
+static const struct usb_device_id id_table[] = {
        { USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7720) },
        { USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7715) },
        { } /* terminating entry */
 };
-MODULE_DEVICE_TABLE(usb, moschip_port_id_table);
+MODULE_DEVICE_TABLE(usb, id_table);
 
 #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
 
@@ -2158,18 +2158,13 @@ static void mos7720_release(struct usb_serial *serial)
                kfree(usb_get_serial_port_data(serial->port[i]));
 }
 
-static struct usb_driver usb_driver = {
-       .name =         "moschip7720",
-       .id_table =     moschip_port_id_table,
-};
-
 static struct usb_serial_driver moschip7720_2port_driver = {
        .driver = {
                .owner =        THIS_MODULE,
                .name =         "moschip7720",
        },
        .description            = "Moschip 2 port adapter",
-       .id_table               = moschip_port_id_table,
+       .id_table               = id_table,
        .calc_num_ports         = mos77xx_calc_num_ports,
        .open                   = mos7720_open,
        .close                  = mos7720_close,
@@ -2195,7 +2190,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &moschip7720_2port_driver, NULL
 };
 
-module_usb_serial_driver(usb_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 91c3c5eb74c512f28d7766d12ebe2865e91a160a..29160f8b510146054726b68795467d8bf08a2020 100644 (file)
 #define MOSCHIP_DEVICE_ID_7810          0x7810
 /* The native component can have its vendor/device id's overridden
  * in vendor-specific implementations.  Such devices can be handled
- * by making a change here, in moschip_port_id_table, and in
- * moschip_id_table_combined
+ * by making a change here, in id_table.
  */
 #define USB_VENDOR_ID_BANDB              0x0856
 #define BANDB_DEVICE_ID_USO9ML2_2        0xAC22
 
 static int device_type;
 
-static const struct usb_device_id moschip_port_id_table[] = {
+static const struct usb_device_id id_table[] __devinitconst = {
        {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
        {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
        {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7810)},
@@ -212,30 +211,7 @@ static const struct usb_device_id moschip_port_id_table[] = {
        {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)},
        {}                      /* terminating entry */
 };
-
-static const struct usb_device_id moschip_id_table_combined[] __devinitconst = {
-       {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
-       {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
-       {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7810)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4P)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P)},
-       {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4)},
-       {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
-       {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)},
-       {}                      /* terminating entry */
-};
-
-MODULE_DEVICE_TABLE(usb, moschip_id_table_combined);
+MODULE_DEVICE_TABLE(usb, id_table);
 
 /* This structure holds all of the local port information */
 
@@ -2783,18 +2759,13 @@ static void mos7840_release(struct usb_serial *serial)
        }
 }
 
-static struct usb_driver io_driver = {
-       .name = "mos7840",
-       .id_table = moschip_id_table_combined,
-};
-
 static struct usb_serial_driver moschip7840_4port_device = {
        .driver = {
                   .owner = THIS_MODULE,
                   .name = "mos7840",
                   },
        .description = DRIVER_DESC,
-       .id_table = moschip_port_id_table,
+       .id_table = id_table,
        .num_ports = 4,
        .open = mos7840_open,
        .close = mos7840_close,
@@ -2824,7 +2795,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &moschip7840_4port_device, NULL
 };
 
-module_usb_serial_driver(io_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
index f6b055fb8eec82957d362a0c4aaecd19e88dae27..c5ff6c7795a6811852bc2e0a2087c118dd2a52b5 100644 (file)
@@ -31,11 +31,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver moto_driver = {
-       .name =         "moto-modem",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver moto_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -49,5 +44,5 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &moto_device, NULL
 };
 
-module_usb_serial_driver(moto_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 MODULE_LICENSE("GPL");
index 6f12bbc51fc9635f5a0e8c86a2e9ba09a8cb7b15..7a09e8a07907b2c1eace351d35829444a6d39ad3 100644 (file)
@@ -30,11 +30,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver navman_driver = {
-       .name =         "navman",
-       .id_table =     id_table,
-};
-
 static void navman_read_int_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
@@ -124,7 +119,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &navman_device, NULL
 };
 
-module_usb_serial_driver(navman_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_LICENSE("GPL");
 
index 72176f38d2198702422b885524bd8badb1ecd7d9..6f3d7051c7f415a156957fc15b68f4a11d040344 100644 (file)
@@ -54,15 +54,8 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) },
        { }                                             /* Terminating entry */
 };
-
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver omninet_driver = {
-       .name =         "omninet",
-       .id_table =     id_table,
-};
-
-
 static struct usb_serial_driver zyxel_omninet_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -306,7 +299,7 @@ static void omninet_release(struct usb_serial *serial)
        kfree(usb_get_serial_port_data(port));
 }
 
-module_usb_serial_driver(omninet_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index fe12cac4462cbec0af2efe42dacc8b14beda0675..91f89044e08df5c5985af29030f9bc77f3609981 100644 (file)
@@ -615,7 +615,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &opticon_device, NULL
 };
 
-module_usb_serial_driver(opticon_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
index 780c27658b9c733d0be927b4e9f9c0e644a2b671..1aae9028cd0bd9e58a75461bbbceb74b9079f0b0 100644 (file)
@@ -1220,11 +1220,6 @@ static const struct usb_device_id option_ids[] = {
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
 
-static struct usb_driver option_driver = {
-       .name       = "option",
-       .id_table   = option_ids,
-};
-
 /* The card has three separate interfaces, which the serial driver
  * recognizes separately, thus num_port=1.
  */
@@ -1293,7 +1288,7 @@ struct option_port_private {
        unsigned long tx_start_time[N_OUT_URB];
 };
 
-module_usb_serial_driver(option_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, option_ids);
 
 static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
                           const struct option_blacklist_info *blacklist)
index 9b195030cbaa94e27c7b4bf8405e466bbf63b212..5976b65ab6ee6851cfb10ca2f5dd956c71c8a284 100644 (file)
@@ -66,11 +66,6 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver oti6858_driver = {
-       .name =         "oti6858",
-       .id_table =     id_table,
-};
-
 static bool debug;
 
 /* requests */
@@ -921,7 +916,7 @@ static void oti6858_write_bulk_callback(struct urb *urb)
        }
 }
 
-module_usb_serial_driver(oti6858_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(OTI6858_DESCRIPTION);
 MODULE_AUTHOR(OTI6858_AUTHOR);
index 642136e39fa690e3c1ae33a876fb784300e266f1..13b8dd6481f565bd421a0a504b15d449ecbc3d72 100644 (file)
@@ -95,11 +95,6 @@ static const struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver pl2303_driver = {
-       .name =         "pl2303",
-       .id_table =     id_table,
-};
-
 #define SET_LINE_REQUEST_TYPE          0x21
 #define SET_LINE_REQUEST               0x20
 
@@ -840,7 +835,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &pl2303_device, NULL
 };
 
-module_usb_serial_driver(pl2303_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
index b0b41c11e1470162a5b6e440c7badfbb62c1849f..a4edc7ee9c8a02819a681356dc169bdea9eb8cc7 100644 (file)
@@ -77,11 +77,6 @@ static struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver qcaux_driver = {
-       .name =         "qcaux",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver qcaux_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -95,5 +90,5 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &qcaux_device, NULL
 };
 
-module_usb_serial_driver(qcaux_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 MODULE_LICENSE("GPL");
index 400a59e4b0edaec1e68a6510f32b87be84bb49fd..bc690ae814d0e45dbf357f4155024995701a2757 100644 (file)
@@ -112,11 +112,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver qcdriver = {
-       .name                   = "qcserial",
-       .id_table               = id_table,
-};
-
 static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 {
        struct usb_wwan_intf_private *data;
@@ -277,7 +272,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &qcdevice, NULL
 };
 
-module_usb_serial_driver(qcdriver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 546ea12455f38704b33474c9846c7a2dfc2c7cf2..36e9d9fc0618e56e8633e627cfcafa0eb8db15d0 100644 (file)
@@ -151,11 +151,6 @@ static struct usb_device_id id_table[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver safe_driver = {
-       .name =         "safe_serial",
-       .id_table =     id_table,
-};
-
 static const __u16 crc10_table[256] = {
        0x000, 0x233, 0x255, 0x066, 0x299, 0x0aa, 0x0cc, 0x2ff,
        0x301, 0x132, 0x154, 0x367, 0x198, 0x3ab, 0x3cd, 0x1fe,
@@ -337,12 +332,12 @@ static int __init safe_init(void)
                }
        }
 
-       return usb_serial_register_drivers(&safe_driver, serial_drivers);
+       return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table);
 }
 
 static void __exit safe_exit(void)
 {
-       usb_serial_deregister_drivers(&safe_driver, serial_drivers);
+       usb_serial_deregister_drivers(serial_drivers);
 }
 
 module_init(safe_init);
index 0d3108af1d044a75bc58a7e78510e1e25c8d682f..e4a1787cdbac3d4c475a1e468a64cd5bdacdc954 100644 (file)
@@ -29,11 +29,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver siemens_usb_mpi_driver = {
-       .name =         "siemens_mpi",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver siemens_usb_mpi_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -47,7 +42,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &siemens_usb_mpi_device, NULL
 };
 
-module_usb_serial_driver(siemens_usb_mpi_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 1040f9d5045193547cd6f8d57b6dde72b454f418..ba54a0a8235c08f71319098cd77ba62833f00301 100644 (file)
@@ -1044,11 +1044,6 @@ static int sierra_resume(struct usb_serial *serial)
 #define sierra_resume NULL
 #endif
 
-static struct usb_driver sierra_driver = {
-       .name       = "sierra",
-       .id_table   = id_table,
-};
-
 static struct usb_serial_driver sierra_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -1077,7 +1072,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &sierra_device, NULL
 };
 
-module_usb_serial_driver(sierra_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 51e43ccef10c1a07895e3420ca3deab06b6a6da7..1fc1cab5a4ad97efce5e5f53d995909de1ba0e0c 100644 (file)
@@ -151,12 +151,6 @@ enum spcp8x5_type {
        SPCP835_TYPE,
 };
 
-static struct usb_driver spcp8x5_driver = {
-       .name =                 "spcp8x5",
-       .id_table =             id_table,
-};
-
-
 struct spcp8x5_private {
        spinlock_t      lock;
        enum spcp8x5_type       type;
@@ -662,7 +656,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &spcp8x5_device, NULL
 };
 
-module_usb_serial_driver(spcp8x5_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_VERSION(DRIVER_VERSION);
index f72b03f83be2bd505a0a6e3c6a0fcc8bd47d4ee7..3fee23bf0c141718228d6b3a5ae04bc42a58a96d 100644 (file)
@@ -59,15 +59,8 @@ static const struct usb_device_id id_table[] = {
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU100)},
        {}                      /* Terminating entry */
 };
-
 MODULE_DEVICE_TABLE(usb, id_table);
 
-
-static struct usb_driver ssu100_driver = {
-       .name                          = "ssu100",
-       .id_table                      = id_table,
-};
-
 struct ssu100_port_private {
        spinlock_t status_lock;
        u8 shadowLSR;
@@ -671,7 +664,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &ssu100_device, NULL
 };
 
-module_usb_serial_driver(ssu100_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
index 5ef07ca6fe92f1ce7e815cefc9294df2f8c0efa2..f7c440541754f0a3d53e0497a14f4e6721269462 100644 (file)
@@ -269,11 +269,6 @@ static void symbol_release(struct usb_serial *serial)
        kfree(priv);
 }
 
-static struct usb_driver symbol_driver = {
-       .name =                 "symbol",
-       .id_table =             id_table,
-};
-
 static struct usb_serial_driver symbol_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -294,7 +289,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &symbol_device, NULL
 };
 
-module_usb_serial_driver(symbol_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_LICENSE("GPL");
 
index 9d96224494b832400bcdcd8e498f4780d0753f0d..a180b15d195a1b94446eab61b522ac0d16b58685 100644 (file)
@@ -211,11 +211,6 @@ static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1]
        { }
 };
 
-static struct usb_driver ti_usb_driver = {
-       .name                   = "ti_usb_3410_5052",
-       .id_table               = ti_id_table_combined,
-};
-
 static struct usb_serial_driver ti_1port_device = {
        .driver = {
                .owner          = THIS_MODULE,
@@ -342,20 +337,18 @@ static int __init ti_init(void)
                ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
        }
 
-       ret = usb_serial_register_drivers(&ti_usb_driver, serial_drivers);
+       ret = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ti_id_table_combined);
        if (ret == 0)
                printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
                               TI_DRIVER_DESC "\n");
        return ret;
 }
 
-
 static void __exit ti_exit(void)
 {
-       usb_serial_deregister_drivers(&ti_usb_driver, serial_drivers);
+       usb_serial_deregister_drivers(serial_drivers);
 }
 
-
 module_init(ti_init);
 module_exit(ti_exit);
 
index d1840aef0d53bdcec80b03d0d6273f735af32c5c..62dd9227052543ecf1800da090be0f41479ec64a 100644 (file)
@@ -1364,18 +1364,19 @@ static void usb_serial_deregister(struct usb_serial_driver *device)
 
 /**
  * usb_serial_register_drivers - register drivers for a usb-serial module
- * @udriver: usb_driver used for matching devices/interfaces
  * @serial_drivers: NULL-terminated array of pointers to drivers to be registered
+ * @name: name of the usb_driver for this set of @serial_drivers
+ * @id_table: list of all devices this @serial_drivers set binds to
  *
- * Registers @udriver and all the drivers in the @serial_drivers array.
- * Automatically fills in the .no_dynamic_id and PM fields in @udriver and
- * the .usb_driver field in each serial driver.
+ * Registers all the drivers in the @serial_drivers array, and dynamically
+ * creates a struct usb_driver with the name @name and id_table of @id_table.
  */
-int usb_serial_register_drivers(struct usb_driver *udriver,
-               struct usb_serial_driver * const serial_drivers[])
+int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
+                               const char *name,
+                               const struct usb_device_id *id_table)
 {
        int rc;
-       const struct usb_device_id *saved_id_table;
+       struct usb_driver *udriver;
        struct usb_serial_driver * const *sd;
 
        /*
@@ -1386,14 +1387,16 @@ int usb_serial_register_drivers(struct usb_driver *udriver,
         * Performance hack: We don't want udriver to be probed until
         * the serial drivers are registered, because the probe would
         * simply fail for lack of a matching serial driver.
-        * Therefore save off udriver's id_table until we are all set.
+        * So we leave udriver's id_table set to NULL until we are all set.
         *
         * Suspend/resume support is implemented in the usb-serial core,
         * so fill in the PM-related fields in udriver.
         */
-       saved_id_table = udriver->id_table;
-       udriver->id_table = NULL;
+       udriver = kzalloc(sizeof(*udriver), GFP_KERNEL);
+       if (!udriver)
+               return -ENOMEM;
 
+       udriver->name = name;
        udriver->no_dynamic_id = 1;
        udriver->supports_autosuspend = 1;
        udriver->suspend = usb_serial_suspend;
@@ -1411,8 +1414,8 @@ int usb_serial_register_drivers(struct usb_driver *udriver,
                        goto failed;
        }
 
-       /* Now restore udriver's id_table and look for matches */
-       udriver->id_table = saved_id_table;
+       /* Now set udriver's id_table and look for matches */
+       udriver->id_table = id_table;
        rc = driver_attach(&udriver->drvwrap.driver);
        return 0;
 
@@ -1426,17 +1429,20 @@ EXPORT_SYMBOL_GPL(usb_serial_register_drivers);
 
 /**
  * usb_serial_deregister_drivers - deregister drivers for a usb-serial module
- * @udriver: usb_driver to unregister
  * @serial_drivers: NULL-terminated array of pointers to drivers to be deregistered
  *
- * Deregisters @udriver and all the drivers in the @serial_drivers array.
+ * Deregisters all the drivers in the @serial_drivers array and deregisters and
+ * frees the struct usb_driver that was created by the call to
+ * usb_serial_register_drivers().
  */
-void usb_serial_deregister_drivers(struct usb_driver *udriver,
-               struct usb_serial_driver * const serial_drivers[])
+void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[])
 {
+       struct usb_driver *udriver = (*serial_drivers)->usb_driver;
+
        for (; *serial_drivers; ++serial_drivers)
                usb_serial_deregister(*serial_drivers);
        usb_deregister(udriver);
+       kfree(udriver);
 }
 EXPORT_SYMBOL_GPL(usb_serial_deregister_drivers);
 
index e22e5435ff962b37608b40e20f58b1bc98eb2bf6..5760f97ee508514cb30b4e10eac5a7560a05efcf 100644 (file)
@@ -35,11 +35,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver debug_driver = {
-       .name =         "debug",
-       .id_table =     id_table,
-};
-
 /* This HW really does not support a serial break, so one will be
  * emulated when ever the break state is set to true.
  */
@@ -81,5 +76,5 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &debug_device, NULL
 };
 
-module_usb_serial_driver(debug_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 MODULE_LICENSE("GPL");
index 2e24bd34754cd37e1a6773360a1f170ace1fb61a..f253c91383dacf1dfa4b89da4700dc946301d059 100644 (file)
@@ -163,11 +163,6 @@ static struct usb_device_id id_table_combined [] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver visor_driver = {
-       .name =         "visor",
-       .id_table =     id_table_combined,
-};
-
 /* All of the device info needed for the Handspring Visor,
    and Palm 4.0 devices */
 static struct usb_serial_driver handspring_device = {
@@ -625,7 +620,7 @@ static int clie_5_attach(struct usb_serial *serial)
        return 0;
 }
 
-module_usb_serial_driver(visor_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index c7d8ab359454730258be17ef3bc139c306c1a1a2..0c0aa876c20938c2ddeb16945201203e38211961 100644 (file)
@@ -25,11 +25,6 @@ static struct usb_device_id id_table [] = {
 
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver vivopay_serial_driver = {
-       .name =                 "vivopay-serial",
-       .id_table =             id_table,
-};
-
 static struct usb_serial_driver vivopay_serial_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -43,7 +38,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &vivopay_serial_device, NULL
 };
 
-module_usb_serial_driver(vivopay_serial_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 
 MODULE_AUTHOR("Forest Bond <forest.bond@outpostembedded.com>");
 MODULE_DESCRIPTION(DRIVER_DESC);
index 76840cdb818dfb20f5e2bad0c7155d259150f192..473635e7f5dbdf8bb4c28c20102f12b438b31d77 100644 (file)
@@ -77,10 +77,6 @@ static const struct usb_device_id id_table_combined[] = {
 
 MODULE_DEVICE_TABLE(usb, id_table_combined);
 
-static struct usb_driver whiteheat_driver = {
-       .name =         "whiteheat",
-       .id_table =     id_table_combined,
-};
 
 /* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */
 static int  whiteheat_firmware_download(struct usb_serial *serial,
@@ -914,7 +910,7 @@ static void stop_command_port(struct usb_serial *serial)
        mutex_unlock(&command_info->mutex);
 }
 
-module_usb_serial_driver(whiteheat_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table_combined);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
index 4822cc84a668cc507f9b813a985e5244335f63ad..c043aa84a0ba06e2185cbaa9be25b8a615aa79ff 100644 (file)
@@ -22,11 +22,6 @@ static const struct usb_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(usb, id_table);
 
-static struct usb_driver zio_driver = {
-       .name =         "zio",
-       .id_table =     id_table,
-};
-
 static struct usb_serial_driver zio_device = {
        .driver = {
                .owner =        THIS_MODULE,
@@ -40,5 +35,5 @@ static struct usb_serial_driver * const serial_drivers[] = {
        &zio_device, NULL
 };
 
-module_usb_serial_driver(zio_driver, serial_drivers);
+module_usb_serial_driver(serial_drivers, id_table);
 MODULE_LICENSE("GPL");
index 749836f2890c54c794e698f5ec9c996ea1771301..c9f65146a03988635157bf6ca1384f09e62fd0f3 100644 (file)
@@ -292,10 +292,9 @@ struct usb_serial_driver {
 #define to_usb_serial_driver(d) \
        container_of(d, struct usb_serial_driver, driver)
 
-extern int usb_serial_register_drivers(struct usb_driver *udriver,
-               struct usb_serial_driver * const serial_drivers[]);
-extern void usb_serial_deregister_drivers(struct usb_driver *udriver,
-               struct usb_serial_driver * const serial_drivers[]);
+extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
+               const char *name, const struct usb_device_id *id_table);
+extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]);
 extern void usb_serial_port_softint(struct usb_serial_port *port);
 
 extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
@@ -396,8 +395,8 @@ do {                                                                        \
 
 /*
  * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
- * @__usb_driver: usb_driver struct to register
  * @__serial_drivers: list of usb_serial drivers to register
+ * @__ids: all device ids that @__serial_drivers bind to
  *
  * Helper macro for USB serial drivers which do not do anything special
  * in module init/exit. This eliminates a lot of boilerplate. Each
@@ -405,9 +404,21 @@ do {                                                                       \
  * module_init() and module_exit()
  *
  */
-#define module_usb_serial_driver(__usb_driver, __serial_drivers)       \
-       module_driver(__usb_driver, usb_serial_register_drivers,        \
-                      usb_serial_deregister_drivers, __serial_drivers)
+#define usb_serial_module_driver(__name, __serial_drivers, __ids)      \
+static int __init usb_serial_module_init(void)                         \
+{                                                                      \
+       return usb_serial_register_drivers(__serial_drivers,            \
+                                          __name, __ids);              \
+}                                                                      \
+module_init(usb_serial_module_init);                                   \
+static void __exit usb_serial_module_exit(void)                                \
+{                                                                      \
+       usb_serial_deregister_drivers(__serial_drivers);                \
+}                                                                      \
+module_exit(usb_serial_module_exit);
+
+#define module_usb_serial_driver(__serial_drivers, __ids)              \
+       usb_serial_module_driver(KBUILD_MODNAME, __serial_drivers, __ids)
 
 #endif /* __LINUX_USB_SERIAL_H */