Commit f667ddad authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

usb-serial: use new registration API in [n-p]* drivers

This patch (as1527) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

	navman, omninet, opticon, option, oti6858, and pl2303.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d2a7aff
...@@ -35,7 +35,6 @@ static struct usb_driver navman_driver = { ...@@ -35,7 +35,6 @@ static struct usb_driver navman_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1,
}; };
static void navman_read_int_callback(struct urb *urb) static void navman_read_int_callback(struct urb *urb)
...@@ -122,7 +121,6 @@ static struct usb_serial_driver navman_device = { ...@@ -122,7 +121,6 @@ static struct usb_serial_driver navman_device = {
.name = "navman", .name = "navman",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &navman_driver,
.num_ports = 1, .num_ports = 1,
.open = navman_open, .open = navman_open,
.close = navman_close, .close = navman_close,
...@@ -130,23 +128,18 @@ static struct usb_serial_driver navman_device = { ...@@ -130,23 +128,18 @@ static struct usb_serial_driver navman_device = {
.read_int_callback = navman_read_int_callback, .read_int_callback = navman_read_int_callback,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&navman_device, NULL
};
static int __init navman_init(void) static int __init navman_init(void)
{ {
int retval; return usb_serial_register_drivers(&navman_driver, serial_drivers);
retval = usb_serial_register(&navman_device);
if (retval)
return retval;
retval = usb_register(&navman_driver);
if (retval)
usb_serial_deregister(&navman_device);
return retval;
} }
static void __exit navman_exit(void) static void __exit navman_exit(void)
{ {
usb_deregister(&navman_driver); usb_serial_deregister_drivers(&navman_driver, serial_drivers);
usb_serial_deregister(&navman_device);
} }
module_init(navman_init); module_init(navman_init);
......
...@@ -62,7 +62,6 @@ static struct usb_driver omninet_driver = { ...@@ -62,7 +62,6 @@ static struct usb_driver omninet_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1,
}; };
...@@ -72,7 +71,6 @@ static struct usb_serial_driver zyxel_omninet_device = { ...@@ -72,7 +71,6 @@ static struct usb_serial_driver zyxel_omninet_device = {
.name = "omninet", .name = "omninet",
}, },
.description = "ZyXEL - omni.net lcd plus usb", .description = "ZyXEL - omni.net lcd plus usb",
.usb_driver = &omninet_driver,
.id_table = id_table, .id_table = id_table,
.num_ports = 1, .num_ports = 1,
.attach = omninet_attach, .attach = omninet_attach,
...@@ -86,6 +84,10 @@ static struct usb_serial_driver zyxel_omninet_device = { ...@@ -86,6 +84,10 @@ static struct usb_serial_driver zyxel_omninet_device = {
.release = omninet_release, .release = omninet_release,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&zyxel_omninet_device, NULL
};
/* The protocol. /* The protocol.
* *
...@@ -323,26 +325,18 @@ static void omninet_release(struct usb_serial *serial) ...@@ -323,26 +325,18 @@ static void omninet_release(struct usb_serial *serial)
static int __init omninet_init(void) static int __init omninet_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&zyxel_omninet_device);
if (retval) retval = usb_serial_register_drivers(&omninet_driver, serial_drivers);
goto failed_usb_serial_register; if (retval == 0)
retval = usb_register(&omninet_driver); printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
if (retval) DRIVER_DESC "\n");
goto failed_usb_register;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return 0;
failed_usb_register:
usb_serial_deregister(&zyxel_omninet_device);
failed_usb_serial_register:
return retval; return retval;
} }
static void __exit omninet_exit(void) static void __exit omninet_exit(void)
{ {
usb_deregister(&omninet_driver); usb_serial_deregister_drivers(&omninet_driver, serial_drivers);
usb_serial_deregister(&zyxel_omninet_device);
} }
......
...@@ -604,7 +604,6 @@ static struct usb_driver opticon_driver = { ...@@ -604,7 +604,6 @@ static struct usb_driver opticon_driver = {
.suspend = opticon_suspend, .suspend = opticon_suspend,
.resume = opticon_resume, .resume = opticon_resume,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1,
}; };
static struct usb_serial_driver opticon_device = { static struct usb_serial_driver opticon_device = {
...@@ -613,7 +612,6 @@ static struct usb_serial_driver opticon_device = { ...@@ -613,7 +612,6 @@ static struct usb_serial_driver opticon_device = {
.name = "opticon", .name = "opticon",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &opticon_driver,
.num_ports = 1, .num_ports = 1,
.attach = opticon_startup, .attach = opticon_startup,
.open = opticon_open, .open = opticon_open,
...@@ -629,23 +627,18 @@ static struct usb_serial_driver opticon_device = { ...@@ -629,23 +627,18 @@ static struct usb_serial_driver opticon_device = {
.tiocmset = opticon_tiocmset, .tiocmset = opticon_tiocmset,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&opticon_device, NULL
};
static int __init opticon_init(void) static int __init opticon_init(void)
{ {
int retval; return usb_serial_register_drivers(&opticon_driver, serial_drivers);
retval = usb_serial_register(&opticon_device);
if (retval)
return retval;
retval = usb_register(&opticon_driver);
if (retval)
usb_serial_deregister(&opticon_device);
return retval;
} }
static void __exit opticon_exit(void) static void __exit opticon_exit(void)
{ {
usb_deregister(&opticon_driver); usb_serial_deregister_drivers(&opticon_driver, serial_drivers);
usb_serial_deregister(&opticon_device);
} }
module_init(opticon_init); module_init(opticon_init);
......
...@@ -1212,7 +1212,6 @@ static struct usb_driver option_driver = { ...@@ -1212,7 +1212,6 @@ static struct usb_driver option_driver = {
.supports_autosuspend = 1, .supports_autosuspend = 1,
#endif #endif
.id_table = option_ids, .id_table = option_ids,
.no_dynamic_id = 1,
}; };
/* The card has three separate interfaces, which the serial driver /* The card has three separate interfaces, which the serial driver
...@@ -1225,7 +1224,6 @@ static struct usb_serial_driver option_1port_device = { ...@@ -1225,7 +1224,6 @@ static struct usb_serial_driver option_1port_device = {
.name = "option1", .name = "option1",
}, },
.description = "GSM modem (1-port)", .description = "GSM modem (1-port)",
.usb_driver = &option_driver,
.id_table = option_ids, .id_table = option_ids,
.num_ports = 1, .num_ports = 1,
.probe = option_probe, .probe = option_probe,
...@@ -1249,6 +1247,10 @@ static struct usb_serial_driver option_1port_device = { ...@@ -1249,6 +1247,10 @@ static struct usb_serial_driver option_1port_device = {
#endif #endif
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&option_1port_device, NULL
};
static bool debug; static bool debug;
/* per port private data */ /* per port private data */
...@@ -1284,28 +1286,17 @@ struct option_port_private { ...@@ -1284,28 +1286,17 @@ struct option_port_private {
static int __init option_init(void) static int __init option_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&option_1port_device);
if (retval)
goto failed_1port_device_register;
retval = usb_register(&option_driver);
if (retval)
goto failed_driver_register;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return 0;
failed_driver_register: retval = usb_serial_register_drivers(&option_driver, serial_drivers);
usb_serial_deregister(&option_1port_device); if (retval == 0)
failed_1port_device_register: printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval; return retval;
} }
static void __exit option_exit(void) static void __exit option_exit(void)
{ {
usb_deregister(&option_driver); usb_serial_deregister_drivers(&option_driver, serial_drivers);
usb_serial_deregister(&option_1port_device);
} }
module_init(option_init); module_init(option_init);
......
...@@ -71,7 +71,6 @@ static struct usb_driver oti6858_driver = { ...@@ -71,7 +71,6 @@ static struct usb_driver oti6858_driver = {
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1,
}; };
static bool debug; static bool debug;
...@@ -157,7 +156,6 @@ static struct usb_serial_driver oti6858_device = { ...@@ -157,7 +156,6 @@ static struct usb_serial_driver oti6858_device = {
.name = "oti6858", .name = "oti6858",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &oti6858_driver,
.num_ports = 1, .num_ports = 1,
.open = oti6858_open, .open = oti6858_open,
.close = oti6858_close, .close = oti6858_close,
...@@ -176,6 +174,10 @@ static struct usb_serial_driver oti6858_device = { ...@@ -176,6 +174,10 @@ static struct usb_serial_driver oti6858_device = {
.release = oti6858_release, .release = oti6858_release,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&oti6858_device, NULL
};
struct oti6858_private { struct oti6858_private {
spinlock_t lock; spinlock_t lock;
...@@ -960,21 +962,12 @@ static void oti6858_write_bulk_callback(struct urb *urb) ...@@ -960,21 +962,12 @@ static void oti6858_write_bulk_callback(struct urb *urb)
static int __init oti6858_init(void) static int __init oti6858_init(void)
{ {
int retval; return usb_serial_register_drivers(&oti6858_driver, serial_drivers);
retval = usb_serial_register(&oti6858_device);
if (retval == 0) {
retval = usb_register(&oti6858_driver);
if (retval)
usb_serial_deregister(&oti6858_device);
}
return retval;
} }
static void __exit oti6858_exit(void) static void __exit oti6858_exit(void)
{ {
usb_deregister(&oti6858_driver); usb_serial_deregister_drivers(&oti6858_driver, serial_drivers);
usb_serial_deregister(&oti6858_device);
} }
module_init(oti6858_init); module_init(oti6858_init);
......
...@@ -104,7 +104,6 @@ static struct usb_driver pl2303_driver = { ...@@ -104,7 +104,6 @@ static struct usb_driver pl2303_driver = {
.id_table = id_table, .id_table = id_table,
.suspend = usb_serial_suspend, .suspend = usb_serial_suspend,
.resume = usb_serial_resume, .resume = usb_serial_resume,
.no_dynamic_id = 1,
.supports_autosuspend = 1, .supports_autosuspend = 1,
}; };
...@@ -834,7 +833,6 @@ static struct usb_serial_driver pl2303_device = { ...@@ -834,7 +833,6 @@ static struct usb_serial_driver pl2303_device = {
.name = "pl2303", .name = "pl2303",
}, },
.id_table = id_table, .id_table = id_table,
.usb_driver = &pl2303_driver,
.num_ports = 1, .num_ports = 1,
.bulk_in_size = 256, .bulk_in_size = 256,
.bulk_out_size = 256, .bulk_out_size = 256,
...@@ -853,28 +851,23 @@ static struct usb_serial_driver pl2303_device = { ...@@ -853,28 +851,23 @@ static struct usb_serial_driver pl2303_device = {
.release = pl2303_release, .release = pl2303_release,
}; };
static struct usb_serial_driver * const serial_drivers[] = {
&pl2303_device, NULL
};
static int __init pl2303_init(void) static int __init pl2303_init(void)
{ {
int retval; int retval;
retval = usb_serial_register(&pl2303_device); retval = usb_serial_register_drivers(&pl2303_driver, serial_drivers);
if (retval) if (retval == 0)
goto failed_usb_serial_register; printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
retval = usb_register(&pl2303_driver);
if (retval)
goto failed_usb_register;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
return 0;
failed_usb_register:
usb_serial_deregister(&pl2303_device);
failed_usb_serial_register:
return retval; return retval;
} }
static void __exit pl2303_exit(void) static void __exit pl2303_exit(void)
{ {
usb_deregister(&pl2303_driver); usb_serial_deregister_drivers(&pl2303_driver, serial_drivers);
usb_serial_deregister(&pl2303_device);
} }
module_init(pl2303_init); module_init(pl2303_init);
......
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