diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-05-01 13:46:26 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-06-08 12:41:07 -0700 |
commit | 2c7afd125cc482dbdf6b0a169c42337e7e76cda5 (patch) | |
tree | d20f31d12e09e5a1305d9c274047589cf156181d /drivers/base/class.c | |
parent | adfdebceaca988515ecdb557d600fd5ab9da913a (diff) | |
download | kernel_samsung_smdk4412-2c7afd125cc482dbdf6b0a169c42337e7e76cda5.tar.gz kernel_samsung_smdk4412-2c7afd125cc482dbdf6b0a169c42337e7e76cda5.tar.bz2 kernel_samsung_smdk4412-2c7afd125cc482dbdf6b0a169c42337e7e76cda5.zip |
Driver core: keep PHYSDEV for old struct class_device
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>
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r-- | drivers/base/class.c | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 20c4ea6eb50..8c506dbe391 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]; |