diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/usb.c | 84 | ||||
-rw-r--r-- | drivers/usb/host/hc_crisv10.c | 2 |
2 files changed, 42 insertions, 44 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 56a3520863a9..13d1d367f7f1 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -192,6 +192,7 @@ void usb_driver_release_interface(struct usb_driver *driver, | |||
192 | iface->condition = USB_INTERFACE_UNBOUND; | 192 | iface->condition = USB_INTERFACE_UNBOUND; |
193 | mark_quiesced(iface); | 193 | mark_quiesced(iface); |
194 | } | 194 | } |
195 | |||
195 | struct find_interface_arg { | 196 | struct find_interface_arg { |
196 | int minor; | 197 | int minor; |
197 | struct usb_interface *interface; | 198 | struct usb_interface *interface; |
@@ -236,10 +237,7 @@ struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) | |||
236 | #ifdef CONFIG_HOTPLUG | 237 | #ifdef CONFIG_HOTPLUG |
237 | 238 | ||
238 | /* | 239 | /* |
239 | * USB hotplugging invokes what /proc/sys/kernel/hotplug says | 240 | * This sends an uevent to userspace, typically helping to load driver |
240 | * (normally /sbin/hotplug) when USB devices get added or removed. | ||
241 | * | ||
242 | * This invokes a user mode policy agent, typically helping to load driver | ||
243 | * or other modules, configure the device, and more. Drivers can provide | 241 | * or other modules, configure the device, and more. Drivers can provide |
244 | * a MODULE_DEVICE_TABLE to help with module loading subtasks. | 242 | * a MODULE_DEVICE_TABLE to help with module loading subtasks. |
245 | * | 243 | * |
@@ -248,8 +246,8 @@ struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) | |||
248 | * delays in event delivery. Use sysfs (and DEVPATH) to make sure the | 246 | * delays in event delivery. Use sysfs (and DEVPATH) to make sure the |
249 | * device (and this configuration!) are still present. | 247 | * device (and this configuration!) are still present. |
250 | */ | 248 | */ |
251 | static int usb_hotplug (struct device *dev, char **envp, int num_envp, | 249 | static int usb_uevent(struct device *dev, char **envp, int num_envp, |
252 | char *buffer, int buffer_size) | 250 | char *buffer, int buffer_size) |
253 | { | 251 | { |
254 | struct usb_interface *intf; | 252 | struct usb_interface *intf; |
255 | struct usb_device *usb_dev; | 253 | struct usb_device *usb_dev; |
@@ -261,7 +259,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, | |||
261 | return -ENODEV; | 259 | return -ENODEV; |
262 | 260 | ||
263 | /* driver is often null here; dev_dbg() would oops */ | 261 | /* driver is often null here; dev_dbg() would oops */ |
264 | pr_debug ("usb %s: hotplug\n", dev->bus_id); | 262 | pr_debug ("usb %s: uevent\n", dev->bus_id); |
265 | 263 | ||
266 | /* Must check driver_data here, as on remove driver is always NULL */ | 264 | /* Must check driver_data here, as on remove driver is always NULL */ |
267 | if ((dev->driver == &usb_generic_driver) || | 265 | if ((dev->driver == &usb_generic_driver) || |
@@ -288,51 +286,51 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, | |||
288 | * | 286 | * |
289 | * FIXME reduce hardwired intelligence here | 287 | * FIXME reduce hardwired intelligence here |
290 | */ | 288 | */ |
291 | if (add_hotplug_env_var(envp, num_envp, &i, | 289 | if (add_uevent_var(envp, num_envp, &i, |
292 | buffer, buffer_size, &length, | 290 | buffer, buffer_size, &length, |
293 | "DEVICE=/proc/bus/usb/%03d/%03d", | 291 | "DEVICE=/proc/bus/usb/%03d/%03d", |
294 | usb_dev->bus->busnum, usb_dev->devnum)) | 292 | usb_dev->bus->busnum, usb_dev->devnum)) |
295 | return -ENOMEM; | 293 | return -ENOMEM; |
296 | #endif | 294 | #endif |
297 | 295 | ||
298 | /* per-device configurations are common */ | 296 | /* per-device configurations are common */ |
299 | if (add_hotplug_env_var(envp, num_envp, &i, | 297 | if (add_uevent_var(envp, num_envp, &i, |
300 | buffer, buffer_size, &length, | 298 | buffer, buffer_size, &length, |
301 | "PRODUCT=%x/%x/%x", | 299 | "PRODUCT=%x/%x/%x", |
302 | le16_to_cpu(usb_dev->descriptor.idVendor), | 300 | le16_to_cpu(usb_dev->descriptor.idVendor), |
303 | le16_to_cpu(usb_dev->descriptor.idProduct), | 301 | le16_to_cpu(usb_dev->descriptor.idProduct), |
304 | le16_to_cpu(usb_dev->descriptor.bcdDevice))) | 302 | le16_to_cpu(usb_dev->descriptor.bcdDevice))) |
305 | return -ENOMEM; | 303 | return -ENOMEM; |
306 | 304 | ||
307 | /* class-based driver binding models */ | 305 | /* class-based driver binding models */ |
308 | if (add_hotplug_env_var(envp, num_envp, &i, | 306 | if (add_uevent_var(envp, num_envp, &i, |
309 | buffer, buffer_size, &length, | 307 | buffer, buffer_size, &length, |
310 | "TYPE=%d/%d/%d", | 308 | "TYPE=%d/%d/%d", |
311 | usb_dev->descriptor.bDeviceClass, | 309 | usb_dev->descriptor.bDeviceClass, |
312 | usb_dev->descriptor.bDeviceSubClass, | 310 | usb_dev->descriptor.bDeviceSubClass, |
313 | usb_dev->descriptor.bDeviceProtocol)) | 311 | usb_dev->descriptor.bDeviceProtocol)) |
314 | return -ENOMEM; | 312 | return -ENOMEM; |
315 | 313 | ||
316 | if (add_hotplug_env_var(envp, num_envp, &i, | 314 | if (add_uevent_var(envp, num_envp, &i, |
317 | buffer, buffer_size, &length, | 315 | buffer, buffer_size, &length, |
318 | "INTERFACE=%d/%d/%d", | 316 | "INTERFACE=%d/%d/%d", |
319 | alt->desc.bInterfaceClass, | 317 | alt->desc.bInterfaceClass, |
320 | alt->desc.bInterfaceSubClass, | 318 | alt->desc.bInterfaceSubClass, |
321 | alt->desc.bInterfaceProtocol)) | 319 | alt->desc.bInterfaceProtocol)) |
322 | return -ENOMEM; | 320 | return -ENOMEM; |
323 | 321 | ||
324 | if (add_hotplug_env_var(envp, num_envp, &i, | 322 | if (add_uevent_var(envp, num_envp, &i, |
325 | buffer, buffer_size, &length, | 323 | buffer, buffer_size, &length, |
326 | "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", | 324 | "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", |
327 | le16_to_cpu(usb_dev->descriptor.idVendor), | 325 | le16_to_cpu(usb_dev->descriptor.idVendor), |
328 | le16_to_cpu(usb_dev->descriptor.idProduct), | 326 | le16_to_cpu(usb_dev->descriptor.idProduct), |
329 | le16_to_cpu(usb_dev->descriptor.bcdDevice), | 327 | le16_to_cpu(usb_dev->descriptor.bcdDevice), |
330 | usb_dev->descriptor.bDeviceClass, | 328 | usb_dev->descriptor.bDeviceClass, |
331 | usb_dev->descriptor.bDeviceSubClass, | 329 | usb_dev->descriptor.bDeviceSubClass, |
332 | usb_dev->descriptor.bDeviceProtocol, | 330 | usb_dev->descriptor.bDeviceProtocol, |
333 | alt->desc.bInterfaceClass, | 331 | alt->desc.bInterfaceClass, |
334 | alt->desc.bInterfaceSubClass, | 332 | alt->desc.bInterfaceSubClass, |
335 | alt->desc.bInterfaceProtocol)) | 333 | alt->desc.bInterfaceProtocol)) |
336 | return -ENOMEM; | 334 | return -ENOMEM; |
337 | 335 | ||
338 | envp[i] = NULL; | 336 | envp[i] = NULL; |
@@ -342,7 +340,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, | |||
342 | 340 | ||
343 | #else | 341 | #else |
344 | 342 | ||
345 | static int usb_hotplug (struct device *dev, char **envp, | 343 | static int usb_uevent(struct device *dev, char **envp, |
346 | int num_envp, char *buffer, int buffer_size) | 344 | int num_envp, char *buffer, int buffer_size) |
347 | { | 345 | { |
348 | return -ENODEV; | 346 | return -ENODEV; |
@@ -1093,7 +1091,7 @@ static int usb_generic_resume(struct device *dev) | |||
1093 | struct bus_type usb_bus_type = { | 1091 | struct bus_type usb_bus_type = { |
1094 | .name = "usb", | 1092 | .name = "usb", |
1095 | .match = usb_device_match, | 1093 | .match = usb_device_match, |
1096 | .hotplug = usb_hotplug, | 1094 | .uevent = usb_uevent, |
1097 | .suspend = usb_generic_suspend, | 1095 | .suspend = usb_generic_suspend, |
1098 | .resume = usb_generic_resume, | 1096 | .resume = usb_generic_resume, |
1099 | }; | 1097 | }; |
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index 0eaabeb37ac3..641268d7e6f3 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c | |||
@@ -4397,7 +4397,7 @@ static int __init etrax_usb_hc_init(void) | |||
4397 | device_initialize(&fake_device); | 4397 | device_initialize(&fake_device); |
4398 | kobject_set_name(&fake_device.kobj, "etrax_usb"); | 4398 | kobject_set_name(&fake_device.kobj, "etrax_usb"); |
4399 | kobject_add(&fake_device.kobj); | 4399 | kobject_add(&fake_device.kobj); |
4400 | kobject_hotplug(&fake_device.kobj, KOBJ_ADD); | 4400 | kobject_uevent(&fake_device.kobj, KOBJ_ADD); |
4401 | hc->bus->controller = &fake_device; | 4401 | hc->bus->controller = &fake_device; |
4402 | usb_register_bus(hc->bus); | 4402 | usb_register_bus(hc->bus); |
4403 | 4403 | ||