diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/Kconfig | 4 | ||||
-rw-r--r-- | drivers/base/bus.c | 41 | ||||
-rw-r--r-- | drivers/base/class.c | 66 | ||||
-rw-r--r-- | drivers/base/core.c | 42 | ||||
-rw-r--r-- | drivers/base/cpu.c | 4 | ||||
-rw-r--r-- | drivers/base/dd.c | 15 | ||||
-rw-r--r-- | drivers/base/firmware_class.c | 45 | ||||
-rw-r--r-- | drivers/base/memory.c | 12 | ||||
-rw-r--r-- | drivers/base/platform.c | 68 | ||||
-rw-r--r-- | drivers/base/power/runtime.c | 3 |
10 files changed, 180 insertions, 120 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 934149c1512b..f0eff3dac58d 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 | ||
21 | config FW_LOADER | 21 | config 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 | ||
29 | config DEBUG_DRIVER | 29 | config DEBUG_DRIVER |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index fa601b085eba..29f6af554e71 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 | */ | ||
436 | static 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 | |||
442 | static 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 | ||
448 | static inline void add_bind_files(struct device_driver *drv) {} | ||
449 | static 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) | |||
468 | void bus_remove_driver(struct device_driver * drv) | 495 | void 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 */ |
485 | static int bus_rescan_devices_helper(struct device *dev, void *data) | 511 | static 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 db65fd0babe9..df7fdabd0730 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 */ |
181 | static int class_device_create_hotplug(struct class_device *class_dev, | 181 | static 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 | ||
334 | static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) | 334 | static 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 | ||
346 | static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj) | 346 | static 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 | ||
353 | static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp, | 353 | static 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 | ||
417 | static struct kset_hotplug_ops class_hotplug_ops = { | 417 | static 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 | ||
423 | static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops); | 423 | static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops); |
424 | 424 | ||
425 | 425 | ||
426 | static int class_device_add_attrs(struct class_device * cd) | 426 | static 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) | |||
464 | static ssize_t store_uevent(struct class_device *class_dev, | 464 | static 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 8615b42b517a..fd8059920dbf 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 | ||
93 | static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj) | 93 | static 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 | ||
105 | static const char *dev_hotplug_name(struct kset *kset, struct kobject *kobj) | 105 | static 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 | ||
112 | static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, | 112 | static 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 | ||
151 | static struct kset_hotplug_ops device_hotplug_ops = { | 151 | static 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 | ||
157 | static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, | 157 | static 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 | ||
168 | decl_subsys(devices, &ktype_device, &device_hotplug_ops); | 168 | decl_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 a95844790f7b..281d26784d25 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 3b419c9a1e7e..2b905016664d 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 | */ |
70 | int driver_probe_device(struct device_driver * drv, struct device * dev) | 71 | int 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 | */ |
127 | int device_attach(struct device * dev) | 130 | int 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 | ||
186 | static void __device_release_driver(struct device * dev) | 195 | static 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 59dacb6552c0..5b3d5e9ddcb6 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) | |||
85 | static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); | 85 | static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); |
86 | 86 | ||
87 | static void fw_class_dev_release(struct class_device *class_dev); | 87 | static void fw_class_dev_release(struct class_device *class_dev); |
88 | int firmware_class_hotplug(struct class_device *dev, char **envp, | 88 | int 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 | ||
91 | static struct class firmware_class = { | 91 | static 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 | ||
97 | int | 97 | int |
98 | firmware_class_hotplug(struct class_device *class_dev, char **envp, | 98 | firmware_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 | ||
353 | static int | 352 | static int |
354 | fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, | 353 | fw_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 | ||
400 | static int | 399 | static 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 | |||
474 | request_firmware(const struct firmware **firmware_p, const char *name, | 473 | request_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 | ||
524 | static int | 523 | static 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 | **/ |
563 | int | 562 | int |
564 | request_firmware_nowait( | 563 | request_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 bc3ca6a656b2..7e1d077874df 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 | ||
32 | static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj) | 32 | static 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 | ||
37 | static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp, | 37 | static 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 | ||
45 | static struct kset_hotplug_ops memory_hotplug_ops = { | 45 | static 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 | ||
50 | static struct notifier_block *memory_chain; | 50 | static 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 8827dafba945..0f81731bdfa8 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -25,6 +25,7 @@ | |||
25 | struct device platform_bus = { | 25 | struct device platform_bus = { |
26 | .bus_id = "platform", | 26 | .bus_id = "platform", |
27 | }; | 27 | }; |
28 | EXPORT_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 | } |
53 | EXPORT_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 | } |
66 | EXPORT_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 | } |
90 | EXPORT_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 | } |
103 | EXPORT_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 | } |
125 | EXPORT_SYMBOL_GPL(platform_add_devices); | ||
120 | 126 | ||
121 | struct platform_object { | 127 | struct 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 | } |
173 | EXPORT_SYMBOL_GPL(platform_device_alloc); | 179 | EXPORT_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) | |||
282 | EXPORT_SYMBOL_GPL(platform_device_add); | 288 | EXPORT_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 | */ | ||
289 | int 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 | */ |
302 | void platform_device_unregister(struct platform_device * pdev) | 297 | void 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 | } |
311 | EXPORT_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 | */ | ||
318 | int platform_device_register(struct platform_device * pdev) | ||
319 | { | ||
320 | device_initialize(&pdev->dev); | ||
321 | return platform_device_add(pdev); | ||
322 | } | ||
323 | EXPORT_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 | */ | ||
333 | void platform_device_unregister(struct platform_device * pdev) | ||
334 | { | ||
335 | platform_device_del(pdev); | ||
336 | platform_device_put(pdev); | ||
337 | } | ||
338 | EXPORT_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 | } |
381 | EXPORT_SYMBOL_GPL(platform_device_register_simple); | ||
358 | 382 | ||
359 | static int platform_drv_probe(struct device *_dev) | 383 | static 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 | }; |
503 | EXPORT_SYMBOL_GPL(platform_bus_type); | ||
479 | 504 | ||
480 | int __init platform_bus_init(void) | 505 | int __init platform_bus_init(void) |
481 | { | 506 | { |
@@ -504,14 +529,3 @@ u64 dma_get_required_mask(struct device *dev) | |||
504 | } | 529 | } |
505 | EXPORT_SYMBOL_GPL(dma_get_required_mask); | 530 | EXPORT_SYMBOL_GPL(dma_get_required_mask); |
506 | #endif | 531 | #endif |
507 | |||
508 | EXPORT_SYMBOL_GPL(platform_bus); | ||
509 | EXPORT_SYMBOL_GPL(platform_bus_type); | ||
510 | EXPORT_SYMBOL_GPL(platform_add_devices); | ||
511 | EXPORT_SYMBOL_GPL(platform_device_register); | ||
512 | EXPORT_SYMBOL_GPL(platform_device_register_simple); | ||
513 | EXPORT_SYMBOL_GPL(platform_device_unregister); | ||
514 | EXPORT_SYMBOL_GPL(platform_get_irq); | ||
515 | EXPORT_SYMBOL_GPL(platform_get_resource); | ||
516 | EXPORT_SYMBOL_GPL(platform_get_irq_byname); | ||
517 | EXPORT_SYMBOL_GPL(platform_get_resource_byname); | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index adbc3148c039..96370ec1d673 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -62,8 +62,10 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state) | |||
62 | up(&dpm_sem); | 62 | up(&dpm_sem); |
63 | return error; | 63 | return error; |
64 | } | 64 | } |
65 | EXPORT_SYMBOL(dpm_runtime_suspend); | ||
65 | 66 | ||
66 | 67 | ||
68 | #if 0 | ||
67 | /** | 69 | /** |
68 | * dpm_set_power_state - Update power_state field. | 70 | * dpm_set_power_state - Update power_state field. |
69 | * @dev: Device. | 71 | * @dev: Device. |
@@ -80,3 +82,4 @@ void dpm_set_power_state(struct device * dev, pm_message_t state) | |||
80 | dev->power.power_state = state; | 82 | dev->power.power_state = state; |
81 | up(&dpm_sem); | 83 | up(&dpm_sem); |
82 | } | 84 | } |
85 | #endif /* 0 */ | ||