提交 4d2a7aff 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

usb-serial: use new registration API in [k-m]* drivers

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

	keyspan, kl5kusb105, kobil_sct, mct_u232, mos7720,
	mos7840, and moto_modem.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7dbe2460
......@@ -134,45 +134,17 @@ struct keyspan_port_private {
static int __init keyspan_init(void)
{
int retval;
retval = usb_serial_register(&keyspan_pre_device);
if (retval)
goto failed_pre_device_register;
retval = usb_serial_register(&keyspan_1port_device);
if (retval)
goto failed_1port_device_register;
retval = usb_serial_register(&keyspan_2port_device);
if (retval)
goto failed_2port_device_register;
retval = usb_serial_register(&keyspan_4port_device);
if (retval)
goto failed_4port_device_register;
retval = usb_register(&keyspan_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(&keyspan_4port_device);
failed_4port_device_register:
usb_serial_deregister(&keyspan_2port_device);
failed_2port_device_register:
usb_serial_deregister(&keyspan_1port_device);
failed_1port_device_register:
usb_serial_deregister(&keyspan_pre_device);
failed_pre_device_register:
retval = usb_serial_register_drivers(&keyspan_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
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);
usb_serial_deregister(&keyspan_4port_device);
usb_serial_deregister_drivers(&keyspan_driver, serial_drivers);
}
module_init(keyspan_init);
......
......@@ -492,7 +492,6 @@ static struct usb_driver keyspan_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = keyspan_ids_combined,
.no_dynamic_id = 1,
};
/* usb_device_id table for the pre-firmware download keyspan devices */
......@@ -545,7 +544,6 @@ static struct usb_serial_driver keyspan_pre_device = {
.name = "keyspan_no_firm",
},
.description = "Keyspan - (without firmware)",
.usb_driver = &keyspan_driver,
.id_table = keyspan_pre_ids,
.num_ports = 1,
.attach = keyspan_fake_startup,
......@@ -557,7 +555,6 @@ static struct usb_serial_driver keyspan_1port_device = {
.name = "keyspan_1",
},
.description = "Keyspan 1 port adapter",
.usb_driver = &keyspan_driver,
.id_table = keyspan_1port_ids,
.num_ports = 1,
.open = keyspan_open,
......@@ -580,7 +577,6 @@ static struct usb_serial_driver keyspan_2port_device = {
.name = "keyspan_2",
},
.description = "Keyspan 2 port adapter",
.usb_driver = &keyspan_driver,
.id_table = keyspan_2port_ids,
.num_ports = 2,
.open = keyspan_open,
......@@ -603,7 +599,6 @@ static struct usb_serial_driver keyspan_4port_device = {
.name = "keyspan_4",
},
.description = "Keyspan 4 port adapter",
.usb_driver = &keyspan_driver,
.id_table = keyspan_4port_ids,
.num_ports = 4,
.open = keyspan_open,
......@@ -620,4 +615,9 @@ static struct usb_serial_driver keyspan_4port_device = {
.release = keyspan_release,
};
static struct usb_serial_driver * const serial_drivers[] = {
&keyspan_pre_device, &keyspan_1port_device,
&keyspan_2port_device, &keyspan_4port_device, NULL
};
#endif
......@@ -91,7 +91,6 @@ static struct usb_driver kl5kusb105d_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver kl5kusb105d_device = {
......@@ -100,7 +99,6 @@ static struct usb_serial_driver kl5kusb105d_device = {
.name = "kl5kusb105d",
},
.description = "KL5KUSB105D / PalmConnect",
.usb_driver = &kl5kusb105d_driver,
.id_table = id_table,
.num_ports = 1,
.bulk_out_size = 64,
......@@ -118,6 +116,10 @@ static struct usb_serial_driver kl5kusb105d_device = {
.prepare_write_buffer = klsi_105_prepare_write_buffer,
};
static struct usb_serial_driver * const serial_drivers[] = {
&kl5kusb105d_device, NULL
};
struct klsi_105_port_settings {
__u8 pktlen; /* always 5, it seems */
__u8 baudrate;
......@@ -694,26 +696,18 @@ static int klsi_105_tiocmset(struct tty_struct *tty,
static int __init klsi_105_init(void)
{
int retval;
retval = usb_serial_register(&kl5kusb105d_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&kl5kusb105d_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(&kl5kusb105d_device);
failed_usb_serial_register:
retval = usb_serial_register_drivers(&kl5kusb105d_driver,
serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit klsi_105_exit(void)
{
usb_deregister(&kl5kusb105d_driver);
usb_serial_deregister(&kl5kusb105d_device);
usb_serial_deregister_drivers(&kl5kusb105d_driver, serial_drivers);
}
......
......@@ -90,7 +90,6 @@ static struct usb_driver kobil_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
......@@ -100,7 +99,6 @@ static struct usb_serial_driver kobil_device = {
.name = "kobil",
},
.description = "KOBIL USB smart card terminal",
.usb_driver = &kobil_driver,
.id_table = id_table,
.num_ports = 1,
.attach = kobil_startup,
......@@ -117,6 +115,9 @@ static struct usb_serial_driver kobil_device = {
.read_int_callback = kobil_read_int_callback,
};
static struct usb_serial_driver * const serial_drivers[] = {
&kobil_device, NULL
};
struct kobil_private {
int write_int_endpoint_address;
......@@ -685,28 +686,18 @@ static int kobil_ioctl(struct tty_struct *tty,
static int __init kobil_init(void)
{
int retval;
retval = usb_serial_register(&kobil_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&kobil_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(&kobil_device);
failed_usb_serial_register:
retval = usb_serial_register_drivers(&kobil_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit kobil_exit(void)
{
usb_deregister(&kobil_driver);
usb_serial_deregister(&kobil_device);
usb_serial_deregister_drivers(&kobil_driver, serial_drivers);
}
module_init(kobil_init);
......
......@@ -88,7 +88,6 @@ static struct usb_driver mct_u232_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
static struct usb_serial_driver mct_u232_device = {
......@@ -97,7 +96,6 @@ static struct usb_serial_driver mct_u232_device = {
.name = "mct_u232",
},
.description = "MCT U232",
.usb_driver = &mct_u232_driver,
.id_table = id_table_combined,
.num_ports = 1,
.open = mct_u232_open,
......@@ -116,6 +114,10 @@ static struct usb_serial_driver mct_u232_device = {
.get_icount = mct_u232_get_icount,
};
static struct usb_serial_driver * const serial_drivers[] = {
&mct_u232_device, NULL
};
struct mct_u232_private {
spinlock_t lock;
unsigned int control_state; /* Modem Line Setting (TIOCM) */
......@@ -907,26 +909,18 @@ static int mct_u232_get_icount(struct tty_struct *tty,
static int __init mct_u232_init(void)
{
int retval;
retval = usb_serial_register(&mct_u232_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&mct_u232_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(&mct_u232_device);
failed_usb_serial_register:
retval = usb_serial_register_drivers(&mct_u232_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit mct_u232_exit(void)
{
usb_deregister(&mct_u232_driver);
usb_serial_deregister(&mct_u232_device);
usb_serial_deregister_drivers(&mct_u232_driver, serial_drivers);
}
module_init(mct_u232_init);
......
......@@ -2169,7 +2169,6 @@ static struct usb_driver usb_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = moschip_port_id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver moschip7720_2port_driver = {
......@@ -2178,7 +2177,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
.name = "moschip7720",
},
.description = "Moschip 2 port adapter",
.usb_driver = &usb_driver,
.id_table = moschip_port_id_table,
.calc_num_ports = mos77xx_calc_num_ports,
.open = mos7720_open,
......@@ -2201,38 +2199,26 @@ static struct usb_serial_driver moschip7720_2port_driver = {
.read_int_callback = NULL /* dynamically assigned in probe() */
};
static struct usb_serial_driver * const serial_drivers[] = {
&moschip7720_2port_driver, NULL
};
static int __init moschip7720_init(void)
{
int retval;
dbg("%s: Entering ..........", __func__);
/* Register with the usb serial */
retval = usb_serial_register(&moschip7720_2port_driver);
if (retval)
goto failed_port_device_register;
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
/* Register with the usb */
retval = usb_register(&usb_driver);
if (retval)
goto failed_usb_register;
return 0;
failed_usb_register:
usb_serial_deregister(&moschip7720_2port_driver);
failed_port_device_register:
retval = usb_serial_register_drivers(&usb_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
return retval;
}
static void __exit moschip7720_exit(void)
{
usb_deregister(&usb_driver);
usb_serial_deregister(&moschip7720_2port_driver);
usb_serial_deregister_drivers(&usb_driver, serial_drivers);
}
module_init(moschip7720_init);
......
......@@ -2638,7 +2638,6 @@ static struct usb_driver io_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = moschip_id_table_combined,
.no_dynamic_id = 1,
};
static struct usb_serial_driver moschip7840_4port_device = {
......@@ -2647,7 +2646,6 @@ static struct usb_serial_driver moschip7840_4port_device = {
.name = "mos7840",
},
.description = DRIVER_DESC,
.usb_driver = &io_driver,
.id_table = moschip_port_id_table,
.num_ports = 4,
.open = mos7840_open,
......@@ -2674,6 +2672,10 @@ static struct usb_serial_driver moschip7840_4port_device = {
.read_int_callback = mos7840_interrupt_callback,
};
static struct usb_serial_driver * const serial_drivers[] = {
&moschip7840_4port_device, NULL
};
/****************************************************************************
* moschip7840_init
* This is called by the module subsystem, or on startup to initialize us
......@@ -2684,24 +2686,12 @@ static int __init moschip7840_init(void)
dbg("%s", " mos7840_init :entering..........");
/* Register with the usb serial */
retval = usb_serial_register(&moschip7840_4port_device);
if (retval)
goto failed_port_device_register;
dbg("%s", "Entering...");
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
retval = usb_serial_register_drivers(&io_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
DRIVER_DESC "\n");
/* Register with the usb */
retval = usb_register(&io_driver);
if (retval == 0) {
dbg("%s", "Leaving...");
return 0;
}
usb_serial_deregister(&moschip7840_4port_device);
failed_port_device_register:
dbg("%s", "Leaving...");
return retval;
}
......@@ -2714,9 +2704,7 @@ static void __exit moschip7840_exit(void)
dbg("%s", " mos7840_exit :entering..........");
usb_deregister(&io_driver);
usb_serial_deregister(&moschip7840_4port_device);
usb_serial_deregister_drivers(&io_driver, serial_drivers);
dbg("%s", "Entering...");
}
......
......@@ -36,7 +36,6 @@ static struct usb_driver moto_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver moto_device = {
......@@ -45,27 +44,21 @@ static struct usb_serial_driver moto_device = {
.name = "moto-modem",
},
.id_table = id_table,
.usb_driver = &moto_driver,
.num_ports = 1,
};
static struct usb_serial_driver * const serial_drivers[] = {
&moto_device, NULL
};
static int __init moto_init(void)
{
int retval;
retval = usb_serial_register(&moto_device);
if (retval)
return retval;
retval = usb_register(&moto_driver);
if (retval)
usb_serial_deregister(&moto_device);
return retval;
return usb_serial_register_drivers(&moto_driver, serial_drivers);
}
static void __exit moto_exit(void)
{
usb_deregister(&moto_driver);
usb_serial_deregister(&moto_device);
usb_serial_deregister_drivers(&moto_driver, serial_drivers);
}
module_init(moto_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册