aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 21:44:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 21:44:12 -0500
commitdb9edfd7e339ca4113153d887e782dd05be5a9eb (patch)
tree0a4ba12447a0cabc800adc7e9667d284777b0181 /drivers
parent631b034724364b413e8a52e7c2e03a9d77e4c2b4 (diff)
parentfd586bacf439f36dea9b9bf6e6133ac87df2730c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Trivial manual merge fixup for usb_find_interface clashes.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/container.c8
-rw-r--r--drivers/acpi/processor_core.c8
-rw-r--r--drivers/acpi/scan.c14
-rw-r--r--drivers/base/Kconfig4
-rw-r--r--drivers/base/bus.c41
-rw-r--r--drivers/base/class.c66
-rw-r--r--drivers/base/core.c42
-rw-r--r--drivers/base/cpu.c4
-rw-r--r--drivers/base/dd.c15
-rw-r--r--drivers/base/firmware_class.c45
-rw-r--r--drivers/base/memory.c12
-rw-r--r--drivers/base/platform.c68
-rw-r--r--drivers/base/power/runtime.c2
-rw-r--r--drivers/ide/ide-cd.c1
-rw-r--r--drivers/ide/ide-disk.c1
-rw-r--r--drivers/ide/ide-floppy.c1
-rw-r--r--drivers/ide/ide-tape.c1
-rw-r--r--drivers/ide/ide.c60
-rw-r--r--drivers/ieee1394/nodemgr.c20
-rw-r--r--drivers/infiniband/core/sysfs.c16
-rw-r--r--drivers/input/input.c54
-rw-r--r--drivers/input/serio/serio.c22
-rw-r--r--drivers/macintosh/macio_asic.c4
-rw-r--r--drivers/mmc/mmc_sysfs.c4
-rw-r--r--drivers/pci/hotplug.c44
-rw-r--r--drivers/pci/pci-driver.c6
-rw-r--r--drivers/pci/pci.h4
-rw-r--r--drivers/pcmcia/cs.c10
-rw-r--r--drivers/pcmcia/ds.c50
-rw-r--r--drivers/pnp/pnpbios/core.c8
-rw-r--r--drivers/s390/cio/ccwgroup.c4
-rw-r--r--drivers/s390/cio/device.c4
-rw-r--r--drivers/s390/crypto/z90main.c1
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/usb/core/usb.c84
-rw-r--r--drivers/usb/host/hc_crisv10.c2
-rw-r--r--drivers/w1/w1.c14
37 files changed, 451 insertions, 295 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 27ec12c1fab..b69a8cad82b 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -172,21 +172,21 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
172 if (ACPI_FAILURE(status) || !device) { 172 if (ACPI_FAILURE(status) || !device) {
173 result = container_device_add(&device, handle); 173 result = container_device_add(&device, handle);
174 if (!result) 174 if (!result)
175 kobject_hotplug(&device->kobj, 175 kobject_uevent(&device->kobj,
176 KOBJ_ONLINE); 176 KOBJ_ONLINE);
177 else 177 else
178 printk("Failed to add container\n"); 178 printk("Failed to add container\n");
179 } 179 }
180 } else { 180 } else {
181 if (ACPI_SUCCESS(status)) { 181 if (ACPI_SUCCESS(status)) {
182 /* device exist and this is a remove request */ 182 /* device exist and this is a remove request */
183 kobject_hotplug(&device->kobj, KOBJ_OFFLINE); 183 kobject_uevent(&device->kobj, KOBJ_OFFLINE);
184 } 184 }
185 } 185 }
186 break; 186 break;
187 case ACPI_NOTIFY_EJECT_REQUEST: 187 case ACPI_NOTIFY_EJECT_REQUEST:
188 if (!acpi_bus_get_device(handle, &device) && device) { 188 if (!acpi_bus_get_device(handle, &device) && device) {
189 kobject_hotplug(&device->kobj, KOBJ_OFFLINE); 189 kobject_uevent(&device->kobj, KOBJ_OFFLINE);
190 } 190 }
191 break; 191 break;
192 default: 192 default:
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 0c561c571f2..1278aca96fe 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -748,7 +748,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
748 return_VALUE(-ENODEV); 748 return_VALUE(-ENODEV);
749 749
750 if ((pr->id >= 0) && (pr->id < NR_CPUS)) { 750 if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
751 kobject_hotplug(&(*device)->kobj, KOBJ_ONLINE); 751 kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
752 } 752 }
753 return_VALUE(0); 753 return_VALUE(0);
754} 754}
@@ -788,13 +788,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
788 } 788 }
789 789
790 if (pr->id >= 0 && (pr->id < NR_CPUS)) { 790 if (pr->id >= 0 && (pr->id < NR_CPUS)) {
791 kobject_hotplug(&device->kobj, KOBJ_OFFLINE); 791 kobject_uevent(&device->kobj, KOBJ_OFFLINE);
792 break; 792 break;
793 } 793 }
794 794
795 result = acpi_processor_start(device); 795 result = acpi_processor_start(device);
796 if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { 796 if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) {
797 kobject_hotplug(&device->kobj, KOBJ_ONLINE); 797 kobject_uevent(&device->kobj, KOBJ_ONLINE);
798 } else { 798 } else {
799 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 799 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
800 "Device [%s] failed to start\n", 800 "Device [%s] failed to start\n",
@@ -818,7 +818,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
818 } 818 }
819 819
820 if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) 820 if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
821 kobject_hotplug(&device->kobj, KOBJ_OFFLINE); 821 kobject_uevent(&device->kobj, KOBJ_OFFLINE);
822 break; 822 break;
823 default: 823 default:
824 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 824 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 31218e1d2a1..0745d20afb8 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -78,7 +78,7 @@ static struct kobj_type ktype_acpi_ns = {
78 .release = acpi_device_release, 78 .release = acpi_device_release,
79}; 79};
80 80
81static int namespace_hotplug(struct kset *kset, struct kobject *kobj, 81static int namespace_uevent(struct kset *kset, struct kobject *kobj,
82 char **envp, int num_envp, char *buffer, 82 char **envp, int num_envp, char *buffer,
83 int buffer_size) 83 int buffer_size)
84{ 84{
@@ -89,8 +89,8 @@ static int namespace_hotplug(struct kset *kset, struct kobject *kobj,
89 if (!dev->driver) 89 if (!dev->driver)
90 return 0; 90 return 0;
91 91
92 if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, 92 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
93 "PHYSDEVDRIVER=%s", dev->driver->name)) 93 "PHYSDEVDRIVER=%s", dev->driver->name))
94 return -ENOMEM; 94 return -ENOMEM;
95 95
96 envp[i] = NULL; 96 envp[i] = NULL;
@@ -98,8 +98,8 @@ static int namespace_hotplug(struct kset *kset, struct kobject *kobj,
98 return 0; 98 return 0;
99} 99}
100 100
101static struct kset_hotplug_ops namespace_hotplug_ops = { 101static struct kset_uevent_ops namespace_uevent_ops = {
102 .hotplug = &namespace_hotplug, 102 .uevent = &namespace_uevent,
103}; 103};
104 104
105static struct kset acpi_namespace_kset = { 105static struct kset acpi_namespace_kset = {
@@ -108,7 +108,7 @@ static struct kset acpi_namespace_kset = {
108 }, 108 },
109 .subsys = &acpi_subsys, 109 .subsys = &acpi_subsys,
110 .ktype = &ktype_acpi_ns, 110 .ktype = &ktype_acpi_ns,
111 .hotplug_ops = &namespace_hotplug_ops, 111 .uevent_ops = &namespace_uevent_ops,
112}; 112};
113 113
114static void acpi_device_register(struct acpi_device *device, 114static void acpi_device_register(struct acpi_device *device,
@@ -347,7 +347,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
347} 347}
348 348
349/* -------------------------------------------------------------------------- 349/* --------------------------------------------------------------------------
350 ACPI hotplug sysfs device file support 350 ACPI sysfs device file support
351 -------------------------------------------------------------------------- */ 351 -------------------------------------------------------------------------- */
352static ssize_t acpi_eject_store(struct acpi_device *device, 352static ssize_t acpi_eject_store(struct acpi_device *device,
353 const char *buf, size_t count); 353 const char *buf, size_t count);
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 934149c1512..f0eff3dac58 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -19,11 +19,11 @@ config PREVENT_FIRMWARE_BUILD
19 If unsure say Y here. 19 If unsure say Y here.
20 20
21config FW_LOADER 21config FW_LOADER
22 tristate "Hotplug firmware loading support" 22 tristate "Userspace firmware loading support"
23 select HOTPLUG 23 select HOTPLUG
24 ---help--- 24 ---help---
25 This option is provided for the case where no in-kernel-tree modules 25 This option is provided for the case where no in-kernel-tree modules
26 require hotplug firmware loading support, but a module built outside 26 require userspace firmware loading support, but a module built outside
27 the kernel tree does. 27 the kernel tree does.
28 28
29config DEBUG_DRIVER 29config DEBUG_DRIVER
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index fa601b085eb..29f6af554e7 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -152,7 +152,11 @@ static ssize_t driver_unbind(struct device_driver *drv,
152 152
153 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); 153 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
154 if (dev && dev->driver == drv) { 154 if (dev && dev->driver == drv) {
155 if (dev->parent) /* Needed for USB */
156 down(&dev->parent->sem);
155 device_release_driver(dev); 157 device_release_driver(dev);
158 if (dev->parent)
159 up(&dev->parent->sem);
156 err = count; 160 err = count;
157 } 161 }
158 put_device(dev); 162 put_device(dev);
@@ -175,9 +179,13 @@ static ssize_t driver_bind(struct device_driver *drv,
175 179
176 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper); 180 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
177 if (dev && dev->driver == NULL) { 181 if (dev && dev->driver == NULL) {
182 if (dev->parent) /* Needed for USB */
183 down(&dev->parent->sem);
178 down(&dev->sem); 184 down(&dev->sem);
179 err = driver_probe_device(drv, dev); 185 err = driver_probe_device(drv, dev);
180 up(&dev->sem); 186 up(&dev->sem);
187 if (dev->parent)
188 up(&dev->parent->sem);
181 } 189 }
182 put_device(dev); 190 put_device(dev);
183 put_bus(bus); 191 put_bus(bus);
@@ -420,6 +428,26 @@ static void driver_remove_attrs(struct bus_type * bus, struct device_driver * dr
420 } 428 }
421} 429}
422 430
431#ifdef CONFIG_HOTPLUG
432/*
433 * Thanks to drivers making their tables __devinit, we can't allow manual
434 * bind and unbind from userspace unless CONFIG_HOTPLUG is enabled.
435 */
436static void add_bind_files(struct device_driver *drv)
437{
438 driver_create_file(drv, &driver_attr_unbind);
439 driver_create_file(drv, &driver_attr_bind);
440}
441
442static void remove_bind_files(struct device_driver *drv)
443{
444 driver_remove_file(drv, &driver_attr_bind);
445 driver_remove_file(drv, &driver_attr_unbind);
446}
447#else
448static inline void add_bind_files(struct device_driver *drv) {}
449static inline void remove_bind_files(struct device_driver *drv) {}
450#endif
423 451
424/** 452/**
425 * bus_add_driver - Add a driver to the bus. 453 * bus_add_driver - Add a driver to the bus.
@@ -449,8 +477,7 @@ int bus_add_driver(struct device_driver * drv)
449 module_add_driver(drv->owner, drv); 477 module_add_driver(drv->owner, drv);
450 478
451 driver_add_attrs(bus, drv); 479 driver_add_attrs(bus, drv);
452 driver_create_file(drv, &driver_attr_unbind); 480 add_bind_files(drv);
453 driver_create_file(drv, &driver_attr_bind);
454 } 481 }
455 return error; 482 return error;
456} 483}
@@ -468,8 +495,7 @@ int bus_add_driver(struct device_driver * drv)
468void bus_remove_driver(struct device_driver * drv) 495void bus_remove_driver(struct device_driver * drv)
469{ 496{
470 if (drv->bus) { 497 if (drv->bus) {
471 driver_remove_file(drv, &driver_attr_bind); 498 remove_bind_files(drv);
472 driver_remove_file(drv, &driver_attr_unbind);
473 driver_remove_attrs(drv->bus, drv); 499 driver_remove_attrs(drv->bus, drv);
474 klist_remove(&drv->knode_bus); 500 klist_remove(&drv->knode_bus);
475 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); 501 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
@@ -484,8 +510,13 @@ void bus_remove_driver(struct device_driver * drv)
484/* Helper for bus_rescan_devices's iter */ 510/* Helper for bus_rescan_devices's iter */
485static int bus_rescan_devices_helper(struct device *dev, void *data) 511static int bus_rescan_devices_helper(struct device *dev, void *data)
486{ 512{
487 if (!dev->driver) 513 if (!dev->driver) {
514 if (dev->parent) /* Needed for USB */
515 down(&dev->parent->sem);
488 device_attach(dev); 516 device_attach(dev);
517 if (dev->parent)
518 up(&dev->parent->sem);
519 }
489 return 0; 520 return 0;
490} 521}
491 522
diff --git a/drivers/base/class.c b/drivers/base/class.c
index db65fd0babe..df7fdabd073 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -178,7 +178,7 @@ static void class_device_create_release(struct class_device *class_dev)
178} 178}
179 179
180/* needed to allow these devices to have parent class devices */ 180/* needed to allow these devices to have parent class devices */
181static int class_device_create_hotplug(struct class_device *class_dev, 181static int class_device_create_uevent(struct class_device *class_dev,
182 char **envp, int num_envp, 182 char **envp, int num_envp,
183 char *buffer, int buffer_size) 183 char *buffer, int buffer_size)
184{ 184{
@@ -331,7 +331,7 @@ static struct kobj_type ktype_class_device = {
331 .release = class_dev_release, 331 .release = class_dev_release,
332}; 332};
333 333
334static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) 334static int class_uevent_filter(struct kset *kset, struct kobject *kobj)
335{ 335{
336 struct kobj_type *ktype = get_ktype(kobj); 336 struct kobj_type *ktype = get_ktype(kobj);
337 337
@@ -343,14 +343,14 @@ static int class_hotplug_filter(struct kset *kset, struct kobject *kobj)
343 return 0; 343 return 0;
344} 344}
345 345
346static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj) 346static const char *class_uevent_name(struct kset *kset, struct kobject *kobj)
347{ 347{
348 struct class_device *class_dev = to_class_dev(kobj); 348 struct class_device *class_dev = to_class_dev(kobj);
349 349
350 return class_dev->class->name; 350 return class_dev->class->name;
351} 351}
352 352
353static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp, 353static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
354 int num_envp, char *buffer, int buffer_size) 354 int num_envp, char *buffer, int buffer_size)
355{ 355{
356 struct class_device *class_dev = to_class_dev(kobj); 356 struct class_device *class_dev = to_class_dev(kobj);
@@ -365,29 +365,29 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
365 struct device *dev = class_dev->dev; 365 struct device *dev = class_dev->dev;
366 char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); 366 char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
367 367
368 add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, 368 add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
369 &length, "PHYSDEVPATH=%s", path); 369 &length, "PHYSDEVPATH=%s", path);
370 kfree(path); 370 kfree(path);
371 371
372 if (dev->bus) 372 if (dev->bus)
373 add_hotplug_env_var(envp, num_envp, &i, 373 add_uevent_var(envp, num_envp, &i,
374 buffer, buffer_size, &length, 374 buffer, buffer_size, &length,
375 "PHYSDEVBUS=%s", dev->bus->name); 375 "PHYSDEVBUS=%s", dev->bus->name);
376 376
377 if (dev->driver) 377 if (dev->driver)
378 add_hotplug_env_var(envp, num_envp, &i, 378 add_uevent_var(envp, num_envp, &i,
379 buffer, buffer_size, &length, 379 buffer, buffer_size, &length,
380 "PHYSDEVDRIVER=%s", dev->driver->name); 380 "PHYSDEVDRIVER=%s", dev->driver->name);
381 } 381 }
382 382
383 if (MAJOR(class_dev->devt)) { 383 if (MAJOR(class_dev->devt)) {
384 add_hotplug_env_var(envp, num_envp, &i, 384 add_uevent_var(envp, num_envp, &i,
385 buffer, buffer_size, &length, 385 buffer, buffer_size, &length,
386 "MAJOR=%u", MAJOR(class_dev->devt)); 386 "MAJOR=%u", MAJOR(class_dev->devt));
387 387
388 add_hotplug_env_var(envp, num_envp, &i, 388 add_uevent_var(envp, num_envp, &i,
389 buffer, buffer_size, &length, 389 buffer, buffer_size, &length,
390 "MINOR=%u", MINOR(class_dev->devt)); 390 "MINOR=%u", MINOR(class_dev->devt));
391 } 391 }
392 392
393 /* terminate, set to next free slot, shrink available space */ 393 /* terminate, set to next free slot, shrink available space */
@@ -397,30 +397,30 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
397 buffer = &buffer[length]; 397 buffer = &buffer[length];
398 buffer_size -= length; 398 buffer_size -= length;
399 399
400 if (class_dev->hotplug) { 400 if (class_dev->uevent) {
401 /* have the class device specific function add its stuff */ 401 /* have the class device specific function add its stuff */
402 retval = class_dev->hotplug(class_dev, envp, num_envp, 402 retval = class_dev->uevent(class_dev, envp, num_envp,
403 buffer, buffer_size); 403 buffer, buffer_size);
404 if (retval) 404 if (retval)
405 pr_debug("class_dev->hotplug() returned %d\n", retval); 405 pr_debug("class_dev->uevent() returned %d\n", retval);
406 } else if (class_dev->class->hotplug) { 406 } else if (class_dev->class->uevent) {
407 /* have the class specific function add its stuff */ 407 /* have the class specific function add its stuff */
408 retval = class_dev->class->hotplug(class_dev, envp, num_envp, 408 retval = class_dev->class->uevent(class_dev, envp, num_envp,
409 buffer, buffer_size); 409 buffer, buffer_size);
410 if (retval) 410 if (retval)
411 pr_debug("class->hotplug() returned %d\n", retval); 411 pr_debug("class->uevent() returned %d\n", retval);
412 } 412 }
413 413
414 return retval; 414 return retval;
415} 415}
416 416
417static struct kset_hotplug_ops class_hotplug_ops = { 417static struct kset_uevent_ops class_uevent_ops = {
418 .filter = class_hotplug_filter, 418 .filter = class_uevent_filter,
419 .name = class_hotplug_name, 419 .name = class_uevent_name,
420 .hotplug = class_hotplug, 420 .uevent = class_uevent,
421}; 421};
422 422
423static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops); 423static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);
424 424
425 425
426static int class_device_add_attrs(struct class_device * cd) 426static int class_device_add_attrs(struct class_device * cd)
@@ -464,7 +464,7 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf)
464static ssize_t store_uevent(struct class_device *class_dev, 464static ssize_t store_uevent(struct class_device *class_dev,
465 const char *buf, size_t count) 465 const char *buf, size_t count)
466{ 466{
467 kobject_hotplug(&class_dev->kobj, KOBJ_ADD); 467 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
468 return count; 468 return count;
469} 469}
470 470
@@ -559,7 +559,7 @@ int class_device_add(struct class_device *class_dev)
559 class_name); 559 class_name);
560 } 560 }
561 561
562 kobject_hotplug(&class_dev->kobj, KOBJ_ADD); 562 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
563 563
564 /* notify any interfaces this device is now here */ 564 /* notify any interfaces this device is now here */
565 if (parent_class) { 565 if (parent_class) {
@@ -632,7 +632,7 @@ struct class_device *class_device_create(struct class *cls,
632 class_dev->class = cls; 632 class_dev->class = cls;
633 class_dev->parent = parent; 633 class_dev->parent = parent;
634 class_dev->release = class_device_create_release; 634 class_dev->release = class_device_create_release;
635 class_dev->hotplug = class_device_create_hotplug; 635 class_dev->uevent = class_device_create_uevent;
636 636
637 va_start(args, fmt); 637 va_start(args, fmt);
638 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args); 638 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args);
@@ -674,7 +674,7 @@ void class_device_del(struct class_device *class_dev)
674 class_device_remove_file(class_dev, class_dev->devt_attr); 674 class_device_remove_file(class_dev, class_dev->devt_attr);
675 class_device_remove_attrs(class_dev); 675 class_device_remove_attrs(class_dev);
676 676
677 kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE); 677 kobject_uevent(&class_dev->kobj, KOBJ_REMOVE);
678 kobject_del(&class_dev->kobj); 678 kobject_del(&class_dev->kobj);
679 679
680 class_device_put(parent_device); 680 class_device_put(parent_device);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8615b42b517..fd8059920db 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -90,7 +90,7 @@ static struct kobj_type ktype_device = {
90}; 90};
91 91
92 92
93static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj) 93static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
94{ 94{
95 struct kobj_type *ktype = get_ktype(kobj); 95 struct kobj_type *ktype = get_ktype(kobj);
96 96
@@ -102,14 +102,14 @@ static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj)
102 return 0; 102 return 0;
103} 103}
104 104
105static const char *dev_hotplug_name(struct kset *kset, struct kobject *kobj) 105static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)
106{ 106{
107 struct device *dev = to_dev(kobj); 107 struct device *dev = to_dev(kobj);
108 108
109 return dev->bus->name; 109 return dev->bus->name;
110} 110}
111 111
112static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, 112static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,
113 int num_envp, char *buffer, int buffer_size) 113 int num_envp, char *buffer, int buffer_size)
114{ 114{
115 struct device *dev = to_dev(kobj); 115 struct device *dev = to_dev(kobj);
@@ -119,15 +119,15 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
119 119
120 /* add bus name of physical device */ 120 /* add bus name of physical device */
121 if (dev->bus) 121 if (dev->bus)
122 add_hotplug_env_var(envp, num_envp, &i, 122 add_uevent_var(envp, num_envp, &i,
123 buffer, buffer_size, &length, 123 buffer, buffer_size, &length,
124 "PHYSDEVBUS=%s", dev->bus->name); 124 "PHYSDEVBUS=%s", dev->bus->name);
125 125
126 /* add driver name of physical device */ 126 /* add driver name of physical device */
127 if (dev->driver) 127 if (dev->driver)
128 add_hotplug_env_var(envp, num_envp, &i, 128 add_uevent_var(envp, num_envp, &i,
129 buffer, buffer_size, &length, 129 buffer, buffer_size, &length,
130 "PHYSDEVDRIVER=%s", dev->driver->name); 130 "PHYSDEVDRIVER=%s", dev->driver->name);
131 131
132 /* terminate, set to next free slot, shrink available space */ 132 /* terminate, set to next free slot, shrink available space */
133 envp[i] = NULL; 133 envp[i] = NULL;
@@ -136,11 +136,11 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
136 buffer = &buffer[length]; 136 buffer = &buffer[length];
137 buffer_size -= length; 137 buffer_size -= length;
138 138
139 if (dev->bus && dev->bus->hotplug) { 139 if (dev->bus && dev->bus->uevent) {
140 /* have the bus specific function add its stuff */ 140 /* have the bus specific function add its stuff */
141 retval = dev->bus->hotplug (dev, envp, num_envp, buffer, buffer_size); 141 retval = dev->bus->uevent(dev, envp, num_envp, buffer, buffer_size);
142 if (retval) { 142 if (retval) {
143 pr_debug ("%s - hotplug() returned %d\n", 143 pr_debug ("%s - uevent() returned %d\n",
144 __FUNCTION__, retval); 144 __FUNCTION__, retval);
145 } 145 }
146 } 146 }
@@ -148,16 +148,16 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
148 return retval; 148 return retval;
149} 149}
150 150
151static struct kset_hotplug_ops device_hotplug_ops = { 151static struct kset_uevent_ops device_uevent_ops = {
152 .filter = dev_hotplug_filter, 152 .filter = dev_uevent_filter,
153 .name = dev_hotplug_name, 153 .name = dev_uevent_name,
154 .hotplug = dev_hotplug, 154 .uevent = dev_uevent,
155}; 155};
156 156
157static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, 157static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
158 const char *buf, size_t count) 158 const char *buf, size_t count)
159{ 159{
160 kobject_hotplug(&dev->kobj, KOBJ_ADD); 160 kobject_uevent(&dev->kobj, KOBJ_ADD);
161 return count; 161 return count;
162} 162}
163 163
@@ -165,7 +165,7 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
165 * device_subsys - structure to be registered with kobject core. 165 * device_subsys - structure to be registered with kobject core.
166 */ 166 */
167 167
168decl_subsys(devices, &ktype_device, &device_hotplug_ops); 168decl_subsys(devices, &ktype_device, &device_uevent_ops);
169 169
170 170
171/** 171/**
@@ -274,7 +274,7 @@ int device_add(struct device *dev)
274 dev->uevent_attr.store = store_uevent; 274 dev->uevent_attr.store = store_uevent;
275 device_create_file(dev, &dev->uevent_attr); 275 device_create_file(dev, &dev->uevent_attr);
276 276
277 kobject_hotplug(&dev->kobj, KOBJ_ADD); 277 kobject_uevent(&dev->kobj, KOBJ_ADD);
278 if ((error = device_pm_add(dev))) 278 if ((error = device_pm_add(dev)))
279 goto PMError; 279 goto PMError;
280 if ((error = bus_add_device(dev))) 280 if ((error = bus_add_device(dev)))
@@ -291,7 +291,7 @@ int device_add(struct device *dev)
291 BusError: 291 BusError:
292 device_pm_remove(dev); 292 device_pm_remove(dev);
293 PMError: 293 PMError:
294 kobject_hotplug(&dev->kobj, KOBJ_REMOVE); 294 kobject_uevent(&dev->kobj, KOBJ_REMOVE);
295 kobject_del(&dev->kobj); 295 kobject_del(&dev->kobj);
296 Error: 296 Error:
297 if (parent) 297 if (parent)
@@ -374,7 +374,7 @@ void device_del(struct device * dev)
374 platform_notify_remove(dev); 374 platform_notify_remove(dev);
375 bus_remove_device(dev); 375 bus_remove_device(dev);
376 device_pm_remove(dev); 376 device_pm_remove(dev);
377 kobject_hotplug(&dev->kobj, KOBJ_REMOVE); 377 kobject_uevent(&dev->kobj, KOBJ_REMOVE);
378 kobject_del(&dev->kobj); 378 kobject_del(&dev->kobj);
379 if (parent) 379 if (parent)
380 put_device(parent); 380 put_device(parent);
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index a95844790f7..281d26784d2 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -41,14 +41,14 @@ static ssize_t store_online(struct sys_device *dev, const char *buf,
41 case '0': 41 case '0':
42 ret = cpu_down(cpu->sysdev.id); 42 ret = cpu_down(cpu->sysdev.id);
43 if (!ret) 43 if (!ret)
44 kobject_hotplug(&dev->kobj, KOBJ_OFFLINE); 44 kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
45 break; 45 break;
46 case '1': 46 case '1':
47 ret = smp_prepare_cpu(cpu->sysdev.id); 47 ret = smp_prepare_cpu(cpu->sysdev.id);
48 if (!ret) 48 if (!ret)
49 ret = cpu_up(cpu->sysdev.id); 49 ret = cpu_up(cpu->sysdev.id);
50 if (!ret) 50 if (!ret)
51 kobject_hotplug(&dev->kobj, KOBJ_ONLINE); 51 kobject_uevent(&dev->kobj, KOBJ_ONLINE);
52 break; 52 break;
53 default: 53 default:
54 ret = -EINVAL; 54 ret = -EINVAL;
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 3b419c9a1e7..2b905016664 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -65,7 +65,8 @@ void device_bind_driver(struct device * dev)
65 * This function returns 1 if a match is found, an error if one 65 * This function returns 1 if a match is found, an error if one
66 * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. 66 * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.
67 * 67 *
68 * This function must be called with @dev->sem held. 68 * This function must be called with @dev->sem held. When called
69 * for a USB interface, @dev->parent->sem must be held as well.
69 */ 70 */
70int driver_probe_device(struct device_driver * drv, struct device * dev) 71int driver_probe_device(struct device_driver * drv, struct device * dev)
71{ 72{
@@ -123,6 +124,8 @@ static int __device_attach(struct device_driver * drv, void * data)
123 * 124 *
124 * Returns 1 if the device was bound to a driver; 125 * Returns 1 if the device was bound to a driver;
125 * 0 if no matching device was found; error code otherwise. 126 * 0 if no matching device was found; error code otherwise.
127 *
128 * When called for a USB interface, @dev->parent->sem must be held.
126 */ 129 */
127int device_attach(struct device * dev) 130int device_attach(struct device * dev)
128{ 131{
@@ -152,10 +155,14 @@ static int __driver_attach(struct device * dev, void * data)
152 * is an error. 155 * is an error.
153 */ 156 */
154 157
158 if (dev->parent) /* Needed for USB */
159 down(&dev->parent->sem);
155 down(&dev->sem); 160 down(&dev->sem);
156 if (!dev->driver) 161 if (!dev->driver)
157 driver_probe_device(drv, dev); 162 driver_probe_device(drv, dev);
158 up(&dev->sem); 163 up(&dev->sem);
164 if (dev->parent)
165 up(&dev->parent->sem);
159 166
160 return 0; 167 return 0;
161} 168}
@@ -181,6 +188,8 @@ void driver_attach(struct device_driver * drv)
181 * Manually detach device from driver. 188 * Manually detach device from driver.
182 * 189 *
183 * __device_release_driver() must be called with @dev->sem held. 190 * __device_release_driver() must be called with @dev->sem held.
191 * When called for a USB interface, @dev->parent->sem must be held
192 * as well.
184 */ 193 */
185 194
186static void __device_release_driver(struct device * dev) 195static void __device_release_driver(struct device * dev)
@@ -233,10 +242,14 @@ void driver_detach(struct device_driver * drv)
233 get_device(dev); 242 get_device(dev);
234 spin_unlock(&drv->klist_devices.k_lock); 243 spin_unlock(&drv->klist_devices.k_lock);
235 244
245 if (dev->parent) /* Needed for USB */
246 down(&dev->parent->sem);
236 down(&dev->sem); 247 down(&dev->sem);
237 if (dev->driver == drv) 248 if (dev->driver == drv)
238 __device_release_driver(dev); 249 __device_release_driver(dev);
239 up(&dev->sem); 250 up(&dev->sem);
251 if (dev->parent)
252 up(&dev->parent->sem);
240 put_device(dev); 253 put_device(dev);
241 } 254 }
242} 255}
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 59dacb6552c..5b3d5e9ddcb 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -85,17 +85,17 @@ firmware_timeout_store(struct class *class, const char *buf, size_t count)
85static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); 85static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);
86 86
87static void fw_class_dev_release(struct class_device *class_dev); 87static void fw_class_dev_release(struct class_device *class_dev);
88int firmware_class_hotplug(struct class_device *dev, char **envp, 88int firmware_class_uevent(struct class_device *dev, char **envp,
89 int num_envp, char *buffer, int buffer_size); 89 int num_envp, char *buffer, int buffer_size);
90 90
91static struct class firmware_class = { 91static struct class firmware_class = {
92 .name = "firmware", 92 .name = "firmware",
93 .hotplug = firmware_class_hotplug, 93 .uevent = firmware_class_uevent,
94 .release = fw_class_dev_release, 94 .release = fw_class_dev_release,
95}; 95};
96 96
97int 97int
98firmware_class_hotplug(struct class_device *class_dev, char **envp, 98firmware_class_uevent(struct class_device *class_dev, char **envp,
99 int num_envp, char *buffer, int buffer_size) 99 int num_envp, char *buffer, int buffer_size)
100{ 100{
101 struct firmware_priv *fw_priv = class_get_devdata(class_dev); 101 struct firmware_priv *fw_priv = class_get_devdata(class_dev);
@@ -104,13 +104,12 @@ firmware_class_hotplug(struct class_device *class_dev, char **envp,
104 if (!test_bit(FW_STATUS_READY, &fw_priv->status)) 104 if (!test_bit(FW_STATUS_READY, &fw_priv->status))
105 return -ENODEV; 105 return -ENODEV;
106 106
107 if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, 107 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
108 "FIRMWARE=%s", fw_priv->fw_id)) 108 "FIRMWARE=%s", fw_priv->fw_id))
109 return -ENOMEM; 109 return -ENOMEM;
110 if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, 110 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
111 "TIMEOUT=%i", loading_timeout)) 111 "TIMEOUT=%i", loading_timeout))
112 return -ENOMEM; 112 return -ENOMEM;
113
114 envp[i] = NULL; 113 envp[i] = NULL;
115 114
116 return 0; 115 return 0;
@@ -352,7 +351,7 @@ error_kfree:
352 351
353static int 352static int
354fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, 353fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
355 const char *fw_name, struct device *device, int hotplug) 354 const char *fw_name, struct device *device, int uevent)
356{ 355{
357 struct class_device *class_dev; 356 struct class_device *class_dev;
358 struct firmware_priv *fw_priv; 357 struct firmware_priv *fw_priv;
@@ -384,7 +383,7 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
384 goto error_unreg; 383 goto error_unreg;
385 } 384 }
386 385
387 if (hotplug) 386 if (uevent)
388 set_bit(FW_STATUS_READY, &fw_priv->status); 387 set_bit(FW_STATUS_READY, &fw_priv->status);
389 else 388 else
390 set_bit(FW_STATUS_READY_NOHOTPLUG, &fw_priv->status); 389 set_bit(FW_STATUS_READY_NOHOTPLUG, &fw_priv->status);
@@ -399,7 +398,7 @@ out:
399 398
400static int 399static int
401_request_firmware(const struct firmware **firmware_p, const char *name, 400_request_firmware(const struct firmware **firmware_p, const char *name,
402 struct device *device, int hotplug) 401 struct device *device, int uevent)
403{ 402{
404 struct class_device *class_dev; 403 struct class_device *class_dev;
405 struct firmware_priv *fw_priv; 404 struct firmware_priv *fw_priv;
@@ -418,19 +417,19 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
418 } 417 }
419 418
420 retval = fw_setup_class_device(firmware, &class_dev, name, device, 419 retval = fw_setup_class_device(firmware, &class_dev, name, device,
421 hotplug); 420 uevent);
422 if (retval) 421 if (retval)
423 goto error_kfree_fw; 422 goto error_kfree_fw;
424 423
425 fw_priv = class_get_devdata(class_dev); 424 fw_priv = class_get_devdata(class_dev);
426 425
427 if (hotplug) { 426 if (uevent) {
428 if (loading_timeout > 0) { 427 if (loading_timeout > 0) {
429 fw_priv->timeout.expires = jiffies + loading_timeout * HZ; 428 fw_priv->timeout.expires = jiffies + loading_timeout * HZ;
430 add_timer(&fw_priv->timeout); 429 add_timer(&fw_priv->timeout);
431 } 430 }
432 431
433 kobject_hotplug(&class_dev->kobj, KOBJ_ADD); 432 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
434 wait_for_completion(&fw_priv->completion); 433 wait_for_completion(&fw_priv->completion);
435 set_bit(FW_STATUS_DONE, &fw_priv->status); 434 set_bit(FW_STATUS_DONE, &fw_priv->status);
436 del_timer_sync(&fw_priv->timeout); 435 del_timer_sync(&fw_priv->timeout);
@@ -456,7 +455,7 @@ out:
456} 455}
457 456
458/** 457/**
459 * request_firmware: - request firmware to hotplug and wait for it 458 * request_firmware: - send firmware request and wait for it
460 * @firmware_p: pointer to firmware image 459 * @firmware_p: pointer to firmware image
461 * @name: name of firmware file 460 * @name: name of firmware file
462 * @device: device for which firmware is being loaded 461 * @device: device for which firmware is being loaded
@@ -466,7 +465,7 @@ out:
466 * 465 *
467 * Should be called from user context where sleeping is allowed. 466 * Should be called from user context where sleeping is allowed.
468 * 467 *
469 * @name will be used as $FIRMWARE in the hotplug environment and 468 * @name will be used as $FIRMWARE in the uevent environment and
470 * should be distinctive enough not to be confused with any other 469 * should be distinctive enough not to be confused with any other
471 * firmware image for this or any other device. 470 * firmware image for this or any other device.
472 **/ 471 **/
@@ -474,8 +473,8 @@ int
474request_firmware(const struct firmware **firmware_p, const char *name, 473request_firmware(const struct firmware **firmware_p, const char *name,
475 struct device *device) 474 struct device *device)
476{ 475{
477 int hotplug = 1; 476 int uevent = 1;
478 return _request_firmware(firmware_p, name, device, hotplug); 477 return _request_firmware(firmware_p, name, device, uevent);
479} 478}
480 479
481/** 480/**
@@ -518,7 +517,7 @@ struct firmware_work {
518 struct device *device; 517 struct device *device;
519 void *context; 518 void *context;
520 void (*cont)(const struct firmware *fw, void *context); 519 void (*cont)(const struct firmware *fw, void *context);
521 int hotplug; 520 int uevent;
522}; 521};
523 522
524static int 523static int
@@ -533,7 +532,7 @@ request_firmware_work_func(void *arg)
533 } 532 }
534 daemonize("%s/%s", "firmware", fw_work->name); 533 daemonize("%s/%s", "firmware", fw_work->name);
535 ret = _request_firmware(&fw, fw_work->name, fw_work->device, 534 ret = _request_firmware(&fw, fw_work->name, fw_work->device,
536 fw_work->hotplug); 535 fw_work->uevent);
537 if (ret < 0) 536 if (ret < 0)
538 fw_work->cont(NULL, fw_work->context); 537 fw_work->cont(NULL, fw_work->context);
539 else { 538 else {
@@ -548,7 +547,7 @@ request_firmware_work_func(void *arg)
548/** 547/**
549 * request_firmware_nowait: asynchronous version of request_firmware 548 * request_firmware_nowait: asynchronous version of request_firmware
550 * @module: module requesting the firmware 549 * @module: module requesting the firmware
551 * @hotplug: invokes hotplug event to copy the firmware image if this flag 550 * @uevent: sends uevent to copy the firmware image if this flag
552 * is non-zero else the firmware copy must be done manually. 551 * is non-zero else the firmware copy must be done manually.
553 * @name: name of firmware file 552 * @name: name of firmware file
554 * @device: device for which firmware is being loaded 553 * @device: device for which firmware is being loaded
@@ -562,7 +561,7 @@ request_firmware_work_func(void *arg)
562 **/ 561 **/
563int 562int
564request_firmware_nowait( 563request_firmware_nowait(
565 struct module *module, int hotplug, 564 struct module *module, int uevent,
566 const char *name, struct device *device, void *context, 565 const char *name, struct device *device, void *context,
567 void (*cont)(const struct firmware *fw, void *context)) 566 void (*cont)(const struct firmware *fw, void *context))
568{ 567{
@@ -583,7 +582,7 @@ request_firmware_nowait(
583 .device = device, 582 .device = device,
584 .context = context, 583 .context = context,
585 .cont = cont, 584 .cont = cont,
586 .hotplug = hotplug, 585 .uevent = uevent,
587 }; 586 };
588 587
589 ret = kernel_thread(request_firmware_work_func, fw_work, 588 ret = kernel_thread(request_firmware_work_func, fw_work,
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index bc3ca6a656b..7e1d077874d 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -29,12 +29,12 @@ static struct sysdev_class memory_sysdev_class = {
29 set_kset_name(MEMORY_CLASS_NAME), 29 set_kset_name(MEMORY_CLASS_NAME),
30}; 30};
31 31
32static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj) 32static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
33{ 33{
34 return MEMORY_CLASS_NAME; 34 return MEMORY_CLASS_NAME;
35} 35}
36 36
37static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp, 37static int memory_uevent(struct kset *kset, struct kobject *kobj, char **envp,
38 int num_envp, char *buffer, int buffer_size) 38 int num_envp, char *buffer, int buffer_size)
39{ 39{
40 int retval = 0; 40 int retval = 0;
@@ -42,9 +42,9 @@ static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
42 return retval; 42 return retval;
43} 43}
44 44
45static struct kset_hotplug_ops memory_hotplug_ops = { 45static struct kset_uevent_ops memory_uevent_ops = {
46 .name = memory_hotplug_name, 46 .name = memory_uevent_name,
47 .hotplug = memory_hotplug, 47 .uevent = memory_uevent,
48}; 48};
49 49
50static struct notifier_block *memory_chain; 50static struct notifier_block *memory_chain;
@@ -431,7 +431,7 @@ int __init memory_dev_init(void)
431 unsigned int i; 431 unsigned int i;
432 int ret; 432 int ret;
433 433
434 memory_sysdev_class.kset.hotplug_ops = &memory_hotplug_ops; 434 memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops;
435 ret = sysdev_class_register(&memory_sysdev_class); 435 ret = sysdev_class_register(&memory_sysdev_class);
436 436
437 /* 437 /*
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 8827dafba94..0f81731bdfa 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -25,6 +25,7 @@
25struct device platform_bus = { 25struct device platform_bus = {
26 .bus_id = "platform", 26 .bus_id = "platform",
27}; 27};
28EXPORT_SYMBOL_GPL(platform_bus);
28 29
29/** 30/**
30 * platform_get_resource - get a resource for a device 31 * platform_get_resource - get a resource for a device
@@ -49,6 +50,7 @@ platform_get_resource(struct platform_device *dev, unsigned int type,
49 } 50 }
50 return NULL; 51 return NULL;
51} 52}
53EXPORT_SYMBOL_GPL(platform_get_resource);
52 54
53/** 55/**
54 * platform_get_irq - get an IRQ for a device 56 * platform_get_irq - get an IRQ for a device
@@ -61,6 +63,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
61 63
62 return r ? r->start : 0; 64 return r ? r->start : 0;
63} 65}
66EXPORT_SYMBOL_GPL(platform_get_irq);
64 67
65/** 68/**
66 * platform_get_resource_byname - get a resource for a device by name 69 * platform_get_resource_byname - get a resource for a device by name
@@ -84,6 +87,7 @@ platform_get_resource_byname(struct platform_device *dev, unsigned int type,
84 } 87 }
85 return NULL; 88 return NULL;
86} 89}
90EXPORT_SYMBOL_GPL(platform_get_resource_byname);
87 91
88/** 92/**
89 * platform_get_irq - get an IRQ for a device 93 * platform_get_irq - get an IRQ for a device
@@ -96,6 +100,7 @@ int platform_get_irq_byname(struct platform_device *dev, char *name)
96 100
97 return r ? r->start : 0; 101 return r ? r->start : 0;
98} 102}
103EXPORT_SYMBOL_GPL(platform_get_irq_byname);
99 104
100/** 105/**
101 * platform_add_devices - add a numbers of platform devices 106 * platform_add_devices - add a numbers of platform devices
@@ -117,6 +122,7 @@ int platform_add_devices(struct platform_device **devs, int num)
117 122
118 return ret; 123 return ret;
119} 124}
125EXPORT_SYMBOL_GPL(platform_add_devices);
120 126
121struct platform_object { 127struct platform_object {
122 struct platform_device pdev; 128 struct platform_device pdev;
@@ -168,7 +174,7 @@ struct platform_device *platform_device_alloc(const char *name, unsigned int id)
168 pa->pdev.dev.release = platform_device_release; 174 pa->pdev.dev.release = platform_device_release;
169 } 175 }
170 176
171 return pa ? &pa->pdev : NULL; 177 return pa ? &pa->pdev : NULL;
172} 178}
173EXPORT_SYMBOL_GPL(platform_device_alloc); 179EXPORT_SYMBOL_GPL(platform_device_alloc);
174 180
@@ -257,7 +263,7 @@ int platform_device_add(struct platform_device *pdev)
257 p = &ioport_resource; 263 p = &ioport_resource;
258 } 264 }
259 265
260 if (p && request_resource(p, r)) { 266 if (p && insert_resource(p, r)) {
261 printk(KERN_ERR 267 printk(KERN_ERR
262 "%s: failed to claim resource %d\n", 268 "%s: failed to claim resource %d\n",
263 pdev->dev.bus_id, i); 269 pdev->dev.bus_id, i);
@@ -282,24 +288,13 @@ int platform_device_add(struct platform_device *pdev)
282EXPORT_SYMBOL_GPL(platform_device_add); 288EXPORT_SYMBOL_GPL(platform_device_add);
283 289
284/** 290/**
285 * platform_device_register - add a platform-level device 291 * platform_device_del - remove a platform-level device
286 * @pdev: platform device we're adding
287 *
288 */
289int platform_device_register(struct platform_device * pdev)
290{
291 device_initialize(&pdev->dev);
292 return platform_device_add(pdev);
293}
294
295/**
296 * platform_device_unregister - remove a platform-level device
297 * @pdev: platform device we're removing 292 * @pdev: platform device we're removing
298 * 293 *
299 * Note that this function will also release all memory- and port-based 294 * Note that this function will also release all memory- and port-based
300 * resources owned by the device (@dev->resource). 295 * resources owned by the device (@dev->resource).
301 */ 296 */
302void platform_device_unregister(struct platform_device * pdev) 297void platform_device_del(struct platform_device *pdev)
303{ 298{
304 int i; 299 int i;
305 300
@@ -310,9 +305,37 @@ void platform_device_unregister(struct platform_device * pdev)
310 release_resource(r); 305 release_resource(r);
311 } 306 }
312 307
313 device_unregister(&pdev->dev); 308 device_del(&pdev->dev);
314 } 309 }
315} 310}
311EXPORT_SYMBOL_GPL(platform_device_del);
312
313/**
314 * platform_device_register - add a platform-level device
315 * @pdev: platform device we're adding
316 *
317 */
318int platform_device_register(struct platform_device * pdev)
319{
320 device_initialize(&pdev->dev);
321 return platform_device_add(pdev);
322}
323EXPORT_SYMBOL_GPL(platform_device_register);
324
325/**
326 * platform_device_unregister - unregister a platform-level device
327 * @pdev: platform device we're unregistering
328 *
329 * Unregistration is done in 2 steps. Fisrt we release all resources
330 * and remove it from the sybsystem, then we drop reference count by
331 * calling platform_device_put().
332 */
333void platform_device_unregister(struct platform_device * pdev)
334{
335 platform_device_del(pdev);
336 platform_device_put(pdev);
337}
338EXPORT_SYMBOL_GPL(platform_device_unregister);
316 339
317/** 340/**
318 * platform_device_register_simple 341 * platform_device_register_simple
@@ -355,6 +378,7 @@ error:
355 platform_device_put(pdev); 378 platform_device_put(pdev);
356 return ERR_PTR(retval); 379 return ERR_PTR(retval);
357} 380}
381EXPORT_SYMBOL_GPL(platform_device_register_simple);
358 382
359static int platform_drv_probe(struct device *_dev) 383static int platform_drv_probe(struct device *_dev)
360{ 384{
@@ -476,6 +500,7 @@ struct bus_type platform_bus_type = {
476 .suspend = platform_suspend, 500 .suspend = platform_suspend,
477 .resume = platform_resume, 501 .resume = platform_resume,
478}; 502};
503EXPORT_SYMBOL_GPL(platform_bus_type);
479 504
480int __init platform_bus_init(void) 505int __init platform_bus_init(void)
481{ 506{
@@ -504,14 +529,3 @@ u64 dma_get_required_mask(struct device *dev)
504} 529}
505EXPORT_SYMBOL_GPL(dma_get_required_mask); 530EXPORT_SYMBOL_GPL(dma_get_required_mask);
506#endif 531#endif
507
508EXPORT_SYMBOL_GPL(platform_bus);
509EXPORT_SYMBOL_GPL(platform_bus_type);
510EXPORT_SYMBOL_GPL(platform_add_devices);
511EXPORT_SYMBOL_GPL(platform_device_register);
512EXPORT_SYMBOL_GPL(platform_device_register_simple);
513EXPORT_SYMBOL_GPL(platform_device_unregister);
514EXPORT_SYMBOL_GPL(platform_get_irq);
515EXPORT_SYMBOL_GPL(platform_get_resource);
516EXPORT_SYMBOL_GPL(platform_get_irq_byname);
517EXPORT_SYMBOL_GPL(platform_get_resource_byname);
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index adbc3148c03..4bafef83e79 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -64,6 +64,7 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state)
64} 64}
65 65
66 66
67#if 0
67/** 68/**
68 * dpm_set_power_state - Update power_state field. 69 * dpm_set_power_state - Update power_state field.
69 * @dev: Device. 70 * @dev: Device.
@@ -80,3 +81,4 @@ void dpm_set_power_state(struct device * dev, pm_message_t state)
80 dev->power.power_state = state; 81 dev->power.power_state = state;
81 up(&dpm_sem); 82 up(&dpm_sem);
82} 83}
84#endif /* 0 */
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index b4d7a3efb90..70aeb3a6012 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -3509,6 +3509,7 @@ static int __init ide_cdrom_init(void)
3509 return driver_register(&ide_cdrom_driver.gen_driver); 3509 return driver_register(&ide_cdrom_driver.gen_driver);
3510} 3510}
3511 3511
3512MODULE_ALIAS("ide:*m-cdrom*");
3512module_init(ide_cdrom_init); 3513module_init(ide_cdrom_init);
3513module_exit(ide_cdrom_exit); 3514module_exit(ide_cdrom_exit);
3514MODULE_LICENSE("GPL"); 3515MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 449522f0540..4e5767968d7 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1271,6 +1271,7 @@ static int __init idedisk_init(void)
1271 return driver_register(&idedisk_driver.gen_driver); 1271 return driver_register(&idedisk_driver.gen_driver);
1272} 1272}
1273 1273
1274MODULE_ALIAS("ide:*m-disk*");
1274module_init(idedisk_init); 1275module_init(idedisk_init);
1275module_exit(idedisk_exit); 1276module_exit(idedisk_exit);
1276MODULE_LICENSE("GPL"); 1277MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 9e293c8063d..fba3fffc2d6 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -2197,6 +2197,7 @@ static int __init idefloppy_init(void)
2197 return driver_register(&idefloppy_driver.gen_driver); 2197 return driver_register(&idefloppy_driver.gen_driver);
2198} 2198}
2199 2199
2200MODULE_ALIAS("ide:*m-floppy*");
2200module_init(idefloppy_init); 2201module_init(idefloppy_init);
2201module_exit(idefloppy_exit); 2202module_exit(idefloppy_exit);
2202MODULE_LICENSE("GPL"); 2203MODULE_LICENSE("GPL");
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 7d7944ed415..fab9b2b0250 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -4947,6 +4947,7 @@ out:
4947 return error; 4947 return error;
4948} 4948}
4949 4949
4950MODULE_ALIAS("ide:*m-tape*");
4950module_init(idetape_init); 4951module_init(idetape_init);
4951module_exit(idetape_exit); 4952module_exit(idetape_exit);
4952MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR); 4953MODULE_ALIAS_CHARDEV_MAJOR(IDETAPE_MAJOR);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 8af179b531c..4b524f6b3ec 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1904,9 +1904,69 @@ static int ide_bus_match(struct device *dev, struct device_driver *drv)
1904 return 1; 1904 return 1;
1905} 1905}
1906 1906
1907static char *media_string(ide_drive_t *drive)
1908{
1909 switch (drive->media) {
1910 case ide_disk:
1911 return "disk";
1912 case ide_cdrom:
1913 return "cdrom";
1914 case ide_tape:
1915 return "tape";
1916 case ide_floppy:
1917 return "floppy";
1918 default:
1919 return "UNKNOWN";
1920 }
1921}
1922
1923static ssize_t media_show(struct device *dev, struct device_attribute *attr, char *buf)
1924{
1925 ide_drive_t *drive = to_ide_device(dev);
1926 return sprintf(buf, "%s\n", media_string(drive));
1927}
1928
1929static ssize_t drivename_show(struct device *dev, struct device_attribute *attr, char *buf)
1930{
1931 ide_drive_t *drive = to_ide_device(dev);
1932 return sprintf(buf, "%s\n", drive->name);
1933}
1934
1935static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
1936{
1937 ide_drive_t *drive = to_ide_device(dev);
1938 return sprintf(buf, "ide:m-%s\n", media_string(drive));
1939}
1940
1941static struct device_attribute ide_dev_attrs[] = {
1942 __ATTR_RO(media),
1943 __ATTR_RO(drivename),
1944 __ATTR_RO(modalias),
1945 __ATTR_NULL
1946};
1947
1948static int ide_uevent(struct device *dev, char **envp, int num_envp,
1949 char *buffer, int buffer_size)
1950{
1951 ide_drive_t *drive = to_ide_device(dev);
1952 int i = 0;
1953 int length = 0;
1954
1955 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
1956 "MEDIA=%s", media_string(drive));
1957 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
1958 "DRIVENAME=%s", drive->name);
1959 add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length,
1960 "MODALIAS=ide:m-%s", media_string(drive));
1961 envp[i] = NULL;
1962 return 0;
1963}
1964
1907struct bus_type ide_bus_type = { 1965struct bus_type ide_bus_type = {
1908 .name = "ide", 1966 .name = "ide",
1909 .match = ide_bus_match, 1967 .match = ide_bus_match,
1968 .uevent = ide_uevent,
1969 .dev_attrs = ide_dev_attrs,
1910 .suspend = generic_ide_suspend, 1970 .suspend = generic_ide_suspend,
1911 .resume = generic_ide_resume, 1971 .resume = generic_ide_resume,
1912}; 1972};
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 0ea37b1bccb..f2453668acf 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -121,8 +121,8 @@ struct host_info {
121}; 121};
122 122
123static int nodemgr_bus_match(struct device * dev, struct device_driver * drv); 123static int nodemgr_bus_match(struct device * dev, struct device_driver * drv);
124static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp, 124static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
125 char *buffer, int buffer_size); 125 char *buffer, int buffer_size);
126static void nodemgr_resume_ne(struct node_entry *ne); 126static void nodemgr_resume_ne(struct node_entry *ne);
127static void nodemgr_remove_ne(struct node_entry *ne); 127static void nodemgr_remove_ne(struct node_entry *ne);
128static struct node_entry *find_entry_by_guid(u64 guid); 128static struct node_entry *find_entry_by_guid(u64 guid);
@@ -162,7 +162,7 @@ static void ud_cls_release(struct class_device *class_dev)
162static struct class nodemgr_ud_class = { 162static struct class nodemgr_ud_class = {
163 .name = "ieee1394", 163 .name = "ieee1394",
164 .release = ud_cls_release, 164 .release = ud_cls_release,
165 .hotplug = nodemgr_hotplug, 165 .uevent = nodemgr_uevent,
166}; 166};
167 167
168static struct hpsb_highlevel nodemgr_highlevel; 168static struct hpsb_highlevel nodemgr_highlevel;
@@ -966,7 +966,7 @@ static struct unit_directory *nodemgr_process_unit_directory
966 if (ud_child == NULL) 966 if (ud_child == NULL)
967 break; 967 break;
968 968
969 /* inherit unspecified values so hotplug picks it up */ 969 /* inherit unspecified values, the driver core picks it up */
970 if ((ud->flags & UNIT_DIRECTORY_MODEL_ID) && 970 if ((ud->flags & UNIT_DIRECTORY_MODEL_ID) &&
971 !(ud_child->flags & UNIT_DIRECTORY_MODEL_ID)) 971 !(ud_child->flags & UNIT_DIRECTORY_MODEL_ID))
972 { 972 {
@@ -1062,8 +1062,8 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent
1062 1062
1063#ifdef CONFIG_HOTPLUG 1063#ifdef CONFIG_HOTPLUG
1064 1064
1065static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp, 1065static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
1066 char *buffer, int buffer_size) 1066 char *buffer, int buffer_size)
1067{ 1067{
1068 struct unit_directory *ud; 1068 struct unit_directory *ud;
1069 int i = 0; 1069 int i = 0;
@@ -1112,8 +1112,8 @@ do { \
1112 1112
1113#else 1113#else
1114 1114
1115static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp, 1115static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
1116 char *buffer, int buffer_size) 1116 char *buffer, int buffer_size)
1117{ 1117{
1118 return -ENODEV; 1118 return -ENODEV;
1119} 1119}
@@ -1618,8 +1618,8 @@ static int nodemgr_host_thread(void *__hi)
1618 1618
1619 /* Scan our nodes to get the bus options and create node 1619 /* Scan our nodes to get the bus options and create node
1620 * entries. This does not do the sysfs stuff, since that 1620 * entries. This does not do the sysfs stuff, since that
1621 * would trigger hotplug callbacks and such, which is a 1621 * would trigger uevents and such, which is a bad idea at
1622 * bad idea at this point. */ 1622 * this point. */
1623 nodemgr_node_scan(hi, generation); 1623 nodemgr_node_scan(hi, generation);
1624 1624
1625 /* This actually does the full probe, with sysfs 1625 /* This actually does the full probe, with sysfs
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 08648b1a387..1f1743c5c9a 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -434,24 +434,24 @@ static void ib_device_release(struct class_device *cdev)
434 kfree(dev); 434 kfree(dev);
435} 435}
436 436
437static int ib_device_hotplug(struct class_device *cdev, char **envp, 437static int ib_device_uevent(struct class_device *cdev, char **envp,
438 int num_envp, char *buf, int size) 438 int num_envp, char *buf, int size)
439{ 439{
440 struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); 440 struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
441 int i = 0, len = 0; 441 int i = 0, len = 0;
442 442
443 if (add_hotplug_env_var(envp, num_envp, &i, buf, size, &len, 443 if (add_uevent_var(envp, num_envp, &i, buf, size, &len,
444 "NAME=%s", dev->name)) 444 "NAME=%s", dev->name))
445 return -ENOMEM; 445 return -ENOMEM;
446 446
447 /* 447 /*
448 * It might be nice to pass the node GUID to hotplug, but 448 * It might be nice to pass the node GUID with the event, but
449 * right now the only way to get it is to query the device 449 * right now the only way to get it is to query the device
450 * provider, and this can crash during device removal because 450 * provider, and this can crash during device removal because
451 * we are will be running after driver removal has started. 451 * we are will be running after driver removal has started.
452 * We could add a node_guid field to struct ib_device, or we 452 * We could add a node_guid field to struct ib_device, or we
453 * could just let the hotplug script read the node GUID from 453 * could just let userspace read the node GUID from sysfs when
454 * sysfs when devices are added. 454 * devices are added.
455 */ 455 */
456 456
457 envp[i] = NULL; 457 envp[i] = NULL;
@@ -653,7 +653,7 @@ static struct class_device_attribute *ib_class_attributes[] = {
653static struct class ib_class = { 653static struct class ib_class = {
654 .name = "infiniband", 654 .name = "infiniband",
655 .release = ib_device_release, 655 .release = ib_device_release,
656 .hotplug = ib_device_hotplug, 656 .uevent = ib_device_uevent,
657}; 657};
658 658
659int ib_device_register_sysfs(struct ib_device *device) 659int ib_device_register_sysfs(struct ib_device *device)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index bdd2a7fc268..ef5824c8846 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -18,7 +18,6 @@
18#include <linux/random.h> 18#include <linux/random.h>
19#include <linux/major.h> 19#include <linux/major.h>
20#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
21#include <linux/kobject_uevent.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
23#include <linux/poll.h> 22#include <linux/poll.h>
24#include <linux/device.h> 23#include <linux/device.h>
@@ -529,10 +528,49 @@ INPUT_DEV_STRING_ATTR_SHOW(name);
529INPUT_DEV_STRING_ATTR_SHOW(phys); 528INPUT_DEV_STRING_ATTR_SHOW(phys);
530INPUT_DEV_STRING_ATTR_SHOW(uniq); 529INPUT_DEV_STRING_ATTR_SHOW(uniq);
531 530
531static int print_modalias_bits(char *buf, char prefix, unsigned long *arr,
532 unsigned int min, unsigned int max)
533{
534 int len, i;
535
536 len = sprintf(buf, "%c", prefix);
537 for (i = min; i < max; i++)
538 if (arr[LONG(i)] & BIT(i))
539 len += sprintf(buf+len, "%X,", i);
540 return len;
541}
542
543static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)
544{
545 struct input_dev *id = to_input_dev(dev);
546 ssize_t len = 0;
547
548 len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-",
549 id->id.bustype,
550 id->id.vendor,
551 id->id.product,
552 id->id.version);
553
554 len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX);
555 len += print_modalias_bits(buf+len, 'k', id->keybit,
556 KEY_MIN_INTERESTING, KEY_MAX);
557 len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX);
558 len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX);
559 len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX);
560 len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX);
561 len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX);
562 len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX);
563 len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX);
564 len += sprintf(buf+len, "\n");
565 return len;
566}
567static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);
568
532static struct attribute *input_dev_attrs[] = { 569static struct attribute *input_dev_attrs[] = {
533 &class_device_attr_name.attr, 570 &class_device_attr_name.attr,
534 &class_device_attr_phys.attr, 571 &class_device_attr_phys.attr,
535 &class_device_attr_uniq.attr, 572 &class_device_attr_uniq.attr,
573 &class_device_attr_modalias.attr,
536 NULL 574 NULL
537}; 575};
538 576
@@ -611,10 +649,10 @@ static void input_dev_release(struct class_device *class_dev)
611} 649}
612 650
613/* 651/*
614 * Input hotplugging interface - loading event handlers based on 652 * Input uevent interface - loading event handlers based on
615 * device bitfields. 653 * device bitfields.
616 */ 654 */
617static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index, 655static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index,
618 char *buffer, int buffer_size, int *cur_len, 656 char *buffer, int buffer_size, int *cur_len,
619 const char *name, unsigned long *bitmap, int max) 657 const char *name, unsigned long *bitmap, int max)
620{ 658{
@@ -639,7 +677,7 @@ static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index,
639 677
640#define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ 678#define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \
641 do { \ 679 do { \
642 int err = add_hotplug_env_var(envp, num_envp, &i, \ 680 int err = add_uevent_var(envp, num_envp, &i, \
643 buffer, buffer_size, &len, \ 681 buffer, buffer_size, &len, \
644 fmt, val); \ 682 fmt, val); \
645 if (err) \ 683 if (err) \
@@ -648,15 +686,15 @@ static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index,
648 686
649#define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ 687#define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \
650 do { \ 688 do { \
651 int err = input_add_hotplug_bm_var(envp, num_envp, &i, \ 689 int err = input_add_uevent_bm_var(envp, num_envp, &i, \
652 buffer, buffer_size, &len, \ 690 buffer, buffer_size, &len, \
653 name, bm, max); \ 691 name, bm, max); \
654 if (err) \ 692 if (err) \
655 return err; \ 693 return err; \
656 } while (0) 694 } while (0)
657 695
658static int input_dev_hotplug(struct class_device *cdev, char **envp, 696static int input_dev_uevent(struct class_device *cdev, char **envp,
659 int num_envp, char *buffer, int buffer_size) 697 int num_envp, char *buffer, int buffer_size)
660{ 698{
661 struct input_dev *dev = to_input_dev(cdev); 699 struct input_dev *dev = to_input_dev(cdev);
662 int i = 0; 700 int i = 0;
@@ -698,7 +736,7 @@ static int input_dev_hotplug(struct class_device *cdev, char **envp,
698struct class input_class = { 736struct class input_class = {
699 .name = "input", 737 .name = "input",
700 .release = input_dev_release, 738 .release = input_dev_release,
701 .hotplug = input_dev_hotplug, 739 .uevent = input_dev_uevent,
702}; 740};
703 741
704struct input_dev *input_allocate_device(void) 742struct input_dev *input_allocate_device(void)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index fbb69ef6a77..8e530cc970e 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -800,16 +800,16 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
800 800
801#ifdef CONFIG_HOTPLUG 801#ifdef CONFIG_HOTPLUG
802 802
803#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \ 803#define SERIO_ADD_UEVENT_VAR(fmt, val...) \
804 do { \ 804 do { \
805 int err = add_hotplug_env_var(envp, num_envp, &i, \ 805 int err = add_uevent_var(envp, num_envp, &i, \
806 buffer, buffer_size, &len, \ 806 buffer, buffer_size, &len, \
807 fmt, val); \ 807 fmt, val); \
808 if (err) \ 808 if (err) \
809 return err; \ 809 return err; \
810 } while (0) 810 } while (0)
811 811
812static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 812static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
813{ 813{
814 struct serio *serio; 814 struct serio *serio;
815 int i = 0; 815 int i = 0;
@@ -820,21 +820,21 @@ static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *bu
820 820
821 serio = to_serio_port(dev); 821 serio = to_serio_port(dev);
822 822
823 SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type); 823 SERIO_ADD_UEVENT_VAR("SERIO_TYPE=%02x", serio->id.type);
824 SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto); 824 SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
825 SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id); 825 SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
826 SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra); 826 SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
827 SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", 827 SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
828 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); 828 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
829 envp[i] = NULL; 829 envp[i] = NULL;
830 830
831 return 0; 831 return 0;
832} 832}
833#undef SERIO_ADD_HOTPLUG_VAR 833#undef SERIO_ADD_UEVENT_VAR
834 834
835#else 835#else
836 836
837static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 837static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
838{ 838{
839 return -ENODEV; 839 return -ENODEV;
840} 840}
@@ -908,7 +908,7 @@ static int __init serio_init(void)
908 serio_bus.dev_attrs = serio_device_attrs; 908 serio_bus.dev_attrs = serio_device_attrs;
909 serio_bus.drv_attrs = serio_driver_attrs; 909 serio_bus.drv_attrs = serio_driver_attrs;
910 serio_bus.match = serio_bus_match; 910 serio_bus.match = serio_bus_match;
911 serio_bus.hotplug = serio_hotplug; 911 serio_bus.uevent = serio_uevent;
912 serio_bus.resume = serio_resume; 912 serio_bus.resume = serio_resume;
913 bus_register(&serio_bus); 913 bus_register(&serio_bus);
914 914
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index c34c96d1890..228e1852a83 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -128,7 +128,7 @@ static int macio_device_resume(struct device * dev)
128 return 0; 128 return 0;
129} 129}
130 130
131static int macio_hotplug (struct device *dev, char **envp, int num_envp, 131static int macio_uevent(struct device *dev, char **envp, int num_envp,
132 char *buffer, int buffer_size) 132 char *buffer, int buffer_size)
133{ 133{
134 struct macio_dev * macio_dev; 134 struct macio_dev * macio_dev;
@@ -203,7 +203,7 @@ extern struct device_attribute macio_dev_attrs[];
203struct bus_type macio_bus_type = { 203struct bus_type macio_bus_type = {
204 .name = "macio", 204 .name = "macio",
205 .match = macio_bus_match, 205 .match = macio_bus_match,
206 .hotplug = macio_hotplug, 206 .uevent = macio_uevent,
207 .suspend = macio_device_suspend, 207 .suspend = macio_device_suspend,
208 .resume = macio_device_resume, 208 .resume = macio_device_resume,
209 .dev_attrs = macio_dev_attrs, 209 .dev_attrs = macio_dev_attrs,
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c
index 3f4a66ca955..ec701667abf 100644
--- a/drivers/mmc/mmc_sysfs.c
+++ b/drivers/mmc/mmc_sysfs.c
@@ -80,7 +80,7 @@ static int mmc_bus_match(struct device *dev, struct device_driver *drv)
80} 80}
81 81
82static int 82static int
83mmc_bus_hotplug(struct device *dev, char **envp, int num_envp, char *buf, 83mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf,
84 int buf_size) 84 int buf_size)
85{ 85{
86 struct mmc_card *card = dev_to_mmc_card(dev); 86 struct mmc_card *card = dev_to_mmc_card(dev);
@@ -140,7 +140,7 @@ static struct bus_type mmc_bus_type = {
140 .name = "mmc", 140 .name = "mmc",
141 .dev_attrs = mmc_dev_attrs, 141 .dev_attrs = mmc_dev_attrs,
142 .match = mmc_bus_match, 142 .match = mmc_bus_match,
143 .hotplug = mmc_bus_hotplug, 143 .uevent = mmc_bus_uevent,
144 .suspend = mmc_bus_suspend, 144 .suspend = mmc_bus_suspend,
145 .resume = mmc_bus_resume, 145 .resume = mmc_bus_resume,
146}; 146};
diff --git a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
index e1743be3190..1c97e7dd130 100644
--- a/drivers/pci/hotplug.c
+++ b/drivers/pci/hotplug.c
@@ -3,8 +3,8 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include "pci.h" 4#include "pci.h"
5 5
6int pci_hotplug (struct device *dev, char **envp, int num_envp, 6int pci_uevent(struct device *dev, char **envp, int num_envp,
7 char *buffer, int buffer_size) 7 char *buffer, int buffer_size)
8{ 8{
9 struct pci_dev *pdev; 9 struct pci_dev *pdev;
10 int i = 0; 10 int i = 0;
@@ -17,34 +17,34 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp,
17 if (!pdev) 17 if (!pdev)
18 return -ENODEV; 18 return -ENODEV;
19 19
20 if (add_hotplug_env_var(envp, num_envp, &i, 20 if (add_uevent_var(envp, num_envp, &i,
21 buffer, buffer_size, &length, 21 buffer, buffer_size, &length,
22 "PCI_CLASS=%04X", pdev->class)) 22 "PCI_CLASS=%04X", pdev->class))
23 return -ENOMEM; 23 return -ENOMEM;
24 24
25 if (add_hotplug_env_var(envp, num_envp, &i, 25 if (add_uevent_var(envp, num_envp, &i,
26 buffer, buffer_size, &length, 26 buffer, buffer_size, &length,
27 "PCI_ID=%04X:%04X", pdev->vendor, pdev->device)) 27 "PCI_ID=%04X:%04X", pdev->vendor, pdev->device))
28 return -ENOMEM; 28 return -ENOMEM;
29 29
30 if (add_hotplug_env_var(envp, num_envp, &i, 30 if (add_uevent_var(envp, num_envp, &i,
31 buffer, buffer_size, &length, 31 buffer, buffer_size, &length,
32 "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor, 32 "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor,
33 pdev->subsystem_device)) 33 pdev->subsystem_device))
34 return -ENOMEM; 34 return -ENOMEM;
35 35
36 if (add_hotplug_env_var(envp, num_envp, &i, 36 if (add_uevent_var(envp, num_envp, &i,
37 buffer, buffer_size, &length, 37 buffer, buffer_size, &length,
38 "PCI_SLOT_NAME=%s", pci_name(pdev))) 38 "PCI_SLOT_NAME=%s", pci_name(pdev)))
39 return -ENOMEM; 39 return -ENOMEM;
40 40
41 if (add_hotplug_env_var(envp, num_envp, &i, 41 if (add_uevent_var(envp, num_envp, &i,
42 buffer, buffer_size, &length, 42 buffer, buffer_size, &length,
43 "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", 43 "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
44 pdev->vendor, pdev->device, 44 pdev->vendor, pdev->device,
45 pdev->subsystem_vendor, pdev->subsystem_device, 45 pdev->subsystem_vendor, pdev->subsystem_device,
46 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), 46 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
47 (u8)(pdev->class))) 47 (u8)(pdev->class)))
48 return -ENOMEM; 48 return -ENOMEM;
49 49
50 envp[i] = NULL; 50 envp[i] = NULL;
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index a9046d4b8af..7146b69b812 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -502,8 +502,8 @@ void pci_dev_put(struct pci_dev *dev)
502} 502}
503 503
504#ifndef CONFIG_HOTPLUG 504#ifndef CONFIG_HOTPLUG
505int pci_hotplug (struct device *dev, char **envp, int num_envp, 505int pci_uevent(struct device *dev, char **envp, int num_envp,
506 char *buffer, int buffer_size) 506 char *buffer, int buffer_size)
507{ 507{
508 return -ENODEV; 508 return -ENODEV;
509} 509}
@@ -512,7 +512,7 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp,
512struct bus_type pci_bus_type = { 512struct bus_type pci_bus_type = {
513 .name = "pci", 513 .name = "pci",
514 .match = pci_bus_match, 514 .match = pci_bus_match,
515 .hotplug = pci_hotplug, 515 .uevent = pci_uevent,
516 .suspend = pci_device_suspend, 516 .suspend = pci_device_suspend,
517 .resume = pci_device_resume, 517 .resume = pci_device_resume,
518 .dev_attrs = pci_dev_attrs, 518 .dev_attrs = pci_dev_attrs,
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 6527b36c9a6..294849d2459 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1,7 +1,7 @@
1/* Functions internal to the PCI core code */ 1/* Functions internal to the PCI core code */
2 2
3extern int pci_hotplug (struct device *dev, char **envp, int num_envp, 3extern int pci_uevent(struct device *dev, char **envp, int num_envp,
4 char *buffer, int buffer_size); 4 char *buffer, int buffer_size);
5extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); 5extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
6extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev); 6extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
7extern void pci_cleanup_rom(struct pci_dev *dev); 7extern void pci_cleanup_rom(struct pci_dev *dev);
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index a30aa74304a..7cf09084ef6 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -901,14 +901,14 @@ int pcmcia_insert_card(struct pcmcia_socket *skt)
901EXPORT_SYMBOL(pcmcia_insert_card); 901EXPORT_SYMBOL(pcmcia_insert_card);
902 902
903 903
904static int pcmcia_socket_hotplug(struct class_device *dev, char **envp, 904static int pcmcia_socket_uevent(struct class_device *dev, char **envp,
905 int num_envp, char *buffer, int buffer_size) 905 int num_envp, char *buffer, int buffer_size)
906{ 906{
907 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev); 907 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
908 int i = 0, length = 0; 908 int i = 0, length = 0;
909 909
910 if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, 910 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
911 &length, "SOCKET_NO=%u", s->sock)) 911 &length, "SOCKET_NO=%u", s->sock))
912 return -ENOMEM; 912 return -ENOMEM;
913 913
914 envp[i] = NULL; 914 envp[i] = NULL;
@@ -927,7 +927,7 @@ static void pcmcia_release_socket_class(struct class *data)
927 927
928struct class pcmcia_socket_class = { 928struct class pcmcia_socket_class = {
929 .name = "pcmcia_socket", 929 .name = "pcmcia_socket",
930 .hotplug = pcmcia_socket_hotplug, 930 .uevent = pcmcia_socket_uevent,
931 .release = pcmcia_release_socket, 931 .release = pcmcia_release_socket,
932 .class_release = pcmcia_release_socket_class, 932 .class_release = pcmcia_release_socket_class,
933}; 933};
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 7f8219f3fd9..6fb76399547 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -779,8 +779,8 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
779 779
780#ifdef CONFIG_HOTPLUG 780#ifdef CONFIG_HOTPLUG
781 781
782static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, 782static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp,
783 char *buffer, int buffer_size) 783 char *buffer, int buffer_size)
784{ 784{
785 struct pcmcia_device *p_dev; 785 struct pcmcia_device *p_dev;
786 int i, length = 0; 786 int i, length = 0;
@@ -800,31 +800,31 @@ static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp,
800 800
801 i = 0; 801 i = 0;
802 802
803 if (add_hotplug_env_var(envp, num_envp, &i, 803 if (add_uevent_var(envp, num_envp, &i,
804 buffer, buffer_size, &length, 804 buffer, buffer_size, &length,
805 "SOCKET_NO=%u", 805 "SOCKET_NO=%u",
806 p_dev->socket->sock)) 806 p_dev->socket->sock))
807 return -ENOMEM; 807 return -ENOMEM;
808 808
809 if (add_hotplug_env_var(envp, num_envp, &i, 809 if (add_uevent_var(envp, num_envp, &i,
810 buffer, buffer_size, &length, 810 buffer, buffer_size, &length,
811 "DEVICE_NO=%02X", 811 "DEVICE_NO=%02X",
812 p_dev->device_no)) 812 p_dev->device_no))
813 return -ENOMEM; 813 return -ENOMEM;
814 814
815 if (add_hotplug_env_var(envp, num_envp, &i, 815 if (add_uevent_var(envp, num_envp, &i,
816 buffer, buffer_size, &length, 816 buffer, buffer_size, &length,
817 "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" 817 "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X"
818 "pa%08Xpb%08Xpc%08Xpd%08X", 818 "pa%08Xpb%08Xpc%08Xpd%08X",
819 p_dev->has_manf_id ? p_dev->manf_id : 0, 819 p_dev->has_manf_id ? p_dev->manf_id : 0,
820 p_dev->has_card_id ? p_dev->card_id : 0, 820 p_dev->has_card_id ? p_dev->card_id : 0,
821 p_dev->has_func_id ? p_dev->func_id : 0, 821 p_dev->has_func_id ? p_dev->func_id : 0,
822 p_dev->func, 822 p_dev->func,
823 p_dev->device_no, 823 p_dev->device_no,
824 hash[0], 824 hash[0],
825 hash[1], 825 hash[1],
826 hash[2], 826 hash[2],
827 hash[3])) 827 hash[3]))
828 return -ENOMEM; 828 return -ENOMEM;
829 829
830 envp[i] = NULL; 830 envp[i] = NULL;
@@ -834,7 +834,7 @@ static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp,
834 834
835#else 835#else
836 836
837static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, 837static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp,
838 char *buffer, int buffer_size) 838 char *buffer, int buffer_size)
839{ 839{
840 return -ENODEV; 840 return -ENODEV;
@@ -1223,7 +1223,7 @@ static struct class_interface pcmcia_bus_interface = {
1223 1223
1224struct bus_type pcmcia_bus_type = { 1224struct bus_type pcmcia_bus_type = {
1225 .name = "pcmcia", 1225 .name = "pcmcia",
1226 .hotplug = pcmcia_bus_hotplug, 1226 .uevent = pcmcia_bus_uevent,
1227 .match = pcmcia_bus_match, 1227 .match = pcmcia_bus_match,
1228 .dev_attrs = pcmcia_dev_attrs, 1228 .dev_attrs = pcmcia_dev_attrs,
1229}; 1229};
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index f49674f0794..b154b3f52cb 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -56,7 +56,6 @@
56#include <linux/mm.h> 56#include <linux/mm.h>
57#include <linux/smp.h> 57#include <linux/smp.h>
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/kobject_uevent.h>
60#include <linux/completion.h> 59#include <linux/completion.h>
61#include <linux/spinlock.h> 60#include <linux/spinlock.h>
62#include <linux/dmi.h> 61#include <linux/dmi.h>
@@ -106,8 +105,6 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
106 char *argv [3], **envp, *buf, *scratch; 105 char *argv [3], **envp, *buf, *scratch;
107 int i = 0, value; 106 int i = 0, value;
108 107
109 if (!hotplug_path [0])
110 return -ENOENT;
111 if (!current->fs->root) { 108 if (!current->fs->root) {
112 return -EAGAIN; 109 return -EAGAIN;
113 } 110 }
@@ -119,8 +116,9 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
119 return -ENOMEM; 116 return -ENOMEM;
120 } 117 }
121 118
122 /* only one standardized param to hotplug command: type */ 119 /* FIXME: if there are actual users of this, it should be integrated into
123 argv [0] = hotplug_path; 120 * the driver core and use the usual infrastructure like sysfs and uevents */
121 argv [0] = "/sbin/pnpbios";
124 argv [1] = "dock"; 122 argv [1] = "dock";
125 argv [2] = NULL; 123 argv [2] = NULL;
126 124
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index e7bd7f37f08..be9d2d65c22 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -45,7 +45,7 @@ ccwgroup_bus_match (struct device * dev, struct device_driver * drv)
45 return 0; 45 return 0;
46} 46}
47static int 47static int
48ccwgroup_hotplug (struct device *dev, char **envp, int num_envp, char *buffer, 48ccwgroup_uevent (struct device *dev, char **envp, int num_envp, char *buffer,
49 int buffer_size) 49 int buffer_size)
50{ 50{
51 /* TODO */ 51 /* TODO */
@@ -55,7 +55,7 @@ ccwgroup_hotplug (struct device *dev, char **envp, int num_envp, char *buffer,
55static struct bus_type ccwgroup_bus_type = { 55static struct bus_type ccwgroup_bus_type = {
56 .name = "ccwgroup", 56 .name = "ccwgroup",
57 .match = ccwgroup_bus_match, 57 .match = ccwgroup_bus_match,
58 .hotplug = ccwgroup_hotplug, 58 .uevent = ccwgroup_uevent,
59}; 59};
60 60
61static inline void 61static inline void
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 811c9d15063..85908cacc3b 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -59,7 +59,7 @@ ccw_bus_match (struct device * dev, struct device_driver * drv)
59 * Heavily modeled on pci and usb hotplug. 59 * Heavily modeled on pci and usb hotplug.
60 */ 60 */
61static int 61static int
62ccw_hotplug (struct device *dev, char **envp, int num_envp, 62ccw_uevent (struct device *dev, char **envp, int num_envp,
63 char *buffer, int buffer_size) 63 char *buffer, int buffer_size)
64{ 64{
65 struct ccw_device *cdev = to_ccwdev(dev); 65 struct ccw_device *cdev = to_ccwdev(dev);
@@ -110,7 +110,7 @@ ccw_hotplug (struct device *dev, char **envp, int num_envp,
110struct bus_type ccw_bus_type = { 110struct bus_type ccw_bus_type = {
111 .name = "ccw", 111 .name = "ccw",
112 .match = &ccw_bus_match, 112 .match = &ccw_bus_match,
113 .hotplug = &ccw_hotplug, 113 .uevent = &ccw_uevent,
114}; 114};
115 115
116static int io_subchannel_probe (struct device *); 116static int io_subchannel_probe (struct device *);
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
index 4010f2bb85a..790fcbb74b4 100644
--- a/drivers/s390/crypto/z90main.c
+++ b/drivers/s390/crypto/z90main.c
@@ -34,7 +34,6 @@
34#include <linux/miscdevice.h> 34#include <linux/miscdevice.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
37#include <linux/kobject_uevent.h>
38#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
39#include <linux/syscalls.h> 38#include <linux/syscalls.h>
40#include "z90crypt.h" 39#include "z90crypt.h"
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index b6714da4d6e..27acf78cf8d 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -2132,7 +2132,7 @@ restart:
2132 } 2132 }
2133 2133
2134 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 2134 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
2135 kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE, NULL); 2135 kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE);
2136 LEAVE; 2136 LEAVE;
2137} 2137}
2138 2138
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 56a3520863a..13d1d367f7f 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
195struct find_interface_arg { 196struct 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 */
251static int usb_hotplug (struct device *dev, char **envp, int num_envp, 249static 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
345static int usb_hotplug (struct device *dev, char **envp, 343static 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)
1093struct bus_type usb_bus_type = { 1091struct 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 0eaabeb37ac..641268d7e6f 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
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 14016b1cd94..024206c4a0e 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -142,12 +142,12 @@ static struct bin_attribute w1_slave_attr_bin_id = {
142/* Default family */ 142/* Default family */
143static struct w1_family w1_default_family; 143static struct w1_family w1_default_family;
144 144
145static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size); 145static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size);
146 146
147static struct bus_type w1_bus_type = { 147static struct bus_type w1_bus_type = {
148 .name = "w1", 148 .name = "w1",
149 .match = w1_master_match, 149 .match = w1_master_match,
150 .hotplug = w1_hotplug, 150 .uevent = w1_uevent,
151}; 151};
152 152
153struct device_driver w1_master_driver = { 153struct device_driver w1_master_driver = {
@@ -361,7 +361,7 @@ void w1_destroy_master_attributes(struct w1_master *master)
361} 361}
362 362
363#ifdef CONFIG_HOTPLUG 363#ifdef CONFIG_HOTPLUG
364static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 364static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
365{ 365{
366 struct w1_master *md = NULL; 366 struct w1_master *md = NULL;
367 struct w1_slave *sl = NULL; 367 struct w1_slave *sl = NULL;
@@ -377,7 +377,7 @@ static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffe
377 event_owner = "slave"; 377 event_owner = "slave";
378 name = sl->name; 378 name = sl->name;
379 } else { 379 } else {
380 dev_dbg(dev, "Unknown hotplug event.\n"); 380 dev_dbg(dev, "Unknown event.\n");
381 return -EINVAL; 381 return -EINVAL;
382 } 382 }
383 383
@@ -386,18 +386,18 @@ static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffe
386 if (dev->driver != &w1_slave_driver || !sl) 386 if (dev->driver != &w1_slave_driver || !sl)
387 return 0; 387 return 0;
388 388
389 err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family); 389 err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family);
390 if (err) 390 if (err)
391 return err; 391 return err;
392 392
393 err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id); 393 err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id);
394 if (err) 394 if (err)
395 return err; 395 return err;
396 396
397 return 0; 397 return 0;
398}; 398};
399#else 399#else
400static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 400static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
401{ 401{
402 return 0; 402 return 0;
403} 403}