]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/usb/serial/visor.c
USB: serial: remove usb_serial_disconnect call in all drivers
[linux-beck.git] / drivers / usb / serial / visor.c
index 71d696474f24d500ecd59af248a1e7f6e4dd0282..2e24bd34754cd37e1a6773360a1f170ace1fb61a 100644 (file)
@@ -53,8 +53,6 @@ static int palm_os_4_probe(struct usb_serial *serial,
 
 /* Parameters that may be passed into the module. */
 static bool debug;
-static __u16 vendor;
-static __u16 product;
 
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID),
@@ -115,14 +113,12 @@ static struct usb_device_id id_table [] = {
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
        { USB_DEVICE(FOSSIL_VENDOR_ID, FOSSIL_ABACUS_ID),
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
-       { },                                    /* optional parameter entry */
        { }                                     /* Terminating entry */
 };
 
 static struct usb_device_id clie_id_5_table [] = {
        { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_UX50_ID),
                .driver_info = (kernel_ulong_t)&palm_os_4_probe },
-       { },                                    /* optional parameter entry */
        { }                                     /* Terminating entry */
 };
 
@@ -162,7 +158,6 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) },
        { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) },
        { USB_DEVICE(FOSSIL_VENDOR_ID, FOSSIL_ABACUS_ID) },
-       { },                                    /* optional parameter entry */
        { }                                     /* Terminating entry */
 };
 
@@ -170,8 +165,6 @@ 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,
 };
 
@@ -244,8 +237,6 @@ static int visor_open(struct tty_struct *tty, struct usb_serial_port *port)
 {
        int result = 0;
 
-       dbg("%s - port %d", __func__, port->number);
-
        if (!port->read_urb) {
                /* this is needed for some brain dead Sony devices */
                dev_err(&port->dev, "Device lied about number of ports, please use a lower one.\n");
@@ -258,7 +249,7 @@ static int visor_open(struct tty_struct *tty, struct usb_serial_port *port)
                goto exit;
 
        if (port->interrupt_in_urb) {
-               dbg("%s - adding interrupt input for treo", __func__);
+               dev_dbg(&port->dev, "adding interrupt input for treo\n");
                result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
                if (result)
                        dev_err(&port->dev,
@@ -274,8 +265,6 @@ static void visor_close(struct usb_serial_port *port)
 {
        unsigned char *transfer_buffer;
 
-       dbg("%s - port %d", __func__, port->number);
-
        /* shutdown our urbs */
        usb_serial_generic_close(port);
        usb_kill_urb(port->interrupt_in_urb);
@@ -310,12 +299,12 @@ static void visor_read_int_callback(struct urb *urb)
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
-               dbg("%s - urb shutting down with status: %d",
-                   __func__, status);
+               dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n",
+                       __func__, status);
                return;
        default:
-               dbg("%s - nonzero urb status received: %d",
-                   __func__, status);
+               dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n",
+                       __func__, status);
                goto exit;
        }
 
@@ -348,8 +337,6 @@ static int palm_os_3_probe(struct usb_serial *serial,
        int i;
        int num_ports = 0;
 
-       dbg("%s", __func__);
-
        transfer_buffer = kmalloc(sizeof(*connection_info), GFP_KERNEL);
        if (!transfer_buffer) {
                dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__,
@@ -445,8 +432,6 @@ static int palm_os_4_probe(struct usb_serial *serial,
        unsigned char *transfer_buffer;
        int retval;
 
-       dbg("%s", __func__);
-
        transfer_buffer =  kmalloc(sizeof(*connection_info), GFP_KERNEL);
        if (!transfer_buffer) {
                dev_err(dev, "%s - kmalloc(%Zd) failed.\n", __func__,
@@ -478,8 +463,6 @@ static int visor_probe(struct usb_serial *serial,
        int (*startup)(struct usb_serial *serial,
                                        const struct usb_device_id *id);
 
-       dbg("%s", __func__);
-
        /*
         * some Samsung Android phones in modem mode have the same ID
         * as SPH-I500, but they are ACM devices, so dont bind to them
@@ -521,8 +504,6 @@ static int clie_3_5_startup(struct usb_serial *serial)
        int result;
        u8 *data;
 
-       dbg("%s", __func__);
-
        data = kmalloc(1, GFP_KERNEL);
        if (!data)
                return -ENOMEM;
@@ -585,8 +566,6 @@ static int treo_attach(struct usb_serial *serial)
                (serial->num_interrupt_in == 0))
                return 0;
 
-       dbg("%s", __func__);
-
        /*
        * It appears that Treos and Kyoceras want to use the
        * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint,
@@ -622,8 +601,6 @@ static int clie_5_attach(struct usb_serial *serial)
        unsigned int pipe;
        int j;
 
-       dbg("%s", __func__);
-
        /* TH55 registers 2 ports.
           Communication in from the UX50/TH55 uses bulk_in_endpointAddress
           from port 0. Communication out to the UX50/TH55 uses
@@ -648,59 +625,7 @@ static int clie_5_attach(struct usb_serial *serial)
        return 0;
 }
 
-static int __init visor_init(void)
-{
-       int i, retval;
-       /* Only if parameters were passed to us */
-       if (vendor > 0 && product > 0) {
-               struct usb_device_id usb_dev_temp[] = {
-                       {
-                               USB_DEVICE(vendor, product),
-                               .driver_info =
-                                       (kernel_ulong_t) &palm_os_4_probe
-                       }
-               };
-
-               /* Find the last entry in id_table */
-               for (i = 0;; i++) {
-                       if (id_table[i].idVendor == 0) {
-                               id_table[i] = usb_dev_temp[0];
-                               break;
-                       }
-               }
-               /* Find the last entry in id_table_combined */
-               for (i = 0;; i++) {
-                       if (id_table_combined[i].idVendor == 0) {
-                               id_table_combined[i] = usb_dev_temp[0];
-                               break;
-                       }
-               }
-               printk(KERN_INFO KBUILD_MODNAME
-                      ": Untested USB device specified at time of module insertion\n");
-               printk(KERN_INFO KBUILD_MODNAME
-                      ": Warning: This is not guaranteed to work\n");
-               printk(KERN_INFO KBUILD_MODNAME
-                      ": Using a newer kernel is preferred to this method\n");
-               printk(KERN_INFO KBUILD_MODNAME
-                      ": Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x\n",
-                       vendor, product);
-       }
-
-       retval = usb_serial_register_drivers(&visor_driver, serial_drivers);
-       if (retval == 0)
-               printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
-       return retval;
-}
-
-
-static void __exit visor_exit (void)
-{
-       usb_serial_deregister_drivers(&visor_driver, serial_drivers);
-}
-
-
-module_init(visor_init);
-module_exit(visor_exit);
+module_usb_serial_driver(visor_driver, serial_drivers);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
@@ -708,9 +633,3 @@ MODULE_LICENSE("GPL");
 
 module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
-
-module_param(vendor, ushort, 0);
-MODULE_PARM_DESC(vendor, "User specified vendor ID");
-module_param(product, ushort, 0);
-MODULE_PARM_DESC(product, "User specified product ID");
-