diff options
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index d4f35d8902a2..dbcd40b987d2 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -384,6 +384,23 @@ void device_initialize(struct device *dev) | |||
384 | device_init_wakeup(dev, 0); | 384 | device_init_wakeup(dev, 0); |
385 | } | 385 | } |
386 | 386 | ||
387 | static int virtual_device_parent(struct device *dev) | ||
388 | { | ||
389 | if (!dev->class) | ||
390 | return -ENODEV; | ||
391 | |||
392 | if (!dev->class->virtual_dir) { | ||
393 | static struct kobject *virtual_dir = NULL; | ||
394 | |||
395 | if (!virtual_dir) | ||
396 | virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); | ||
397 | dev->class->virtual_dir = kobject_add_dir(virtual_dir, dev->class->name); | ||
398 | } | ||
399 | |||
400 | dev->kobj.parent = dev->class->virtual_dir; | ||
401 | return 0; | ||
402 | } | ||
403 | |||
387 | /** | 404 | /** |
388 | * device_add - add device to device hierarchy. | 405 | * device_add - add device to device hierarchy. |
389 | * @dev: device. | 406 | * @dev: device. |