Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57487
b: refs/heads/master
c: 2c7afd1
h: refs/heads/master
i:
  57485: fbe8fcd
  57483: d8e0b15
  57479: 4340473
  57471: e52d192
v: v3
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Jun 8, 2007
1 parent 1d4ae0e commit 565cac3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: adfdebceaca988515ecdb557d600fd5ab9da913a
refs/heads/master: 2c7afd125cc482dbdf6b0a169c42337e7e76cda5
59 changes: 21 additions & 38 deletions trunk/drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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];
Expand Down
10 changes: 6 additions & 4 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 565cac3

Please sign in to comment.