diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-05-01 07:46:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-06-08 15:41:07 -0400 |
commit | 2c7afd125cc482dbdf6b0a169c42337e7e76cda5 (patch) | |
tree | d20f31d12e09e5a1305d9c274047589cf156181d /drivers/base/class.c | |
parent | adfdebceaca988515ecdb557d600fd5ab9da913a (diff) |
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 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]; |