aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 6fee3e6b1ac2..7a5336f7df89 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -154,25 +154,47 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,
154 "MINOR=%u", MINOR(dev->devt)); 154 "MINOR=%u", MINOR(dev->devt));
155 } 155 }
156 156
157#ifdef CONFIG_SYSFS_DEPRECATED 157 if (dev->driver)
158 /* add bus name (same as SUBSYSTEM, deprecated) */
159 if (dev->bus)
160 add_uevent_var(envp, num_envp, &i,
161 buffer, buffer_size, &length,
162 "PHYSDEVBUS=%s", dev->bus->name);
163#endif
164
165 /* add driver name (PHYSDEV* values are deprecated)*/
166 if (dev->driver) {
167 add_uevent_var(envp, num_envp, &i, 158 add_uevent_var(envp, num_envp, &i,
168 buffer, buffer_size, &length, 159 buffer, buffer_size, &length,
169 "DRIVER=%s", dev->driver->name); 160 "DRIVER=%s", dev->driver->name);
161
170#ifdef CONFIG_SYSFS_DEPRECATED 162#ifdef CONFIG_SYSFS_DEPRECATED
163 if (dev->class) {
164 struct device *parent = dev->parent;
165
166 /* find first bus device in parent chain */
167 while (parent && !parent->bus)
168 parent = parent->parent;
169 if (parent && parent->bus) {
170 const char *path;
171
172 path = kobject_get_path(&parent->kobj, GFP_KERNEL);
173 add_uevent_var(envp, num_envp, &i,
174 buffer, buffer_size, &length,
175 "PHYSDEVPATH=%s", path);
176 kfree(path);
177
178 add_uevent_var(envp, num_envp, &i,
179 buffer, buffer_size, &length,
180 "PHYSDEVBUS=%s", parent->bus->name);
181
182 if (parent->driver)
183 add_uevent_var(envp, num_envp, &i,
184 buffer, buffer_size, &length,
185 "PHYSDEVDRIVER=%s", parent->driver->name);
186 }
187 } else if (dev->bus) {
171 add_uevent_var(envp, num_envp, &i, 188 add_uevent_var(envp, num_envp, &i,
172 buffer, buffer_size, &length, 189 buffer, buffer_size, &length,
173 "PHYSDEVDRIVER=%s", dev->driver->name); 190 "PHYSDEVBUS=%s", dev->bus->name);
174#endif 191
192 if (dev->driver)
193 add_uevent_var(envp, num_envp, &i,
194 buffer, buffer_size, &length,
195 "PHYSDEVDRIVER=%s", dev->driver->name);
175 } 196 }
197#endif
176 198
177 /* terminate, set to next free slot, shrink available space */ 199 /* terminate, set to next free slot, shrink available space */
178 envp[i] = NULL; 200 envp[i] = NULL;