diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-08 21:11:47 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-08 21:11:47 -0400 |
| commit | 837525e344298335ea56c3b8c9ca7abbc97f0285 (patch) | |
| tree | e7afd356670edab6f3550fa9cc0eb9c926b590df | |
| parent | 217397d7d267f832081169016e1ab66691a13e08 (diff) | |
| parent | 87d37a4f470834223fc8a243af002998bdb5b886 (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6:
firmware: remove orphaned Email
kobject: use the proper printk level for kobject error
Driver core: kill unused code
Driver core: keep PHYSDEV for old struct class_device
update Documentation/driver-model/platform.txt
| -rw-r--r-- | Documentation/driver-model/platform.txt | 40 | ||||
| -rw-r--r-- | Documentation/firmware_class/README | 2 | ||||
| -rw-r--r-- | Documentation/firmware_class/firmware_sample_driver.c | 2 | ||||
| -rw-r--r-- | Documentation/firmware_class/firmware_sample_firmware_class.c | 4 | ||||
| -rw-r--r-- | drivers/base/class.c | 59 | ||||
| -rw-r--r-- | drivers/base/core.c | 10 | ||||
| -rw-r--r-- | drivers/base/dd.c | 13 | ||||
| -rw-r--r-- | drivers/base/firmware_class.c | 4 | ||||
| -rw-r--r-- | lib/kobject.c | 10 |
9 files changed, 78 insertions, 66 deletions
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt index 19c4a6e13676..2a97320ee17f 100644 --- a/Documentation/driver-model/platform.txt +++ b/Documentation/driver-model/platform.txt | |||
| @@ -96,6 +96,46 @@ System setup also associates those clocks with the device, so that that | |||
| 96 | calls to clk_get(&pdev->dev, clock_name) return them as needed. | 96 | calls to clk_get(&pdev->dev, clock_name) return them as needed. |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | Legacy Drivers: Device Probing | ||
| 100 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 101 | Some drivers are not fully converted to the driver model, because they take | ||
| 102 | on a non-driver role: the driver registers its platform device, rather than | ||
| 103 | leaving that for system infrastructure. Such drivers can't be hotplugged | ||
| 104 | or coldplugged, since those mechanisms require device creation to be in a | ||
| 105 | different system component than the driver. | ||
| 106 | |||
| 107 | The only "good" reason for this is to handle older system designs which, like | ||
| 108 | original IBM PCs, rely on error-prone "probe-the-hardware" models for hardware | ||
| 109 | configuration. Newer systems have largely abandoned that model, in favor of | ||
| 110 | bus-level support for dynamic configuration (PCI, USB), or device tables | ||
| 111 | provided by the boot firmware (e.g. PNPACPI on x86). There are too many | ||
| 112 | conflicting options about what might be where, and even educated guesses by | ||
| 113 | an operating system will be wrong often enough to make trouble. | ||
| 114 | |||
| 115 | This style of driver is discouraged. If you're updating such a driver, | ||
| 116 | please try to move the device enumeration to a more appropriate location, | ||
| 117 | outside the driver. This will usually be cleanup, since such drivers | ||
| 118 | tend to already have "normal" modes, such as ones using device nodes that | ||
| 119 | were created by PNP or by platform device setup. | ||
| 120 | |||
| 121 | None the less, there are some APIs to support such legacy drivers. Avoid | ||
| 122 | using these calls except with such hotplug-deficient drivers. | ||
| 123 | |||
| 124 | struct platform_device *platform_device_alloc( | ||
| 125 | char *name, unsigned id); | ||
| 126 | |||
| 127 | You can use platform_device_alloc() to dynamically allocate a device, which | ||
| 128 | you will then initialize with resources and platform_device_register(). | ||
| 129 | A better solution is usually: | ||
| 130 | |||
| 131 | struct platform_device *platform_device_register_simple( | ||
| 132 | char *name, unsigned id, | ||
| 133 | struct resource *res, unsigned nres); | ||
| 134 | |||
| 135 | You can use platform_device_register_simple() as a one-step call to allocate | ||
| 136 | and register a device. | ||
| 137 | |||
| 138 | |||
| 99 | Device Naming and Driver Binding | 139 | Device Naming and Driver Binding |
| 100 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 140 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 101 | The platform_device.dev.bus_id is the canonical name for the devices. | 141 | The platform_device.dev.bus_id is the canonical name for the devices. |
diff --git a/Documentation/firmware_class/README b/Documentation/firmware_class/README index e9cc8bb26f7d..c3480aa66ba8 100644 --- a/Documentation/firmware_class/README +++ b/Documentation/firmware_class/README | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | request_firmware() hotplug interface: | 2 | request_firmware() hotplug interface: |
| 3 | ------------------------------------ | 3 | ------------------------------------ |
| 4 | Copyright (C) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | Copyright (C) 2003 Manuel Estrada Sainz |
| 5 | 5 | ||
| 6 | Why: | 6 | Why: |
| 7 | --- | 7 | --- |
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index 87feccdb5c9f..6865cbe075ec 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * firmware_sample_driver.c - | 2 | * firmware_sample_driver.c - |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | * Copyright (c) 2003 Manuel Estrada Sainz |
| 5 | * | 5 | * |
| 6 | * Sample code on how to use request_firmware() from drivers. | 6 | * Sample code on how to use request_firmware() from drivers. |
| 7 | * | 7 | * |
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c index 9e1b0e4051cd..4994f1f28f8c 100644 --- a/Documentation/firmware_class/firmware_sample_firmware_class.c +++ b/Documentation/firmware_class/firmware_sample_firmware_class.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * firmware_sample_firmware_class.c - | 2 | * firmware_sample_firmware_class.c - |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | * Copyright (c) 2003 Manuel Estrada Sainz |
| 5 | * | 5 | * |
| 6 | * NOTE: This is just a probe of concept, if you think that your driver would | 6 | * NOTE: This is just a probe of concept, if you think that your driver would |
| 7 | * be well served by this mechanism please contact me first. | 7 | * be well served by this mechanism please contact me first. |
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <linux/firmware.h> | 19 | #include <linux/firmware.h> |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); | 22 | MODULE_AUTHOR("Manuel Estrada Sainz"); |
| 23 | MODULE_DESCRIPTION("Hackish sample for using firmware class directly"); | 23 | MODULE_DESCRIPTION("Hackish sample for using firmware class directly"); |
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | 25 | ||
diff --git a/drivers/base/class.c b/drivers/base/class.c index 20c4ea6eb50d..8c506dbe3913 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -369,36 +369,6 @@ char *make_class_name(const char *name, struct kobject *kobj) | |||
| 369 | return class_name; | 369 | return class_name; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | static int deprecated_class_uevent(char **envp, int num_envp, int *cur_index, | ||
| 373 | char *buffer, int buffer_size, | ||
| 374 | int *cur_len, | ||
| 375 | struct class_device *class_dev) | ||
| 376 | { | ||
| 377 | struct device *dev = class_dev->dev; | ||
| 378 | char *path; | ||
| 379 | |||
| 380 | if (!dev) | ||
| 381 | return 0; | ||
| 382 | |||
| 383 | /* add device, backing this class device (deprecated) */ | ||
| 384 | path = kobject_get_path(&dev->kobj, GFP_KERNEL); | ||
| 385 | |||
| 386 | add_uevent_var(envp, num_envp, cur_index, buffer, buffer_size, | ||
| 387 | cur_len, "PHYSDEVPATH=%s", path); | ||
| 388 | kfree(path); | ||
| 389 | |||
| 390 | if (dev->bus) | ||
| 391 | add_uevent_var(envp, num_envp, cur_index, | ||
| 392 | buffer, buffer_size, cur_len, | ||
| 393 | "PHYSDEVBUS=%s", dev->bus->name); | ||
| 394 | |||
| 395 | if (dev->driver) | ||
| 396 | add_uevent_var(envp, num_envp, cur_index, | ||
| 397 | buffer, buffer_size, cur_len, | ||
| 398 | "PHYSDEVDRIVER=%s", dev->driver->name); | ||
| 399 | return 0; | ||
| 400 | } | ||
| 401 | |||
| 402 | static int make_deprecated_class_device_links(struct class_device *class_dev) | 372 | static int make_deprecated_class_device_links(struct class_device *class_dev) |
| 403 | { | 373 | { |
| 404 | char *class_name; | 374 | char *class_name; |
| @@ -430,11 +400,6 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev) | |||
| 430 | kfree(class_name); | 400 | kfree(class_name); |
| 431 | } | 401 | } |
| 432 | #else | 402 | #else |
| 433 | static inline int deprecated_class_uevent(char **envp, int num_envp, | ||
| 434 | int *cur_index, char *buffer, | ||
| 435 | int buffer_size, int *cur_len, | ||
| 436 | struct class_device *class_dev) | ||
| 437 | { return 0; } | ||
| 438 | static inline int make_deprecated_class_device_links(struct class_device *cd) | 403 | static inline int make_deprecated_class_device_links(struct class_device *cd) |
| 439 | { return 0; } | 404 | { return 0; } |
| 440 | static void remove_deprecated_class_device_links(struct class_device *cd) | 405 | static void remove_deprecated_class_device_links(struct class_device *cd) |
| @@ -445,15 +410,13 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, | |||
| 445 | int num_envp, char *buffer, int buffer_size) | 410 | int num_envp, char *buffer, int buffer_size) |
| 446 | { | 411 | { |
| 447 | struct class_device *class_dev = to_class_dev(kobj); | 412 | struct class_device *class_dev = to_class_dev(kobj); |
| 413 | struct device *dev = class_dev->dev; | ||
| 448 | int i = 0; | 414 | int i = 0; |
| 449 | int length = 0; | 415 | int length = 0; |
| 450 | int retval = 0; | 416 | int retval = 0; |
| 451 | 417 | ||
| 452 | pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); | 418 | pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); |
| 453 | 419 | ||
| 454 | deprecated_class_uevent(envp, num_envp, &i, buffer, buffer_size, | ||
| 455 | &length, class_dev); | ||
| 456 | |||
| 457 | if (MAJOR(class_dev->devt)) { | 420 | if (MAJOR(class_dev->devt)) { |
| 458 | add_uevent_var(envp, num_envp, &i, | 421 | add_uevent_var(envp, num_envp, &i, |
| 459 | buffer, buffer_size, &length, | 422 | buffer, buffer_size, &length, |
| @@ -464,6 +427,26 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, | |||
| 464 | "MINOR=%u", MINOR(class_dev->devt)); | 427 | "MINOR=%u", MINOR(class_dev->devt)); |
| 465 | } | 428 | } |
| 466 | 429 | ||
| 430 | if (dev) { | ||
| 431 | const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); | ||
| 432 | if (path) { | ||
| 433 | add_uevent_var(envp, num_envp, &i, | ||
| 434 | buffer, buffer_size, &length, | ||
| 435 | "PHYSDEVPATH=%s", path); | ||
| 436 | kfree(path); | ||
| 437 | } | ||
| 438 | |||
| 439 | if (dev->bus) | ||
| 440 | add_uevent_var(envp, num_envp, &i, | ||
| 441 | buffer, buffer_size, &length, | ||
| 442 | "PHYSDEVBUS=%s", dev->bus->name); | ||
| 443 | |||
| 444 | if (dev->driver) | ||
| 445 | add_uevent_var(envp, num_envp, &i, | ||
| 446 | buffer, buffer_size, &length, | ||
| 447 | "PHYSDEVDRIVER=%s", dev->driver->name); | ||
| 448 | } | ||
| 449 | |||
| 467 | /* terminate, set to next free slot, shrink available space */ | 450 | /* terminate, set to next free slot, shrink available space */ |
| 468 | envp[i] = NULL; | 451 | envp[i] = NULL; |
| 469 | envp = &envp[i]; | 452 | envp = &envp[i]; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index b78fc1e68264..dd40d78a023d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -180,10 +180,12 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp, | |||
| 180 | const char *path; | 180 | const char *path; |
| 181 | 181 | ||
| 182 | path = kobject_get_path(&parent->kobj, GFP_KERNEL); | 182 | path = kobject_get_path(&parent->kobj, GFP_KERNEL); |
| 183 | add_uevent_var(envp, num_envp, &i, | 183 | if (path) { |
| 184 | buffer, buffer_size, &length, | 184 | add_uevent_var(envp, num_envp, &i, |
| 185 | "PHYSDEVPATH=%s", path); | 185 | buffer, buffer_size, &length, |
| 186 | kfree(path); | 186 | "PHYSDEVPATH=%s", path); |
| 187 | kfree(path); | ||
| 188 | } | ||
| 187 | 189 | ||
| 188 | add_uevent_var(envp, num_envp, &i, | 190 | add_uevent_var(envp, num_envp, &i, |
| 189 | buffer, buffer_size, &length, | 191 | buffer, buffer_size, &length, |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 92428e55b0c2..b0088b0efecd 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -207,19 +207,6 @@ static int __device_attach(struct device_driver * drv, void * data) | |||
| 207 | return driver_probe_device(drv, dev); | 207 | return driver_probe_device(drv, dev); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | static int device_probe_drivers(void *data) | ||
| 211 | { | ||
| 212 | struct device *dev = data; | ||
| 213 | int ret = 0; | ||
| 214 | |||
| 215 | if (dev->bus) { | ||
| 216 | down(&dev->sem); | ||
| 217 | ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); | ||
| 218 | up(&dev->sem); | ||
| 219 | } | ||
| 220 | return ret; | ||
| 221 | } | ||
| 222 | |||
| 223 | /** | 210 | /** |
| 224 | * device_attach - try to attach device to a driver. | 211 | * device_attach - try to attach device to a driver. |
| 225 | * @dev: device. | 212 | * @dev: device. |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 97ab5bd1c4d6..89a5f4a54913 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * firmware_class.c - Multi purpose firmware loading support | 2 | * firmware_class.c - Multi purpose firmware loading support |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | * Copyright (c) 2003 Manuel Estrada Sainz |
| 5 | * | 5 | * |
| 6 | * Please see Documentation/firmware_class/ for more information. | 6 | * Please see Documentation/firmware_class/ for more information. |
| 7 | * | 7 | * |
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #define to_dev(obj) container_of(obj, struct device, kobj) | 24 | #define to_dev(obj) container_of(obj, struct device, kobj) |
| 25 | 25 | ||
| 26 | MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); | 26 | MODULE_AUTHOR("Manuel Estrada Sainz"); |
| 27 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); | 27 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); |
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | 29 | ||
diff --git a/lib/kobject.c b/lib/kobject.c index fc5f3f6e7329..ac1520651b9b 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -202,14 +202,14 @@ int kobject_shadow_add(struct kobject * kobj, struct dentry *shadow_parent) | |||
| 202 | 202 | ||
| 203 | /* be noisy on error issues */ | 203 | /* be noisy on error issues */ |
| 204 | if (error == -EEXIST) | 204 | if (error == -EEXIST) |
| 205 | printk("kobject_add failed for %s with -EEXIST, " | 205 | printk(KERN_ERR "kobject_add failed for %s with " |
| 206 | "don't try to register things with the " | 206 | "-EEXIST, don't try to register things with " |
| 207 | "same name in the same directory.\n", | 207 | "the same name in the same directory.\n", |
| 208 | kobject_name(kobj)); | 208 | kobject_name(kobj)); |
| 209 | else | 209 | else |
| 210 | printk("kobject_add failed for %s (%d)\n", | 210 | printk(KERN_ERR "kobject_add failed for %s (%d)\n", |
| 211 | kobject_name(kobj), error); | 211 | kobject_name(kobj), error); |
| 212 | dump_stack(); | 212 | dump_stack(); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | return error; | 215 | return error; |
