Commit ba9dc657 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

[PATCH] USB: allow usb drivers to disable dynamic ids



This lets drivers, like the usb-serial ones, disable the ability to add
ids from sysfs.

The usb-serial drivers are "odd" in that they are really usb-serial bus
drivers, not usb bus drivers, so the dynamic id logic will have to go
into the usb-serial bus core for those drivers to get that ability.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 733260ff
......@@ -112,12 +112,26 @@ static int usb_create_newid_file(struct usb_driver *usb_drv)
{
int error = 0;
if (usb_drv->no_dynamic_id)
goto exit;
if (usb_drv->probe != NULL)
error = sysfs_create_file(&usb_drv->driver.kobj,
&driver_attr_new_id.attr);
exit:
return error;
}
static void usb_remove_newid_file(struct usb_driver *usb_drv)
{
if (usb_drv->no_dynamic_id)
return;
if (usb_drv->probe != NULL)
sysfs_remove_file(&usb_drv->driver.kobj,
&driver_attr_new_id.attr);
}
static void usb_free_dynids(struct usb_driver *usb_drv)
{
struct usb_dynid *dynid, *n;
......@@ -135,6 +149,10 @@ static inline int usb_create_newid_file(struct usb_driver *usb_drv)
return 0;
}
static void usb_remove_newid_file(struct usb_driver *usb_drv)
{
}
static inline void usb_free_dynids(struct usb_driver *usb_drv)
{
}
......@@ -447,6 +465,7 @@ void usb_deregister(struct usb_driver *driver)
pr_info("%s: deregistering driver %s\n", usbcore_name, driver->name);
usb_lock_all_devices();
usb_remove_newid_file(driver);
usb_free_dynids(driver);
driver_unregister(&driver->driver);
usb_unlock_all_devices();
......
......@@ -28,6 +28,7 @@ static struct usb_driver airprime_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver airprime_device = {
......
......@@ -32,6 +32,7 @@ static struct usb_driver anydata_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static int anydata_open(struct usb_serial_port *port, struct file *filp)
......
......@@ -118,6 +118,7 @@ static struct usb_driver belkin_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 serial converters */
......
......@@ -72,6 +72,7 @@ static struct usb_driver cp2101_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver cp2101_device = {
......
......@@ -81,6 +81,7 @@ static struct usb_driver cyberjack_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver cyberjack_device = {
......
......@@ -112,6 +112,7 @@ static struct usb_driver cypress_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
struct cypress_private {
......
......@@ -498,6 +498,7 @@ static struct usb_driver digi_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
......
......@@ -110,6 +110,7 @@ static struct usb_driver empeg_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver empeg_device = {
......
......@@ -488,6 +488,7 @@ static struct usb_driver ftdi_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
static char *ftdi_chip_name[] = {
......
......@@ -227,6 +227,7 @@ static struct usb_driver garmin_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
......
......@@ -73,6 +73,7 @@ static struct usb_driver generic_driver = {
.probe = generic_probe,
.disconnect = usb_serial_disconnect,
.id_table = generic_serial_ids,
.no_dynamic_id = 1,
};
#endif
......
......@@ -42,6 +42,7 @@ static struct usb_driver hp49gp_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver hp49gp_device = {
......
......@@ -247,6 +247,7 @@ static struct usb_driver io_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
/* function prototypes for all of our local functions */
......
......@@ -221,6 +221,7 @@ static struct usb_driver io_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
......
......@@ -547,6 +547,7 @@ static struct usb_driver ipaq_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = ipaq_id_table,
.no_dynamic_id = 1,
};
......
......@@ -157,6 +157,7 @@ static struct usb_driver usb_ipw_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = usb_ipw_ids,
.no_dynamic_id = 1,
};
static int debug;
......
......@@ -130,6 +130,7 @@ static struct usb_driver ir_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
......
......@@ -525,6 +525,7 @@ 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 */
......
......@@ -155,6 +155,7 @@ static struct usb_driver keyspan_pda_driver = {
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table_combined,
.no_dynamic_id = 1,
};
static struct usb_device_id id_table_std [] = {
......
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