Commit f61fbc71 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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"  :)
parent bfa414e2
......@@ -115,6 +115,13 @@ static struct usb_device_id id_table_combined [] = {
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 belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, un
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 int __init belkin_sa_init (void)
static void __exit belkin_sa_exit (void)
{
usb_deregister (&belkin_driver);
usb_serial_deregister (&belkin_device);
}
......
......@@ -73,6 +73,13 @@ static struct usb_device_id id_table [] = {
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 void cyberjack_write_bulk_callback (struct urb *urb)
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 int __init cyberjack_init (void)
static void __exit cyberjack_exit (void)
{
usb_deregister (&cyberjack_driver);
usb_serial_deregister (&cyberjack_device);
}
......
......@@ -477,7 +477,7 @@ static int digi_read_oob_callback( struct urb *urb );
/* 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 @@ static struct usb_device_id id_table_4 [] = {
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 @@ static int __init digi_init (void)
{
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 int __init digi_init (void)
static void __exit digi_exit (void)
{
usb_deregister (&digi_driver);
usb_serial_deregister (&digi_acceleport_2_device);
usb_serial_deregister (&digi_acceleport_4_device);
}
......
......@@ -110,6 +110,13 @@ static struct usb_device_id id_table [] = {
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 @@ static int __init empeg_init (void)
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 @@ static int __init empeg_init (void)
}
}
usb_serial_register (&empeg_device);
usb_register (&empeg_driver);
info(DRIVER_VERSION ":" DRIVER_DESC);
return 0;
}
......@@ -583,6 +590,7 @@ static void __exit empeg_exit (void)
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 @@ static void __exit empeg_exit (void)
}
spin_unlock_irqrestore (&write_urb_pool_lock, flags);
}
......
......@@ -140,7 +140,7 @@ static struct usb_device_id id_table_8U232AM [] = {
};
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 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
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 @@ static int __init ftdi_sio_init (void)
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 int __init ftdi_sio_init (void)
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);
}
......
......@@ -457,6 +457,12 @@ static void edge_shutdown (struct usb_serial *serial);
#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 @@ int __init edgeport_init(void)
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 @@ int __init edgeport_init(void)
****************************************************************************/
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);
......
......@@ -61,7 +61,7 @@ static struct usb_device_id edgeport_8port_id_table [] = {
};
/* 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) },
......
......@@ -142,7 +142,7 @@ static struct usb_device_id edgeport_2port_id_table [] = {
};
/* 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 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
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 @@ static int __init edgeport_init(void)
{
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);
}
......
......@@ -94,6 +94,14 @@ static struct usb_device_id ipaq_id_table [] = {
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 void ipaq_shutdown(struct usb_serial *serial)
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 int __init ipaq_init(void)
static void __exit ipaq_exit(void)
{
usb_deregister(&ipaq_driver);
usb_serial_deregister(&ipaq_device);
}
......
......@@ -129,6 +129,13 @@ static struct usb_device_id id_table [] = {
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 void ir_set_termios (struct usb_serial_port *port, struct termios *old_te
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 int __init ir_init (void)
static void __exit ir_exit (void)
{
usb_deregister (&ir_driver);
usb_serial_deregister (&ir_device);
}
......
......@@ -183,6 +183,7 @@ static int __init keyspan_init (void)
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 int __init keyspan_init (void)
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);
......
......@@ -408,7 +408,7 @@ static const struct keyspan_device_details *keyspan_devices[] = {
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) },
......@@ -434,6 +434,13 @@ static __devinitdata struct usb_device_id keyspan_ids_combined[] = {
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[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
......
......@@ -140,7 +140,7 @@ struct keyspan_pda_private {
#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 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
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 @@ static int __init keyspan_pda_init (void)
#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 int __init keyspan_pda_init (void)
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);
......
......@@ -117,6 +117,12 @@ static struct usb_device_id id_table [] = {
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 void klsi_105_unthrottle (struct usb_serial_port *port)
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 int __init klsi_105_init (void)
static void __exit klsi_105_exit (void)
{
usb_deregister (&kl5kusb105d_driver);
usb_serial_deregister (&kl5kusb105d_device);
}
......
......@@ -139,6 +139,12 @@ static struct usb_device_id id_table_combined [] = {
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 mct_u232_ioctl (struct usb_serial_port *port, struct file * file,
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 int __init mct_u232_init (void)
static void __exit mct_u232_exit (void)
{
usb_deregister (&mct_u232_driver);
usb_serial_deregister (&mct_u232_device);
}
......
......@@ -83,6 +83,13 @@ static struct usb_device_id id_table [] = {
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 void omninet_shutdown (struct usb_serial *serial)
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 int __init omninet_init (void)
static void __exit omninet_exit (void)
{
usb_deregister (&omninet_driver);
usb_serial_deregister (&zyxel_omninet_device);
}
......
......@@ -78,6 +78,12 @@ static struct usb_device_id id_table [] = {
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 void pl2303_write_bulk_callback (struct urb *urb)
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 int __init pl2303_init (void)
static void __exit pl2303_exit (void)
{
usb_deregister (&pl2303_driver);
usb_serial_deregister (&pl2303_device);
}
......
......@@ -161,6 +161,13 @@ static struct usb_device_id id_table[] = {
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 @@ static int __init safe_init (void)
}
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);
}
......
......@@ -233,6 +233,9 @@ struct usb_serial_device_type {
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)
......
......@@ -379,30 +379,23 @@ static struct usb_serial_device_type generic_device = {
.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 @@ static struct usb_driver usb_serial_driver = {
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 @@ static struct usb_serial * create_serial (struct usb_device *dev,
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 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
/* 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 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
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 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
if (retval < 0) {
dbg ("sub driver rejected device");
kfree (serial);
return NULL;
return -ENODEV;
}
}
......@@ -1258,6 +1249,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
}
#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) {
......@@ -1281,6 +1273,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
}
}
/* END HORRIBLE HACK FOR PL2303 */
#endif
#endif
/* found all that we need */
......@@ -1292,7 +1285,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
if (num_ports == 0) {
err("Generic device with no bulk out, not allowed.");
kfree (serial);
return NULL;
return -EIO;
}
}
#endif
......@@ -1312,7 +1305,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
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 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
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 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
}
#endif
return serial; /* success */
/* success */
dev_set_drvdata (&interface->dev, serial);
return 0;
probe_error:
......@@ -1486,16 +1482,18 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
/* 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 @@ static void usb_serial_disconnect(struct usb_device *dev, void *ptr)
/* free up any memory that we allocated */
kfree (serial);
} else {
info("device disconnected");
}
info("device disconnected");
}
......@@ -1663,8 +1659,6 @@ int usb_serial_register(struct usb_serial_device_type *new_device)
info ("USB Serial support registered for %s", new_device->name);
usb_scan_devices();
return 0;
}
......@@ -1681,7 +1675,7 @@ void usb_serial_deregister(struct usb_serial_device_type *device)
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 @@ void usb_serial_deregister(struct usb_serial_device_type *device)
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);
......
......@@ -197,7 +197,7 @@ static struct usb_device_id clie_id_3_5_table [] = {
{ } /* 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 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
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 @@ static int __init visor_init (void)
{
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 int __init visor_init (void)
static void __exit visor_exit (void)
{
usb_deregister (&visor_driver);
usb_serial_deregister (&handspring_device);
usb_serial_deregister (&clie_3_5_device);
}
......
......@@ -110,7 +110,7 @@ static struct usb_device_id id_table_prerenumeration [] = {
{ } /* 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 @@ static __devinitdata struct usb_device_id id_table_combined [] = {
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 @@ static int __init whiteheat_init (void)
{
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 int __init whiteheat_init (void)
static void __exit whiteheat_exit (void)
{
usb_deregister (&whiteheat_driver);
usb_serial_deregister (&whiteheat_fake_device);
usb_serial_deregister (&whiteheat_device);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment