diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-11-16 03:00:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 19:18:08 -0500 |
commit | 312c004d36ce6c739512bac83b452f4c20ab1f62 (patch) | |
tree | e61e8331680a0da29557fe21414d3b31e62c9293 /drivers/usb | |
parent | 5f123fbd80f4f788554636f02bf73e40f914e0d6 (diff) |
[PATCH] driver core: replace "hotplug" by "uevent"
Leave the overloaded "hotplug" word to susbsystems which are handling
real devices. The driver core does not "plug" anything, it just exports
the state to userspace and generates events.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/usb.c | 86 | ||||
-rw-r--r-- | drivers/usb/host/hc_crisv10.c | 2 |
2 files changed, 42 insertions, 46 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index e80ef9467825..af2f0941baac 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -363,8 +363,7 @@ void usb_driver_release_interface(struct usb_driver *driver, | |||
363 | * Most USB device drivers will use this indirectly, through the usb core, | 363 | * Most USB device drivers will use this indirectly, through the usb core, |
364 | * but some layered driver frameworks use it directly. | 364 | * but some layered driver frameworks use it directly. |
365 | * These device tables are exported with MODULE_DEVICE_TABLE, through | 365 | * These device tables are exported with MODULE_DEVICE_TABLE, through |
366 | * modutils and "modules.usbmap", to support the driver loading | 366 | * modutils, to support the driver loading functionality of USB hotplugging. |
367 | * functionality of USB hotplugging. | ||
368 | * | 367 | * |
369 | * What Matches: | 368 | * What Matches: |
370 | * | 369 | * |
@@ -545,10 +544,7 @@ static int usb_device_match (struct device *dev, struct device_driver *drv) | |||
545 | #ifdef CONFIG_HOTPLUG | 544 | #ifdef CONFIG_HOTPLUG |
546 | 545 | ||
547 | /* | 546 | /* |
548 | * USB hotplugging invokes what /proc/sys/kernel/hotplug says | 547 | * This sends an uevent to userspace, typically helping to load driver |
549 | * (normally /sbin/hotplug) when USB devices get added or removed. | ||
550 | * | ||
551 | * This invokes a user mode policy agent, typically helping to load driver | ||
552 | * or other modules, configure the device, and more. Drivers can provide | 548 | * or other modules, configure the device, and more. Drivers can provide |
553 | * a MODULE_DEVICE_TABLE to help with module loading subtasks. | 549 | * a MODULE_DEVICE_TABLE to help with module loading subtasks. |
554 | * | 550 | * |
@@ -557,8 +553,8 @@ static int usb_device_match (struct device *dev, struct device_driver *drv) | |||
557 | * delays in event delivery. Use sysfs (and DEVPATH) to make sure the | 553 | * delays in event delivery. Use sysfs (and DEVPATH) to make sure the |
558 | * device (and this configuration!) are still present. | 554 | * device (and this configuration!) are still present. |
559 | */ | 555 | */ |
560 | static int usb_hotplug (struct device *dev, char **envp, int num_envp, | 556 | static int usb_uevent(struct device *dev, char **envp, int num_envp, |
561 | char *buffer, int buffer_size) | 557 | char *buffer, int buffer_size) |
562 | { | 558 | { |
563 | struct usb_interface *intf; | 559 | struct usb_interface *intf; |
564 | struct usb_device *usb_dev; | 560 | struct usb_device *usb_dev; |
@@ -570,7 +566,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, | |||
570 | return -ENODEV; | 566 | return -ENODEV; |
571 | 567 | ||
572 | /* driver is often null here; dev_dbg() would oops */ | 568 | /* driver is often null here; dev_dbg() would oops */ |
573 | pr_debug ("usb %s: hotplug\n", dev->bus_id); | 569 | pr_debug ("usb %s: uevent\n", dev->bus_id); |
574 | 570 | ||
575 | /* Must check driver_data here, as on remove driver is always NULL */ | 571 | /* Must check driver_data here, as on remove driver is always NULL */ |
576 | if ((dev->driver == &usb_generic_driver) || | 572 | if ((dev->driver == &usb_generic_driver) || |
@@ -597,51 +593,51 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, | |||
597 | * | 593 | * |
598 | * FIXME reduce hardwired intelligence here | 594 | * FIXME reduce hardwired intelligence here |
599 | */ | 595 | */ |
600 | if (add_hotplug_env_var(envp, num_envp, &i, | 596 | if (add_uevent_var(envp, num_envp, &i, |
601 | buffer, buffer_size, &length, | 597 | buffer, buffer_size, &length, |
602 | "DEVICE=/proc/bus/usb/%03d/%03d", | 598 | "DEVICE=/proc/bus/usb/%03d/%03d", |
603 | usb_dev->bus->busnum, usb_dev->devnum)) | 599 | usb_dev->bus->busnum, usb_dev->devnum)) |
604 | return -ENOMEM; | 600 | return -ENOMEM; |
605 | #endif | 601 | #endif |
606 | 602 | ||
607 | /* per-device configurations are common */ | 603 | /* per-device configurations are common */ |
608 | if (add_hotplug_env_var(envp, num_envp, &i, | 604 | if (add_uevent_var(envp, num_envp, &i, |
609 | buffer, buffer_size, &length, | 605 | buffer, buffer_size, &length, |
610 | "PRODUCT=%x/%x/%x", | 606 | "PRODUCT=%x/%x/%x", |
611 | le16_to_cpu(usb_dev->descriptor.idVendor), | 607 | le16_to_cpu(usb_dev->descriptor.idVendor), |
612 | le16_to_cpu(usb_dev->descriptor.idProduct), | 608 | le16_to_cpu(usb_dev->descriptor.idProduct), |
613 | le16_to_cpu(usb_dev->descriptor.bcdDevice))) | 609 | le16_to_cpu(usb_dev->descriptor.bcdDevice))) |
614 | return -ENOMEM; | 610 | return -ENOMEM; |
615 | 611 | ||
616 | /* class-based driver binding models */ | 612 | /* class-based driver binding models */ |
617 | if (add_hotplug_env_var(envp, num_envp, &i, | 613 | if (add_uevent_var(envp, num_envp, &i, |
618 | buffer, buffer_size, &length, | 614 | buffer, buffer_size, &length, |
619 | "TYPE=%d/%d/%d", | 615 | "TYPE=%d/%d/%d", |
620 | usb_dev->descriptor.bDeviceClass, | 616 | usb_dev->descriptor.bDeviceClass, |
621 | usb_dev->descriptor.bDeviceSubClass, | 617 | usb_dev->descriptor.bDeviceSubClass, |
622 | usb_dev->descriptor.bDeviceProtocol)) | 618 | usb_dev->descriptor.bDeviceProtocol)) |
623 | return -ENOMEM; | 619 | return -ENOMEM; |
624 | 620 | ||
625 | if (add_hotplug_env_var(envp, num_envp, &i, | 621 | if (add_uevent_var(envp, num_envp, &i, |
626 | buffer, buffer_size, &length, | 622 | buffer, buffer_size, &length, |
627 | "INTERFACE=%d/%d/%d", | 623 | "INTERFACE=%d/%d/%d", |
628 | alt->desc.bInterfaceClass, | 624 | alt->desc.bInterfaceClass, |
629 | alt->desc.bInterfaceSubClass, | 625 | alt->desc.bInterfaceSubClass, |
630 | alt->desc.bInterfaceProtocol)) | 626 | alt->desc.bInterfaceProtocol)) |
631 | return -ENOMEM; | 627 | return -ENOMEM; |
632 | 628 | ||
633 | if (add_hotplug_env_var(envp, num_envp, &i, | 629 | if (add_uevent_var(envp, num_envp, &i, |
634 | buffer, buffer_size, &length, | 630 | buffer, buffer_size, &length, |
635 | "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", | 631 | "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", |
636 | le16_to_cpu(usb_dev->descriptor.idVendor), | 632 | le16_to_cpu(usb_dev->descriptor.idVendor), |
637 | le16_to_cpu(usb_dev->descriptor.idProduct), | 633 | le16_to_cpu(usb_dev->descriptor.idProduct), |
638 | le16_to_cpu(usb_dev->descriptor.bcdDevice), | 634 | le16_to_cpu(usb_dev->descriptor.bcdDevice), |
639 | usb_dev->descriptor.bDeviceClass, | 635 | usb_dev->descriptor.bDeviceClass, |
640 | usb_dev->descriptor.bDeviceSubClass, | 636 | usb_dev->descriptor.bDeviceSubClass, |
641 | usb_dev->descriptor.bDeviceProtocol, | 637 | usb_dev->descriptor.bDeviceProtocol, |
642 | alt->desc.bInterfaceClass, | 638 | alt->desc.bInterfaceClass, |
643 | alt->desc.bInterfaceSubClass, | 639 | alt->desc.bInterfaceSubClass, |
644 | alt->desc.bInterfaceProtocol)) | 640 | alt->desc.bInterfaceProtocol)) |
645 | return -ENOMEM; | 641 | return -ENOMEM; |
646 | 642 | ||
647 | envp[i] = NULL; | 643 | envp[i] = NULL; |
@@ -651,7 +647,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, | |||
651 | 647 | ||
652 | #else | 648 | #else |
653 | 649 | ||
654 | static int usb_hotplug (struct device *dev, char **envp, | 650 | static int usb_uevent(struct device *dev, char **envp, |
655 | int num_envp, char *buffer, int buffer_size) | 651 | int num_envp, char *buffer, int buffer_size) |
656 | { | 652 | { |
657 | return -ENODEV; | 653 | return -ENODEV; |
@@ -1491,7 +1487,7 @@ static int usb_generic_resume(struct device *dev) | |||
1491 | struct bus_type usb_bus_type = { | 1487 | struct bus_type usb_bus_type = { |
1492 | .name = "usb", | 1488 | .name = "usb", |
1493 | .match = usb_device_match, | 1489 | .match = usb_device_match, |
1494 | .hotplug = usb_hotplug, | 1490 | .uevent = usb_uevent, |
1495 | .suspend = usb_generic_suspend, | 1491 | .suspend = usb_generic_suspend, |
1496 | .resume = usb_generic_resume, | 1492 | .resume = usb_generic_resume, |
1497 | }; | 1493 | }; |
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 | ||