mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 18:23:53 +08:00
usb-serial: use new registration API in [t-z]* drivers
This patch (as1529) modifies the following usb-serial drivers to utilize the new usb_serial_{de}register_drivers() routines: ti_usb_3410_5052, usb_debug, visor, vivopay-serial, whiteheat, and zio. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d860322f34
commit
29618e9fb5
@ -216,7 +216,6 @@ static struct usb_driver ti_usb_driver = {
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.id_table = ti_id_table_combined,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver ti_1port_device = {
|
||||
@ -225,7 +224,6 @@ static struct usb_serial_driver ti_1port_device = {
|
||||
.name = "ti_usb_3410_5052_1",
|
||||
},
|
||||
.description = "TI USB 3410 1 port adapter",
|
||||
.usb_driver = &ti_usb_driver,
|
||||
.id_table = ti_id_table_3410,
|
||||
.num_ports = 1,
|
||||
.attach = ti_startup,
|
||||
@ -254,7 +252,6 @@ static struct usb_serial_driver ti_2port_device = {
|
||||
.name = "ti_usb_3410_5052_2",
|
||||
},
|
||||
.description = "TI USB 5052 2 port adapter",
|
||||
.usb_driver = &ti_usb_driver,
|
||||
.id_table = ti_id_table_5052,
|
||||
.num_ports = 2,
|
||||
.attach = ti_startup,
|
||||
@ -277,6 +274,9 @@ static struct usb_serial_driver ti_2port_device = {
|
||||
.write_bulk_callback = ti_bulk_out_callback,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver * const serial_drivers[] = {
|
||||
&ti_1port_device, &ti_2port_device, NULL
|
||||
};
|
||||
|
||||
/* Module */
|
||||
|
||||
@ -344,36 +344,17 @@ static int __init ti_init(void)
|
||||
ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
|
||||
}
|
||||
|
||||
ret = usb_serial_register(&ti_1port_device);
|
||||
if (ret)
|
||||
goto failed_1port;
|
||||
ret = usb_serial_register(&ti_2port_device);
|
||||
if (ret)
|
||||
goto failed_2port;
|
||||
|
||||
ret = usb_register(&ti_usb_driver);
|
||||
if (ret)
|
||||
goto failed_usb;
|
||||
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
|
||||
TI_DRIVER_DESC "\n");
|
||||
|
||||
return 0;
|
||||
|
||||
failed_usb:
|
||||
usb_serial_deregister(&ti_2port_device);
|
||||
failed_2port:
|
||||
usb_serial_deregister(&ti_1port_device);
|
||||
failed_1port:
|
||||
ret = usb_serial_register_drivers(&ti_usb_driver, serial_drivers);
|
||||
if (ret == 0)
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
|
||||
TI_DRIVER_DESC "\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void __exit ti_exit(void)
|
||||
{
|
||||
usb_deregister(&ti_usb_driver);
|
||||
usb_serial_deregister(&ti_1port_device);
|
||||
usb_serial_deregister(&ti_2port_device);
|
||||
usb_serial_deregister_drivers(&ti_usb_driver, serial_drivers);
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,6 @@ static struct usb_driver debug_driver = {
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.id_table = id_table,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
/* This HW really does not support a serial break, so one will be
|
||||
@ -74,30 +73,24 @@ static struct usb_serial_driver debug_device = {
|
||||
.name = "debug",
|
||||
},
|
||||
.id_table = id_table,
|
||||
.usb_driver = &debug_driver,
|
||||
.num_ports = 1,
|
||||
.bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE,
|
||||
.break_ctl = usb_debug_break_ctl,
|
||||
.process_read_urb = usb_debug_process_read_urb,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver * const serial_drivers[] = {
|
||||
&debug_device, NULL
|
||||
};
|
||||
|
||||
static int __init debug_init(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = usb_serial_register(&debug_device);
|
||||
if (retval)
|
||||
return retval;
|
||||
retval = usb_register(&debug_driver);
|
||||
if (retval)
|
||||
usb_serial_deregister(&debug_device);
|
||||
return retval;
|
||||
return usb_serial_register_drivers(&debug_driver, serial_drivers);
|
||||
}
|
||||
|
||||
static void __exit debug_exit(void)
|
||||
{
|
||||
usb_deregister(&debug_driver);
|
||||
usb_serial_deregister(&debug_device);
|
||||
usb_serial_deregister_drivers(&debug_driver, serial_drivers);
|
||||
}
|
||||
|
||||
module_init(debug_init);
|
||||
|
@ -173,7 +173,6 @@ static struct usb_driver visor_driver = {
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.id_table = id_table_combined,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
/* All of the device info needed for the Handspring Visor,
|
||||
@ -184,7 +183,6 @@ static struct usb_serial_driver handspring_device = {
|
||||
.name = "visor",
|
||||
},
|
||||
.description = "Handspring Visor / Palm OS",
|
||||
.usb_driver = &visor_driver,
|
||||
.id_table = id_table,
|
||||
.num_ports = 2,
|
||||
.bulk_out_size = 256,
|
||||
@ -205,7 +203,6 @@ static struct usb_serial_driver clie_5_device = {
|
||||
.name = "clie_5",
|
||||
},
|
||||
.description = "Sony Clie 5.0",
|
||||
.usb_driver = &visor_driver,
|
||||
.id_table = clie_id_5_table,
|
||||
.num_ports = 2,
|
||||
.bulk_out_size = 256,
|
||||
@ -226,7 +223,6 @@ static struct usb_serial_driver clie_3_5_device = {
|
||||
.name = "clie_3.5",
|
||||
},
|
||||
.description = "Sony Clie 3.5",
|
||||
.usb_driver = &visor_driver,
|
||||
.id_table = clie_id_3_5_table,
|
||||
.num_ports = 1,
|
||||
.bulk_out_size = 256,
|
||||
@ -237,6 +233,10 @@ static struct usb_serial_driver clie_3_5_device = {
|
||||
.attach = clie_3_5_startup,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver * const serial_drivers[] = {
|
||||
&handspring_device, &clie_5_device, &clie_3_5_device, NULL
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Handspring Visor specific driver functions
|
||||
******************************************************************************/
|
||||
@ -685,38 +685,17 @@ static int __init visor_init(void)
|
||||
": Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x\n",
|
||||
vendor, product);
|
||||
}
|
||||
retval = usb_serial_register(&handspring_device);
|
||||
if (retval)
|
||||
goto failed_handspring_register;
|
||||
retval = usb_serial_register(&clie_3_5_device);
|
||||
if (retval)
|
||||
goto failed_clie_3_5_register;
|
||||
retval = usb_serial_register(&clie_5_device);
|
||||
if (retval)
|
||||
goto failed_clie_5_register;
|
||||
retval = usb_register(&visor_driver);
|
||||
if (retval)
|
||||
goto failed_usb_register;
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
|
||||
|
||||
return 0;
|
||||
failed_usb_register:
|
||||
usb_serial_deregister(&clie_5_device);
|
||||
failed_clie_5_register:
|
||||
usb_serial_deregister(&clie_3_5_device);
|
||||
failed_clie_3_5_register:
|
||||
usb_serial_deregister(&handspring_device);
|
||||
failed_handspring_register:
|
||||
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_deregister(&visor_driver);
|
||||
usb_serial_deregister(&handspring_device);
|
||||
usb_serial_deregister(&clie_3_5_device);
|
||||
usb_serial_deregister(&clie_5_device);
|
||||
usb_serial_deregister_drivers(&visor_driver, serial_drivers);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,6 @@ static struct usb_driver vivopay_serial_driver = {
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.id_table = id_table,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver vivopay_serial_device = {
|
||||
@ -39,32 +38,28 @@ static struct usb_serial_driver vivopay_serial_device = {
|
||||
.name = "vivopay-serial",
|
||||
},
|
||||
.id_table = id_table,
|
||||
.usb_driver = &vivopay_serial_driver,
|
||||
.num_ports = 1,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver * const serial_drivers[] = {
|
||||
&vivopay_serial_device, NULL
|
||||
};
|
||||
|
||||
static int __init vivopay_serial_init(void)
|
||||
{
|
||||
int retval;
|
||||
retval = usb_serial_register(&vivopay_serial_device);
|
||||
if (retval)
|
||||
goto failed_usb_serial_register;
|
||||
retval = usb_register(&vivopay_serial_driver);
|
||||
if (retval)
|
||||
goto failed_usb_register;
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
|
||||
DRIVER_DESC "\n");
|
||||
return 0;
|
||||
failed_usb_register:
|
||||
usb_serial_deregister(&vivopay_serial_device);
|
||||
failed_usb_serial_register:
|
||||
|
||||
retval = usb_serial_register_drivers(&vivopay_serial_driver,
|
||||
serial_drivers);
|
||||
if (retval == 0)
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
|
||||
DRIVER_DESC "\n");
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void __exit vivopay_serial_exit(void)
|
||||
{
|
||||
usb_deregister(&vivopay_serial_driver);
|
||||
usb_serial_deregister(&vivopay_serial_device);
|
||||
usb_serial_deregister_drivers(&vivopay_serial_driver, serial_drivers);
|
||||
}
|
||||
|
||||
module_init(vivopay_serial_init);
|
||||
|
@ -83,7 +83,6 @@ static struct usb_driver whiteheat_driver = {
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.id_table = id_table_combined,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
/* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */
|
||||
@ -121,7 +120,6 @@ static struct usb_serial_driver whiteheat_fake_device = {
|
||||
.name = "whiteheatnofirm",
|
||||
},
|
||||
.description = "Connect Tech - WhiteHEAT - (prerenumeration)",
|
||||
.usb_driver = &whiteheat_driver,
|
||||
.id_table = id_table_prerenumeration,
|
||||
.num_ports = 1,
|
||||
.probe = whiteheat_firmware_download,
|
||||
@ -134,7 +132,6 @@ static struct usb_serial_driver whiteheat_device = {
|
||||
.name = "whiteheat",
|
||||
},
|
||||
.description = "Connect Tech - WhiteHEAT",
|
||||
.usb_driver = &whiteheat_driver,
|
||||
.id_table = id_table_std,
|
||||
.num_ports = 4,
|
||||
.attach = whiteheat_attach,
|
||||
@ -155,6 +152,9 @@ static struct usb_serial_driver whiteheat_device = {
|
||||
.write_bulk_callback = whiteheat_write_callback,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver * const serial_drivers[] = {
|
||||
&whiteheat_fake_device, &whiteheat_device, NULL
|
||||
};
|
||||
|
||||
struct whiteheat_command_private {
|
||||
struct mutex mutex;
|
||||
@ -1461,32 +1461,18 @@ out:
|
||||
static int __init whiteheat_init(void)
|
||||
{
|
||||
int retval;
|
||||
retval = usb_serial_register(&whiteheat_fake_device);
|
||||
if (retval)
|
||||
goto failed_fake_register;
|
||||
retval = usb_serial_register(&whiteheat_device);
|
||||
if (retval)
|
||||
goto failed_device_register;
|
||||
retval = usb_register(&whiteheat_driver);
|
||||
if (retval)
|
||||
goto failed_usb_register;
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
|
||||
DRIVER_DESC "\n");
|
||||
return 0;
|
||||
failed_usb_register:
|
||||
usb_serial_deregister(&whiteheat_device);
|
||||
failed_device_register:
|
||||
usb_serial_deregister(&whiteheat_fake_device);
|
||||
failed_fake_register:
|
||||
|
||||
retval = usb_serial_register_drivers(&whiteheat_driver, serial_drivers);
|
||||
if (retval == 0)
|
||||
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
|
||||
DRIVER_DESC "\n");
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static void __exit whiteheat_exit(void)
|
||||
{
|
||||
usb_deregister(&whiteheat_driver);
|
||||
usb_serial_deregister(&whiteheat_fake_device);
|
||||
usb_serial_deregister(&whiteheat_device);
|
||||
usb_serial_deregister_drivers(&whiteheat_driver, serial_drivers);
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@ static struct usb_driver zio_driver = {
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.id_table = id_table,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver zio_device = {
|
||||
@ -36,27 +35,21 @@ static struct usb_serial_driver zio_device = {
|
||||
.name = "zio",
|
||||
},
|
||||
.id_table = id_table,
|
||||
.usb_driver = &zio_driver,
|
||||
.num_ports = 1,
|
||||
};
|
||||
|
||||
static struct usb_serial_driver * const serial_drivers[] = {
|
||||
&zio_device, NULL
|
||||
};
|
||||
|
||||
static int __init zio_init(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval = usb_serial_register(&zio_device);
|
||||
if (retval)
|
||||
return retval;
|
||||
retval = usb_register(&zio_driver);
|
||||
if (retval)
|
||||
usb_serial_deregister(&zio_device);
|
||||
return retval;
|
||||
return usb_serial_register_drivers(&zio_driver, serial_drivers);
|
||||
}
|
||||
|
||||
static void __exit zio_exit(void)
|
||||
{
|
||||
usb_deregister(&zio_driver);
|
||||
usb_serial_deregister(&zio_device);
|
||||
usb_serial_deregister_drivers(&zio_driver, serial_drivers);
|
||||
}
|
||||
|
||||
module_init(zio_init);
|
||||
|
Loading…
Reference in New Issue
Block a user