# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.578 -> 1.579 # drivers/usb/serial/io_edgeport.c 1.30 -> 1.31 # drivers/usb/serial/io_tables.h 1.7 -> 1.8 # drivers/usb/serial/keyspan.c 1.31 -> 1.32 # drivers/usb/serial/safe_serial.c 1.7 -> 1.8 # drivers/usb/serial/ftdi_sio.c 1.34 -> 1.35 # drivers/usb/serial/ipaq.c 1.16 -> 1.17 # drivers/usb/serial/visor.c 1.38 -> 1.39 # drivers/usb/serial/omninet.c 1.22 -> 1.23 # drivers/usb/serial/whiteheat.c 1.22 -> 1.23 # drivers/usb/serial/usbserial.c 1.39 -> 1.40 # drivers/usb/serial/io_ti.c 1.2 -> 1.3 # drivers/usb/serial/empeg.c 1.29 -> 1.30 # drivers/usb/serial/pl2303.c 1.23 -> 1.24 # drivers/usb/serial/ir-usb.c 1.19 -> 1.20 # drivers/usb/serial/digi_acceleport.c 1.25 -> 1.26 # drivers/usb/serial/kl5kusb105.c 1.12 -> 1.13 # drivers/usb/serial/belkin_sa.c 1.26 -> 1.27 # drivers/usb/serial/keyspan_pda.c 1.22 -> 1.23 # drivers/usb/serial/mct_u232.c 1.27 -> 1.28 # drivers/usb/serial/keyspan.h 1.12 -> 1.13 # drivers/usb/serial/cyberjack.c 1.18 -> 1.19 # drivers/usb/serial/usb-serial.h 1.11 -> 1.12 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/09/16 greg@kroah.com 1.579 # USB: convert usb-serial drivers to new driver model. # # This adds the requirement that the usb-serial drivers call # usb_register() and usb_unregister() themselves, instead of having # the usbserial.c file do it. Step one in moving the usbserial.c # code to being a "class" :) # -------------------------------------------- # diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c --- a/drivers/usb/serial/belkin_sa.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/belkin_sa.c Mon Sep 16 15:00:40 2002 @@ -115,6 +115,13 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver belkin_driver = { + .name = "belkin", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; + /* All of the device info needed for the serial converters */ static struct usb_serial_device_type belkin_device = { .owner = THIS_MODULE, @@ -527,6 +534,7 @@ static int __init belkin_sa_init (void) { usb_serial_register (&belkin_device); + usb_register (&belkin_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -534,6 +542,7 @@ static void __exit belkin_sa_exit (void) { + usb_deregister (&belkin_driver); usb_serial_deregister (&belkin_device); } diff -Nru a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c --- a/drivers/usb/serial/cyberjack.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/cyberjack.c Mon Sep 16 15:00:40 2002 @@ -73,6 +73,13 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver cyberjack_driver = { + .name = "cyberjack", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; + static struct usb_serial_device_type cyberjack_device = { .owner = THIS_MODULE, .name = "Reiner SCT Cyberjack USB card reader", @@ -461,6 +468,7 @@ static int __init cyberjack_init (void) { usb_serial_register (&cyberjack_device); + usb_register (&cyberjack_driver); info(DRIVER_VERSION " " DRIVER_AUTHOR); info(DRIVER_DESC); @@ -470,6 +478,7 @@ static void __exit cyberjack_exit (void) { + usb_deregister (&cyberjack_driver); usb_serial_deregister (&cyberjack_device); } diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c --- a/drivers/usb/serial/digi_acceleport.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/digi_acceleport.c Mon Sep 16 15:00:40 2002 @@ -477,7 +477,7 @@ /* Statics */ -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { { USB_DEVICE(DIGI_VENDOR_ID, DIGI_2_ID) }, { USB_DEVICE(DIGI_VENDOR_ID, DIGI_4_ID) }, { } /* Terminating entry */ @@ -495,6 +495,14 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver digi_driver = { + .name = "digi_acceleport", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; + + /* device info needed for the Digi serial converter */ static struct usb_serial_device_type digi_acceleport_2_device = { @@ -2025,6 +2033,7 @@ { usb_serial_register (&digi_acceleport_2_device); usb_serial_register (&digi_acceleport_4_device); + usb_register (&digi_driver); info(DRIVER_VERSION ":" DRIVER_DESC); return 0; } @@ -2032,6 +2041,7 @@ static void __exit digi_exit (void) { + usb_deregister (&digi_driver); usb_serial_deregister (&digi_acceleport_2_device); usb_serial_deregister (&digi_acceleport_4_device); } diff -Nru a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c --- a/drivers/usb/serial/empeg.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/empeg.c Mon Sep 16 15:00:40 2002 @@ -110,6 +110,13 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver empeg_driver = { + .name = "empeg", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; + static struct usb_serial_device_type empeg_device = { .owner = THIS_MODULE, .name = "Empeg", @@ -550,8 +557,6 @@ struct urb *urb; int i; - usb_serial_register (&empeg_device); - /* create our write urb pool and transfer buffers */ spin_lock_init (&write_urb_pool_lock); for (i = 0; i < NUM_URBS; ++i) { @@ -571,10 +576,12 @@ } } + usb_serial_register (&empeg_device); + usb_register (&empeg_driver); + info(DRIVER_VERSION ":" DRIVER_DESC); return 0; - } @@ -583,6 +590,7 @@ int i; unsigned long flags; + usb_register (&empeg_driver); usb_serial_deregister (&empeg_device); spin_lock_irqsave (&write_urb_pool_lock, flags); @@ -600,7 +608,6 @@ } spin_unlock_irqrestore (&write_urb_pool_lock, flags); - } diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c --- a/drivers/usb/serial/ftdi_sio.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/ftdi_sio.c Mon Sep 16 15:00:40 2002 @@ -140,7 +140,7 @@ }; -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, { USB_DEVICE(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID) }, @@ -149,6 +149,13 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver ftdi_driver = { + .name = "ftdi_sio", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; + struct ftdi_private { enum ftdi_type ftdi_type; @@ -944,6 +951,7 @@ dbg("%s", __FUNCTION__); usb_serial_register (&ftdi_sio_device); usb_serial_register (&ftdi_8U232AM_device); + usb_register (&ftdi_driver); info(DRIVER_VERSION ":" DRIVER_DESC); return 0; } @@ -952,6 +960,7 @@ static void __exit ftdi_sio_exit (void) { dbg("%s", __FUNCTION__); + usb_deregister (&ftdi_driver); usb_serial_deregister (&ftdi_sio_device); usb_serial_deregister (&ftdi_8U232AM_device); } diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c --- a/drivers/usb/serial/io_edgeport.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/io_edgeport.c Mon Sep 16 15:00:40 2002 @@ -457,6 +457,12 @@ #include "io_tables.h" /* all of the devices that this driver supports */ +static struct usb_driver io_driver = { + .name = "io_edgeport", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; /* function prototypes for all of our local functions */ static int process_rcvd_data (struct edgeport_serial *edge_serial, unsigned char *buffer, __u16 bufferLength); @@ -3050,6 +3056,7 @@ usb_serial_register (&edgeport_2port_device); usb_serial_register (&edgeport_4port_device); usb_serial_register (&edgeport_8port_device); + usb_register (&io_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -3062,6 +3069,7 @@ ****************************************************************************/ void __exit edgeport_exit (void) { + usb_deregister (&io_driver); usb_serial_deregister (&edgeport_1port_device); usb_serial_deregister (&edgeport_2port_device); usb_serial_deregister (&edgeport_4port_device); diff -Nru a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h --- a/drivers/usb/serial/io_tables.h Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/io_tables.h Mon Sep 16 15:00:40 2002 @@ -61,7 +61,7 @@ }; /* Devices that this driver supports */ -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_4) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_RAPIDPORT_4) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_4T) }, diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c --- a/drivers/usb/serial/io_ti.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/io_ti.c Mon Sep 16 15:00:40 2002 @@ -142,7 +142,7 @@ }; /* Devices that this driver supports */ -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_1) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2I) }, @@ -161,6 +161,13 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver io_driver = { + .name = "io_ti", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; + static struct EDGE_FIRMWARE_VERSION_INFO OperationalCodeImageVersion; @@ -2658,12 +2665,14 @@ { usb_serial_register (&edgeport_1port_device); usb_serial_register (&edgeport_2port_device); + usb_register (&io_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } static void __exit edgeport_exit (void) { + usb_deregister (&io_driver); usb_serial_deregister (&edgeport_1port_device); usb_serial_deregister (&edgeport_2port_device); } diff -Nru a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c --- a/drivers/usb/serial/ipaq.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/ipaq.c Mon Sep 16 15:00:40 2002 @@ -94,6 +94,14 @@ MODULE_DEVICE_TABLE (usb, ipaq_id_table); +static struct usb_driver ipaq_driver = { + .name = "ipaq", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = ipaq_id_table, +}; + + /* All of the device info needed for the Compaq iPAQ */ struct usb_serial_device_type ipaq_device = { .owner = THIS_MODULE, @@ -516,6 +524,7 @@ static int __init ipaq_init(void) { usb_serial_register(&ipaq_device); + usb_register(&ipaq_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; @@ -524,6 +533,7 @@ static void __exit ipaq_exit(void) { + usb_deregister(&ipaq_driver); usb_serial_deregister(&ipaq_device); } diff -Nru a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c --- a/drivers/usb/serial/ir-usb.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/ir-usb.c Mon Sep 16 15:00:40 2002 @@ -129,6 +129,13 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver ir_driver = { + .name = "ir-usb", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; + struct usb_serial_device_type ir_device = { .owner = THIS_MODULE, @@ -606,6 +613,7 @@ static int __init ir_init (void) { usb_serial_register (&ir_device); + usb_register (&ir_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -613,6 +621,7 @@ static void __exit ir_exit (void) { + usb_deregister (&ir_driver); usb_serial_deregister (&ir_device); } diff -Nru a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c --- a/drivers/usb/serial/keyspan.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/keyspan.c Mon Sep 16 15:00:40 2002 @@ -183,6 +183,7 @@ usb_serial_register (&keyspan_1port_device); usb_serial_register (&keyspan_2port_device); usb_serial_register (&keyspan_4port_device); + usb_register (&keyspan_driver); info(DRIVER_VERSION ":" DRIVER_DESC); @@ -191,6 +192,7 @@ static void __exit keyspan_exit (void) { + usb_deregister (&keyspan_driver); usb_serial_deregister (&keyspan_pre_device); usb_serial_deregister (&keyspan_1port_device); usb_serial_deregister (&keyspan_2port_device); diff -Nru a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h --- a/drivers/usb/serial/keyspan.h Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/keyspan.h Mon Sep 16 15:00:40 2002 @@ -408,7 +408,7 @@ NULL, }; -static __devinitdata struct usb_device_id keyspan_ids_combined[] = { +static struct usb_device_id keyspan_ids_combined[] = { { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) }, @@ -433,6 +433,13 @@ }; MODULE_DEVICE_TABLE(usb, keyspan_ids_combined); + +static struct usb_driver keyspan_driver = { + .name = "keyspan", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = keyspan_ids_combined, +}; /* usb_device_id table for the pre-firmware download keyspan devices */ static struct usb_device_id keyspan_pre_ids[] = { diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c --- a/drivers/usb/serial/keyspan_pda.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/keyspan_pda.c Mon Sep 16 15:00:40 2002 @@ -140,7 +140,7 @@ #define ENTREGRA_VENDOR_ID 0x1645 #define ENTREGRA_FAKE_ID 0x8093 -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { #ifdef KEYSPAN { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) }, #endif @@ -154,6 +154,13 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver keyspan_pda_driver = { + .name = "keyspan_pda", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; + static struct usb_device_id id_table_std [] = { { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) }, { } /* Terminating entry */ @@ -862,6 +869,7 @@ #ifdef XIRCOM usb_serial_register (&xircom_pgs_fake_device); #endif + usb_register (&keyspan_pda_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -869,6 +877,7 @@ static void __exit keyspan_pda_exit (void) { + usb_deregister (&keyspan_pda_driver); usb_serial_deregister (&keyspan_pda_device); #ifdef KEYSPAN usb_serial_deregister (&keyspan_pda_fake_device); diff -Nru a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c --- a/drivers/usb/serial/kl5kusb105.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/kl5kusb105.c Mon Sep 16 15:00:40 2002 @@ -117,6 +117,12 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver kl5kusb105d_driver = { + .name = "kl5kusb105d", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; static struct usb_serial_device_type kl5kusb105d_device = { .owner = THIS_MODULE, @@ -1009,6 +1015,7 @@ static int __init klsi_105_init (void) { usb_serial_register (&kl5kusb105d_device); + usb_register (&kl5kusb105d_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; @@ -1017,6 +1024,7 @@ static void __exit klsi_105_exit (void) { + usb_deregister (&kl5kusb105d_driver); usb_serial_deregister (&kl5kusb105d_device); } diff -Nru a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c --- a/drivers/usb/serial/mct_u232.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/mct_u232.c Mon Sep 16 15:00:40 2002 @@ -139,6 +139,12 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver mct_u232_driver = { + .name = "mct_u232", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; static struct usb_serial_device_type mct_u232_device = { .owner = THIS_MODULE, @@ -782,6 +788,7 @@ static int __init mct_u232_init (void) { usb_serial_register (&mct_u232_device); + usb_register (&mct_u232_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -789,6 +796,7 @@ static void __exit mct_u232_exit (void) { + usb_deregister (&mct_u232_driver); usb_serial_deregister (&mct_u232_device); } diff -Nru a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c --- a/drivers/usb/serial/omninet.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/omninet.c Mon Sep 16 15:00:40 2002 @@ -83,6 +83,13 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver omninet_driver = { + .name = "omninet", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; + static struct usb_serial_device_type zyxel_omninet_device = { .owner = THIS_MODULE, @@ -370,6 +377,7 @@ static int __init omninet_init (void) { usb_serial_register (&zyxel_omninet_device); + usb_register (&omninet_driver); info(DRIVER_VERSION ":" DRIVER_DESC); return 0; } @@ -377,6 +385,7 @@ static void __exit omninet_exit (void) { + usb_deregister (&omninet_driver); usb_serial_deregister (&zyxel_omninet_device); } diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c --- a/drivers/usb/serial/pl2303.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/pl2303.c Mon Sep 16 15:00:40 2002 @@ -78,6 +78,12 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver pl2303_driver = { + .name = "pl2303", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; #define SET_LINE_REQUEST_TYPE 0x21 #define SET_LINE_REQUEST 0x20 @@ -709,6 +715,7 @@ static int __init pl2303_init (void) { usb_serial_register (&pl2303_device); + usb_register (&pl2303_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -716,6 +723,7 @@ static void __exit pl2303_exit (void) { + usb_deregister (&pl2303_driver); usb_serial_deregister (&pl2303_device); } diff -Nru a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c --- a/drivers/usb/serial/safe_serial.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/safe_serial.c Mon Sep 16 15:00:40 2002 @@ -161,6 +161,13 @@ MODULE_DEVICE_TABLE (usb, id_table); +static struct usb_driver safe_driver = { + .name = "safe_serial", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; + static __u16 crc10_table[256] = { 0x000, 0x233, 0x255, 0x066, 0x299, 0x0aa, 0x0cc, 0x2ff, 0x301, 0x132, 0x154, 0x367, 0x198, 0x3ab, 0x3cd, 0x1fe, 0x031, 0x202, 0x264, 0x057, 0x2a8, 0x09b, 0x0fd, 0x2ce, 0x330, 0x103, 0x165, 0x356, 0x1a9, 0x39a, 0x3fc, 0x1cf, @@ -434,12 +441,14 @@ } usb_serial_register (&safe_device); + usb_register (&safe_driver); return 0; } static void __exit safe_exit (void) { + usb_deregister (&safe_driver); usb_serial_deregister (&safe_device); } diff -Nru a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h --- a/drivers/usb/serial/usb-serial.h Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/usb-serial.h Mon Sep 16 15:00:40 2002 @@ -233,6 +233,9 @@ extern int usb_serial_register(struct usb_serial_device_type *new_device); extern void usb_serial_deregister(struct usb_serial_device_type *device); +extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); +extern void usb_serial_disconnect(struct usb_interface *iface); + /* determine if we should include the EzUSB loader functions */ #undef USES_EZUSB_FUNCTIONS #if defined(CONFIG_USB_SERIAL_KEYSPAN_PDA) || defined(CONFIG_USB_SERIAL_KEYSPAN_PDA_MODULE) diff -Nru a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c --- a/drivers/usb/serial/usbserial.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/usbserial.c Mon Sep 16 15:00:40 2002 @@ -379,30 +379,23 @@ .num_ports = 1, .shutdown = generic_shutdown, }; -#endif - -/* local function prototypes */ -static int serial_open (struct tty_struct *tty, struct file * filp); -static void serial_close (struct tty_struct *tty, struct file * filp); -static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count); -static int serial_write_room (struct tty_struct *tty); -static int serial_chars_in_buffer (struct tty_struct *tty); -static void serial_throttle (struct tty_struct * tty); -static void serial_unthrottle (struct tty_struct * tty); -static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg); -static void serial_set_termios (struct tty_struct *tty, struct termios * old); -static void serial_shutdown (struct usb_serial *serial); - -static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum, - const struct usb_device_id *id); -static void usb_serial_disconnect(struct usb_device *dev, void *ptr); +/* we want to look at all devices, as the vendor/product id can change + * depending on the command line argument */ +static struct usb_device_id generic_serial_ids[] = { + {.driver_info = 42}, + {} +}; +#endif +/* Driver structure we register with the USB core */ static struct usb_driver usb_serial_driver = { .name = "serial", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, - .id_table = NULL, /* check all devices */ +#ifdef CONFIG_USB_SERIAL_GENERIC + .id_table = generic_serial_ids, +#endif }; /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead @@ -412,7 +405,6 @@ drivers depend on it. */ - static int serial_refcount; static struct tty_driver serial_tty_driver; static struct tty_struct * serial_tty[SERIAL_TTY_MINORS]; @@ -1161,12 +1153,12 @@ return serial; } -static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum, +int usb_serial_probe(struct usb_interface *interface, const struct usb_device_id *id) { + struct usb_device *dev = interface_to_usbdev (interface); struct usb_serial *serial = NULL; struct usb_serial_port *port; - struct usb_interface *interface; struct usb_interface_descriptor *iface_desc; struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *interrupt_in_endpoint[MAX_NUM_PORTS]; @@ -1189,7 +1181,6 @@ /* loop through our list of known serial converters, and see if this device matches. */ found = 0; - interface = &dev->actconfig->interface[ifnum]; list_for_each (tmp, &usb_serial_driver_list) { type = list_entry(tmp, struct usb_serial_device_type, driver_list); id_pattern = usb_match_id(interface, type->id_table); @@ -1202,13 +1193,13 @@ if (!found) { /* no match */ dbg("none matched"); - return(NULL); + return -ENODEV; } serial = create_serial (dev, interface, type); if (!serial) { err ("%s - out of memory", __FUNCTION__); - return NULL; + return -ENODEV; } /* if this device type has a probe function, call it */ @@ -1222,7 +1213,7 @@ if (retval < 0) { dbg ("sub driver rejected device"); kfree (serial); - return NULL; + return -ENODEV; } } @@ -1258,6 +1249,7 @@ } #if defined(CONFIG_USB_SERIAL_PL2303) || defined(CONFIG_USB_SERIAL_PL2303_MODULE) +#if 0 /* BEGIN HORRIBLE HACK FOR PL2303 */ /* this is needed due to the looney way its endpoints are set up */ if (ifnum == 1) { @@ -1282,6 +1274,7 @@ } /* END HORRIBLE HACK FOR PL2303 */ #endif +#endif /* found all that we need */ info("%s converter detected", type->name); @@ -1292,7 +1285,7 @@ if (num_ports == 0) { err("Generic device with no bulk out, not allowed."); kfree (serial); - return NULL; + return -EIO; } } #endif @@ -1312,7 +1305,7 @@ if (get_free_serial (serial, num_ports, &minor) == NULL) { err("No more free serial devices"); kfree (serial); - return NULL; + return -ENOMEM; } serial->minor = minor; @@ -1424,7 +1417,8 @@ if (retval > 0) { /* quietly accept this device, but don't bind to a serial port * as it's about to disappear */ - return serial; + dev_set_drvdata (&interface->dev, serial); + return 0; } } @@ -1455,7 +1449,9 @@ } #endif - return serial; /* success */ + /* success */ + dev_set_drvdata (&interface->dev, serial); + return 0; probe_error: @@ -1486,16 +1482,18 @@ /* free up any memory that we allocated */ kfree (serial); - return NULL; + return -EIO; } -static void usb_serial_disconnect(struct usb_device *dev, void *ptr) +void usb_serial_disconnect(struct usb_interface *interface) { - struct usb_serial *serial = (struct usb_serial *) ptr; + struct usb_serial *serial = dev_get_drvdata (&interface->dev); struct usb_serial_port *port; int i; dbg ("%s", __FUNCTION__); + + dev_set_drvdata (&interface->dev, NULL); if (serial) { /* fail all future close/read/write/ioctl/etc calls */ for (i = 0; i < serial->num_ports; ++i) { @@ -1554,10 +1552,8 @@ /* free up any memory that we allocated */ kfree (serial); - - } else { - info("device disconnected"); } + info("device disconnected"); } @@ -1663,8 +1659,6 @@ info ("USB Serial support registered for %s", new_device->name); - usb_scan_devices(); - return 0; } @@ -1681,7 +1675,7 @@ serial = serial_table[i]; if ((serial != NULL) && (serial->type == device)) { usb_driver_release_interface (&usb_serial_driver, serial->interface); - usb_serial_disconnect (NULL, serial); + usb_serial_disconnect (serial->interface); } } @@ -1694,6 +1688,8 @@ need these symbols to load properly as modules. */ EXPORT_SYMBOL(usb_serial_register); EXPORT_SYMBOL(usb_serial_deregister); +EXPORT_SYMBOL(usb_serial_probe); +EXPORT_SYMBOL(usb_serial_disconnect); #ifdef USES_EZUSB_FUNCTIONS EXPORT_SYMBOL(ezusb_writememory); EXPORT_SYMBOL(ezusb_set_reset); diff -Nru a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c --- a/drivers/usb/serial/visor.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/visor.c Mon Sep 16 15:00:40 2002 @@ -197,7 +197,7 @@ { } /* Terminating entry */ }; -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { { USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M500_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M505_ID) }, @@ -214,7 +214,12 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); - +static struct usb_driver visor_driver = { + .name = "visor", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; /* All of the device info needed for the Handspring Visor, and Palm 4.0 devices */ static struct usb_serial_device_type handspring_device = { @@ -763,6 +768,7 @@ { usb_serial_register (&handspring_device); usb_serial_register (&clie_3_5_device); + usb_register (&visor_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; @@ -771,6 +777,7 @@ static void __exit visor_exit (void) { + usb_deregister (&visor_driver); usb_serial_deregister (&handspring_device); usb_serial_deregister (&clie_3_5_device); } diff -Nru a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c --- a/drivers/usb/serial/whiteheat.c Mon Sep 16 15:00:40 2002 +++ b/drivers/usb/serial/whiteheat.c Mon Sep 16 15:00:40 2002 @@ -110,7 +110,7 @@ { } /* Terminating entry */ }; -static __devinitdata struct usb_device_id id_table_combined [] = { +static struct usb_device_id id_table_combined [] = { { USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_WHITE_HEAT_ID) }, { USB_DEVICE(CONNECT_TECH_VENDOR_ID, CONNECT_TECH_FAKE_WHITE_HEAT_ID) }, { } /* Terminating entry */ @@ -118,6 +118,13 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); +static struct usb_driver whiteheat_driver = { + .name = "whiteheat", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +}; + /* function prototypes for the Connect Tech WhiteHEAT serial converter */ static int whiteheat_open (struct usb_serial_port *port, struct file *filp); static void whiteheat_close (struct usb_serial_port *port, struct file *filp); @@ -674,6 +681,7 @@ { usb_serial_register (&whiteheat_fake_device); usb_serial_register (&whiteheat_device); + usb_register (&whiteheat_driver); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } @@ -681,6 +689,7 @@ static void __exit whiteheat_exit (void) { + usb_deregister (&whiteheat_driver); usb_serial_deregister (&whiteheat_fake_device); usb_serial_deregister (&whiteheat_device); }