* [GIT PATCH] Driver core fixes for 2.6.22-rc4
@ 2007-06-08 20:04 Greg KH
2007-06-08 20:04 ` [PATCH 1/5] update Documentation/driver-model/platform.txt Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2007-06-08 20:04 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
Here are some driver core fixes for 2.6.22-rc4
They contain:
- documentation update
- email fixes for a deceased maintainer
- fixes for PHYSDEV for older class_devices that broke some
userspace tools unnecessarily
- printk levels for kobjects.
- fix compiler warning that like 10 people have emailed me
patches for.
All of these have been in the -mm tree for a number of weeks.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
Patches will be sent as a follow-on to this message to lkml for people
to see.
thanks,
greg k-h
Documentation/driver-model/platform.txt | 40 +++++++++++++
Documentation/firmware_class/README | 2 +-
.../firmware_class/firmware_sample_driver.c | 2 +-
.../firmware_sample_firmware_class.c | 4 +-
drivers/base/class.c | 59 +++++++-------------
drivers/base/core.c | 10 ++-
drivers/base/dd.c | 13 ----
drivers/base/firmware_class.c | 4 +-
lib/kobject.c | 10 ++--
9 files changed, 78 insertions(+), 66 deletions(-)
---------------
David Brownell (1):
update Documentation/driver-model/platform.txt
Greg Kroah-Hartman (1):
kobject: use the proper printk level for kobject error
Kay Sievers (1):
Driver core: keep PHYSDEV for old struct class_device
Markus Rechberger (1):
firmware: remove orphaned Email
Stephen Hemminger (1):
Driver core: kill unused code
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/5] update Documentation/driver-model/platform.txt 2007-06-08 20:04 [GIT PATCH] Driver core fixes for 2.6.22-rc4 Greg KH @ 2007-06-08 20:04 ` Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 2/5] Driver core: keep PHYSDEV for old struct class_device Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2007-06-08 20:04 UTC (permalink / raw) To: linux-kernel Cc: David Brownell, David Brownell, Andres Salomon, Dmitry Torokhov, Russell King, Andrew Morton, Greg Kroah-Hartman From: David Brownell <david-b@pacbell.net> Make note of the legacy "probe-the-hardware" drivers, and some APIs that are mostly unused except by such drivers. We probably can't escape having legacy drivers for a while (e.g. old ISA drivers), but we can at least discourage this style code for new drivers, and unless it's unavoidable. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Andres Salomon <dilinger@debian.org> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- Documentation/driver-model/platform.txt | 40 +++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt index 19c4a6e..2a97320 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 calls to clk_get(&pdev->dev, clock_name) return them as needed. +Legacy Drivers: Device Probing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Some drivers are not fully converted to the driver model, because they take +on a non-driver role: the driver registers its platform device, rather than +leaving that for system infrastructure. Such drivers can't be hotplugged +or coldplugged, since those mechanisms require device creation to be in a +different system component than the driver. + +The only "good" reason for this is to handle older system designs which, like +original IBM PCs, rely on error-prone "probe-the-hardware" models for hardware +configuration. Newer systems have largely abandoned that model, in favor of +bus-level support for dynamic configuration (PCI, USB), or device tables +provided by the boot firmware (e.g. PNPACPI on x86). There are too many +conflicting options about what might be where, and even educated guesses by +an operating system will be wrong often enough to make trouble. + +This style of driver is discouraged. If you're updating such a driver, +please try to move the device enumeration to a more appropriate location, +outside the driver. This will usually be cleanup, since such drivers +tend to already have "normal" modes, such as ones using device nodes that +were created by PNP or by platform device setup. + +None the less, there are some APIs to support such legacy drivers. Avoid +using these calls except with such hotplug-deficient drivers. + + struct platform_device *platform_device_alloc( + char *name, unsigned id); + +You can use platform_device_alloc() to dynamically allocate a device, which +you will then initialize with resources and platform_device_register(). +A better solution is usually: + + struct platform_device *platform_device_register_simple( + char *name, unsigned id, + struct resource *res, unsigned nres); + +You can use platform_device_register_simple() as a one-step call to allocate +and register a device. + + Device Naming and Driver Binding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The platform_device.dev.bus_id is the canonical name for the devices. -- 1.5.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] Driver core: keep PHYSDEV for old struct class_device 2007-06-08 20:04 ` [PATCH 1/5] update Documentation/driver-model/platform.txt Greg Kroah-Hartman @ 2007-06-08 20:04 ` Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 3/5] Driver core: kill unused code Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2007-06-08 20:04 UTC (permalink / raw) To: linux-kernel; +Cc: Kay Sievers, Greg Kroah-Hartman From: Kay Sievers <kay.sievers@vrfy.org> Class-devices created by "struct class_device" are going to be replaced by "struct device". Keep the deprecated PHYSDEV* variables for the already "deprecated" struct class_device" devices. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- drivers/base/class.c | 59 +++++++++++++++++-------------------------------- drivers/base/core.c | 10 +++++--- 2 files changed, 27 insertions(+), 42 deletions(-) diff --git a/drivers/base/class.c b/drivers/base/class.c index 20c4ea6..8c506db 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) return class_name; } -static int deprecated_class_uevent(char **envp, int num_envp, int *cur_index, - char *buffer, int buffer_size, - int *cur_len, - struct class_device *class_dev) -{ - struct device *dev = class_dev->dev; - char *path; - - if (!dev) - return 0; - - /* add device, backing this class device (deprecated) */ - path = kobject_get_path(&dev->kobj, GFP_KERNEL); - - add_uevent_var(envp, num_envp, cur_index, buffer, buffer_size, - cur_len, "PHYSDEVPATH=%s", path); - kfree(path); - - if (dev->bus) - add_uevent_var(envp, num_envp, cur_index, - buffer, buffer_size, cur_len, - "PHYSDEVBUS=%s", dev->bus->name); - - if (dev->driver) - add_uevent_var(envp, num_envp, cur_index, - buffer, buffer_size, cur_len, - "PHYSDEVDRIVER=%s", dev->driver->name); - return 0; -} - static int make_deprecated_class_device_links(struct class_device *class_dev) { char *class_name; @@ -430,11 +400,6 @@ static void remove_deprecated_class_device_links(struct class_device *class_dev) kfree(class_name); } #else -static inline int deprecated_class_uevent(char **envp, int num_envp, - int *cur_index, char *buffer, - int buffer_size, int *cur_len, - struct class_device *class_dev) -{ return 0; } static inline int make_deprecated_class_device_links(struct class_device *cd) { return 0; } 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, int num_envp, char *buffer, int buffer_size) { struct class_device *class_dev = to_class_dev(kobj); + struct device *dev = class_dev->dev; int i = 0; int length = 0; int retval = 0; pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); - deprecated_class_uevent(envp, num_envp, &i, buffer, buffer_size, - &length, class_dev); - if (MAJOR(class_dev->devt)) { add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, @@ -464,6 +427,26 @@ static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, "MINOR=%u", MINOR(class_dev->devt)); } + if (dev) { + const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); + if (path) { + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVPATH=%s", path); + kfree(path); + } + + if (dev->bus) + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); + + if (dev->driver) + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); + } + /* terminate, set to next free slot, shrink available space */ envp[i] = NULL; envp = &envp[i]; diff --git a/drivers/base/core.c b/drivers/base/core.c index b78fc1e..dd40d78 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, const char *path; path = kobject_get_path(&parent->kobj, GFP_KERNEL); - add_uevent_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVPATH=%s", path); - kfree(path); + if (path) { + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVPATH=%s", path); + kfree(path); + } add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, -- 1.5.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] Driver core: kill unused code 2007-06-08 20:04 ` [PATCH 2/5] Driver core: keep PHYSDEV for old struct class_device Greg Kroah-Hartman @ 2007-06-08 20:04 ` Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 4/5] kobject: use the proper printk level for kobject error Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2007-06-08 20:04 UTC (permalink / raw) To: linux-kernel; +Cc: Stephen Hemminger, Greg Kroah-Hartman From: Stephen Hemminger <shemminger@linux-foundation.org> CC drivers/base/dd.o drivers/base/dd.c:211: warning: =E2=80=98device_probe_drivers=E2=80=99 defi= ned but not used Looks like the following is dead. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- drivers/base/dd.c | 13 ------------- 1 files changed, 0 insertions(+), 13 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 92428e5..b0088b0 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) return driver_probe_device(drv, dev); } -static int device_probe_drivers(void *data) -{ - struct device *dev = data; - int ret = 0; - - if (dev->bus) { - down(&dev->sem); - ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); - up(&dev->sem); - } - return ret; -} - /** * device_attach - try to attach device to a driver. * @dev: device. -- 1.5.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] kobject: use the proper printk level for kobject error 2007-06-08 20:04 ` [PATCH 3/5] Driver core: kill unused code Greg Kroah-Hartman @ 2007-06-08 20:04 ` Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 5/5] firmware: remove orphaned Email Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2007-06-08 20:04 UTC (permalink / raw) To: linux-kernel; +Cc: Greg Kroah-Hartman, Jean Delvare Thanks to Jean Delvare <khali@linux-fr.org> for pointing it out to me. Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- lib/kobject.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/kobject.c b/lib/kobject.c index fc5f3f6..ac15206 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -202,14 +202,14 @@ int kobject_shadow_add(struct kobject * kobj, struct dentry *shadow_parent) /* be noisy on error issues */ if (error == -EEXIST) - printk("kobject_add failed for %s with -EEXIST, " - "don't try to register things with the " - "same name in the same directory.\n", + printk(KERN_ERR "kobject_add failed for %s with " + "-EEXIST, don't try to register things with " + "the same name in the same directory.\n", kobject_name(kobj)); else - printk("kobject_add failed for %s (%d)\n", + printk(KERN_ERR "kobject_add failed for %s (%d)\n", kobject_name(kobj), error); - dump_stack(); + dump_stack(); } return error; -- 1.5.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] firmware: remove orphaned Email 2007-06-08 20:04 ` [PATCH 4/5] kobject: use the proper printk level for kobject error Greg Kroah-Hartman @ 2007-06-08 20:04 ` Greg Kroah-Hartman 0 siblings, 0 replies; 6+ messages in thread From: Greg Kroah-Hartman @ 2007-06-08 20:04 UTC (permalink / raw) To: linux-kernel; +Cc: Markus Rechberger, Greg Kroah-Hartman From: Markus Rechberger <markus.rechberger@amd.com> Manuel Estrada Sainz passed away on May 9th 2004, his email account got deactivated. He was in charge of the firmware_class code, and still got CC'ed in recent discussions about it. Signed-off-by: Markus Rechberger <markus.rechberger@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- Documentation/firmware_class/README | 2 +- .../firmware_class/firmware_sample_driver.c | 2 +- .../firmware_sample_firmware_class.c | 4 ++-- drivers/base/firmware_class.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/firmware_class/README b/Documentation/firmware_class/README index e9cc8bb..c3480aa 100644 --- a/Documentation/firmware_class/README +++ b/Documentation/firmware_class/README @@ -1,7 +1,7 @@ request_firmware() hotplug interface: ------------------------------------ - Copyright (C) 2003 Manuel Estrada Sainz <ranty@debian.org> + Copyright (C) 2003 Manuel Estrada Sainz Why: --- diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index 87feccd..6865cbe 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c @@ -1,7 +1,7 @@ /* * firmware_sample_driver.c - * - * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> + * Copyright (c) 2003 Manuel Estrada Sainz * * Sample code on how to use request_firmware() from drivers. * diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c index 9e1b0e4..4994f1f 100644 --- a/Documentation/firmware_class/firmware_sample_firmware_class.c +++ b/Documentation/firmware_class/firmware_sample_firmware_class.c @@ -1,7 +1,7 @@ /* * firmware_sample_firmware_class.c - * - * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> + * Copyright (c) 2003 Manuel Estrada Sainz * * NOTE: This is just a probe of concept, if you think that your driver would * be well served by this mechanism please contact me first. @@ -19,7 +19,7 @@ #include <linux/firmware.h> -MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); +MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_DESCRIPTION("Hackish sample for using firmware class directly"); MODULE_LICENSE("GPL"); diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 97ab5bd..89a5f4a 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -1,7 +1,7 @@ /* * firmware_class.c - Multi purpose firmware loading support * - * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> + * Copyright (c) 2003 Manuel Estrada Sainz * * Please see Documentation/firmware_class/ for more information. * @@ -23,7 +23,7 @@ #define to_dev(obj) container_of(obj, struct device, kobj) -MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); +MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_DESCRIPTION("Multi purpose firmware loading support"); MODULE_LICENSE("GPL"); -- 1.5.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-06-08 20:25 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-06-08 20:04 [GIT PATCH] Driver core fixes for 2.6.22-rc4 Greg KH 2007-06-08 20:04 ` [PATCH 1/5] update Documentation/driver-model/platform.txt Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 2/5] Driver core: keep PHYSDEV for old struct class_device Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 3/5] Driver core: kill unused code Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 4/5] kobject: use the proper printk level for kobject error Greg Kroah-Hartman 2007-06-08 20:04 ` [PATCH 5/5] firmware: remove orphaned Email Greg Kroah-Hartman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox