diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-10-23 10:40:54 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 14:51:58 -0800 |
commit | f0ee61a6cecd100301a60d99feb187776533b2a2 (patch) | |
tree | 69fe62325427cdec7687e951e680ca9ff3486a3d /drivers/base/core.c | |
parent | 1901fb2604fbcd53201f38725182ea807581159e (diff) |
Driver Core: Move virtual_device_parent() to core.c
It doesn't need to be global or in device.h
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 d4f35d8902a..dbcd40b987d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -384,6 +384,23 @@ void device_initialize(struct device *dev) device_init_wakeup(dev, 0); } +static int virtual_device_parent(struct device *dev) +{ + if (!dev->class) + return -ENODEV; + + if (!dev->class->virtual_dir) { + static struct kobject *virtual_dir = NULL; + + if (!virtual_dir) + virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); + dev->class->virtual_dir = kobject_add_dir(virtual_dir, dev->class->name); + } + + dev->kobj.parent = dev->class->virtual_dir; + return 0; +} + /** * device_add - add device to device hierarchy. * @dev: device. |