Commit 8b61d927 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: safe_serial: remove vendor/product module parameters

Remove the vendor and product module parameters which were added a long
time ago when we did not have the dynamic sysfs interface to add
new device ids (and which isn't limited to a single new vid/pid pair).

A vid/pid pair can be added dynamically using sysfs, for example:

  echo 04dd 1234 >/sys/bus/usb-serial/drivers/safe_serial/new_id
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4833960e
...@@ -92,13 +92,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR); ...@@ -92,13 +92,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static __u16 vendor; /* no default */
static __u16 product; /* no default */
module_param(vendor, ushort, 0);
MODULE_PARM_DESC(vendor, "User specified USB idVendor (required)");
module_param(product, ushort, 0);
MODULE_PARM_DESC(product, "User specified USB idProduct (required)");
module_param(safe, bool, 0); module_param(safe, bool, 0);
MODULE_PARM_DESC(safe, "Turn Safe Encapsulation On/Off"); MODULE_PARM_DESC(safe, "Turn Safe Encapsulation On/Off");
...@@ -140,8 +133,6 @@ static struct usb_device_id id_table[] = { ...@@ -140,8 +133,6 @@ static struct usb_device_id id_table[] = {
{MY_USB_DEVICE(0x4dd, 0x8003, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, /* Collie */ {MY_USB_DEVICE(0x4dd, 0x8003, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, /* Collie */
{MY_USB_DEVICE(0x4dd, 0x8004, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, /* Collie */ {MY_USB_DEVICE(0x4dd, 0x8004, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, /* Collie */
{MY_USB_DEVICE(0x5f9, 0xffff, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, /* Sharp tmp */ {MY_USB_DEVICE(0x5f9, 0xffff, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)}, /* Sharp tmp */
/* extra null entry for module vendor/produc parameters */
{MY_USB_DEVICE(0, 0, CDC_DEVICE_CLASS, LINEO_INTERFACE_CLASS, LINEO_INTERFACE_SUBCLASS_SAFESERIAL)},
{} /* terminating entry */ {} /* terminating entry */
}; };
...@@ -272,7 +263,19 @@ static int safe_prepare_write_buffer(struct usb_serial_port *port, ...@@ -272,7 +263,19 @@ static int safe_prepare_write_buffer(struct usb_serial_port *port,
static int safe_startup(struct usb_serial *serial) static int safe_startup(struct usb_serial *serial)
{ {
switch (serial->interface->cur_altsetting->desc.bInterfaceProtocol) { struct usb_interface_descriptor *desc;
if (serial->dev->descriptor.bDeviceClass != CDC_DEVICE_CLASS)
return -ENODEV;
desc = &serial->interface->cur_altsetting->desc;
if (desc->bInterfaceClass != LINEO_INTERFACE_CLASS)
return -ENODEV;
if (desc->bInterfaceSubClass != LINEO_INTERFACE_SUBCLASS_SAFESERIAL)
return -ENODEV;
switch (desc->bInterfaceProtocol) {
case LINEO_SAFESERIAL_CRC: case LINEO_SAFESERIAL_CRC:
break; break;
case LINEO_SAFESERIAL_CRC_PADDED: case LINEO_SAFESERIAL_CRC_PADDED:
...@@ -300,30 +303,4 @@ static struct usb_serial_driver * const serial_drivers[] = { ...@@ -300,30 +303,4 @@ static struct usb_serial_driver * const serial_drivers[] = {
&safe_device, NULL &safe_device, NULL
}; };
static int __init safe_init(void) module_usb_serial_driver(serial_drivers, id_table);
{
int i;
/* if we have vendor / product parameters patch them into id list */
if (vendor || product) {
pr_info("vendor: %x product: %x\n", vendor, product);
for (i = 0; i < ARRAY_SIZE(id_table); i++) {
if (!id_table[i].idVendor && !id_table[i].idProduct) {
id_table[i].idVendor = vendor;
id_table[i].idProduct = product;
break;
}
}
}
return usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, id_table);
}
static void __exit safe_exit(void)
{
usb_serial_deregister_drivers(serial_drivers);
}
module_init(safe_init);
module_exit(safe_exit);
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