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

usb-serial: use new registration API in [q-s]* drivers

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

	qcaux, qcserial, safe_serial, siemens_mpi, sierra,
	spcp8x5, ssu100, and symbolserial.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f667ddad
......@@ -82,7 +82,6 @@ static struct usb_driver qcaux_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver qcaux_device = {
......@@ -91,27 +90,21 @@ static struct usb_serial_driver qcaux_device = {
.name = "qcaux",
},
.id_table = id_table,
.usb_driver = &qcaux_driver,
.num_ports = 1,
};
static struct usb_serial_driver * const serial_drivers[] = {
&qcaux_device, NULL
};
static int __init qcaux_init(void)
{
int retval;
retval = usb_serial_register(&qcaux_device);
if (retval)
return retval;
retval = usb_register(&qcaux_driver);
if (retval)
usb_serial_deregister(&qcaux_device);
return retval;
return usb_serial_register_drivers(&qcaux_driver, serial_drivers);
}
static void __exit qcaux_exit(void)
{
usb_deregister(&qcaux_driver);
usb_serial_deregister(&qcaux_device);
usb_serial_deregister_drivers(&qcaux_driver, serial_drivers);
}
module_init(qcaux_init);
......
......@@ -246,7 +246,6 @@ static struct usb_serial_driver qcdevice = {
},
.description = "Qualcomm USB modem",
.id_table = id_table,
.usb_driver = &qcdriver,
.num_ports = 1,
.probe = qcprobe,
.open = usb_wwan_open,
......@@ -263,27 +262,18 @@ static struct usb_serial_driver qcdevice = {
#endif
};
static struct usb_serial_driver * const serial_drivers[] = {
&qcdevice, NULL
};
static int __init qcinit(void)
{
int retval;
retval = usb_serial_register(&qcdevice);
if (retval)
return retval;
retval = usb_register(&qcdriver);
if (retval) {
usb_serial_deregister(&qcdevice);
return retval;
}
return 0;
return usb_serial_register_drivers(&qcdriver, serial_drivers);
}
static void __exit qcexit(void)
{
usb_deregister(&qcdriver);
usb_serial_deregister(&qcdevice);
usb_serial_deregister_drivers(&qcdriver, serial_drivers);
}
module_init(qcinit);
......
......@@ -156,7 +156,6 @@ static struct usb_driver safe_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static const __u16 crc10_table[256] = {
......@@ -309,16 +308,19 @@ static struct usb_serial_driver safe_device = {
.name = "safe_serial",
},
.id_table = id_table,
.usb_driver = &safe_driver,
.num_ports = 1,
.process_read_urb = safe_process_read_urb,
.prepare_write_buffer = safe_prepare_write_buffer,
.attach = safe_startup,
};
static struct usb_serial_driver * const serial_drivers[] = {
&safe_device, NULL
};
static int __init safe_init(void)
{
int i, retval;
int i;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
......@@ -337,24 +339,12 @@ static int __init safe_init(void)
}
}
retval = usb_serial_register(&safe_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&safe_driver);
if (retval)
goto failed_usb_register;
return 0;
failed_usb_register:
usb_serial_deregister(&safe_device);
failed_usb_serial_register:
return retval;
return usb_serial_register_drivers(&safe_driver, serial_drivers);
}
static void __exit safe_exit(void)
{
usb_deregister(&safe_driver);
usb_serial_deregister(&safe_device);
usb_serial_deregister_drivers(&safe_driver, serial_drivers);
}
module_init(safe_init);
......
......@@ -42,33 +42,29 @@ static struct usb_serial_driver siemens_usb_mpi_device = {
.name = "siemens_mpi",
},
.id_table = id_table,
.usb_driver = &siemens_usb_mpi_driver,
.num_ports = 1,
};
static struct usb_serial_driver * const serial_drivers[] = {
&siemens_usb_mpi_device, NULL
};
static int __init siemens_usb_mpi_init(void)
{
int retval;
retval = usb_serial_register(&siemens_usb_mpi_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&siemens_usb_mpi_driver);
if (retval)
goto failed_usb_register;
printk(KERN_INFO DRIVER_DESC "\n");
printk(KERN_INFO DRIVER_VERSION " " DRIVER_AUTHOR "\n");
return retval;
failed_usb_register:
usb_serial_deregister(&siemens_usb_mpi_device);
failed_usb_serial_register:
retval = usb_serial_register_drivers(&siemens_usb_mpi_driver,
serial_drivers);
if (retval == 0) {
printk(KERN_INFO DRIVER_DESC "\n");
printk(KERN_INFO DRIVER_VERSION " " DRIVER_AUTHOR "\n");
}
return retval;
}
static void __exit siemens_usb_mpi_exit(void)
{
usb_deregister(&siemens_usb_mpi_driver);
usb_serial_deregister(&siemens_usb_mpi_device);
usb_serial_deregister_drivers(&siemens_usb_mpi_driver, serial_drivers);
}
module_init(siemens_usb_mpi_init);
......
......@@ -1084,7 +1084,6 @@ static struct usb_driver sierra_driver = {
.resume = usb_serial_resume,
.reset_resume = sierra_reset_resume,
.id_table = id_table,
.no_dynamic_id = 1,
.supports_autosuspend = 1,
};
......@@ -1095,7 +1094,6 @@ static struct usb_serial_driver sierra_device = {
},
.description = "Sierra USB modem",
.id_table = id_table,
.usb_driver = &sierra_driver,
.calc_num_ports = sierra_calc_num_ports,
.probe = sierra_probe,
.open = sierra_open,
......@@ -1113,34 +1111,25 @@ static struct usb_serial_driver sierra_device = {
.read_int_callback = sierra_instat_callback,
};
static struct usb_serial_driver * const serial_drivers[] = {
&sierra_device, NULL
};
/* Functions used by new usb-serial code. */
static int __init sierra_init(void)
{
int retval;
retval = usb_serial_register(&sierra_device);
if (retval)
goto failed_device_register;
retval = usb_register(&sierra_driver);
if (retval)
goto failed_driver_register;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return 0;
failed_driver_register:
usb_serial_deregister(&sierra_device);
failed_device_register:
retval = usb_serial_register_drivers(&sierra_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit sierra_exit(void)
{
usb_deregister(&sierra_driver);
usb_serial_deregister(&sierra_device);
usb_serial_deregister_drivers(&sierra_driver, serial_drivers);
}
module_init(sierra_init);
......
......@@ -156,7 +156,6 @@ static struct usb_driver spcp8x5_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
......@@ -649,7 +648,6 @@ static struct usb_serial_driver spcp8x5_device = {
.name = "SPCP8x5",
},
.id_table = id_table,
.usb_driver = &spcp8x5_driver,
.num_ports = 1,
.open = spcp8x5_open,
.dtr_rts = spcp8x5_dtr_rts,
......@@ -664,28 +662,24 @@ static struct usb_serial_driver spcp8x5_device = {
.process_read_urb = spcp8x5_process_read_urb,
};
static struct usb_serial_driver * const serial_drivers[] = {
&spcp8x5_device, NULL
};
static int __init spcp8x5_init(void)
{
int retval;
retval = usb_serial_register(&spcp8x5_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&spcp8x5_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(&spcp8x5_device);
failed_usb_serial_register:
retval = usb_serial_register_drivers(&spcp8x5_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit spcp8x5_exit(void)
{
usb_deregister(&spcp8x5_driver);
usb_serial_deregister(&spcp8x5_device);
usb_serial_deregister_drivers(&spcp8x5_driver, serial_drivers);
}
module_init(spcp8x5_init);
......
......@@ -70,7 +70,6 @@ static struct usb_driver ssu100_driver = {
.id_table = id_table,
.suspend = usb_serial_suspend,
.resume = usb_serial_resume,
.no_dynamic_id = 1,
.supports_autosuspend = 1,
};
......@@ -677,7 +676,6 @@ static struct usb_serial_driver ssu100_device = {
},
.description = DRIVER_DESC,
.id_table = id_table,
.usb_driver = &ssu100_driver,
.num_ports = 1,
.open = ssu100_open,
.close = ssu100_close,
......@@ -693,37 +691,26 @@ static struct usb_serial_driver ssu100_device = {
.disconnect = usb_serial_generic_disconnect,
};
static struct usb_serial_driver * const serial_drivers[] = {
&ssu100_device, NULL
};
static int __init ssu100_init(void)
{
int retval;
dbg("%s", __func__);
/* register with usb-serial */
retval = usb_serial_register(&ssu100_device);
if (retval)
goto failed_usb_sio_register;
retval = usb_register(&ssu100_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(&ssu100_device);
failed_usb_sio_register:
retval = usb_serial_register_drivers(&ssu100_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit ssu100_exit(void)
{
usb_deregister(&ssu100_driver);
usb_serial_deregister(&ssu100_device);
usb_serial_deregister_drivers(&ssu100_driver, serial_drivers);
}
module_init(ssu100_init);
......
......@@ -287,7 +287,6 @@ static struct usb_driver symbol_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver symbol_device = {
......@@ -296,7 +295,6 @@ static struct usb_serial_driver symbol_device = {
.name = "symbol",
},
.id_table = id_table,
.usb_driver = &symbol_driver,
.num_ports = 1,
.attach = symbol_startup,
.open = symbol_open,
......@@ -307,23 +305,18 @@ static struct usb_serial_driver symbol_device = {
.unthrottle = symbol_unthrottle,
};
static struct usb_serial_driver * const serial_drivers[] = {
&symbol_device, NULL
};
static int __init symbol_init(void)
{
int retval;
retval = usb_serial_register(&symbol_device);
if (retval)
return retval;
retval = usb_register(&symbol_driver);
if (retval)
usb_serial_deregister(&symbol_device);
return retval;
return usb_serial_register_drivers(&symbol_driver, serial_drivers);
}
static void __exit symbol_exit(void)
{
usb_deregister(&symbol_driver);
usb_serial_deregister(&symbol_device);
usb_serial_deregister_drivers(&symbol_driver, serial_drivers);
}
module_init(symbol_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