aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-10-23 13:40:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:51:58 -0500
commitf0ee61a6cecd100301a60d99feb187776533b2a2 (patch)
tree69fe62325427cdec7687e951e680ca9ff3486a3d /drivers/base
parent1901fb2604fbcd53201f38725182ea807581159e (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')
-rw-r--r--drivers/base/class.c17
-rw-r--r--drivers/base/core.c17
2 files changed, 17 insertions, 17 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 0ff267a248db..2e705f6abb4c 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -893,23 +893,6 @@ void class_interface_unregister(struct class_interface *class_intf)
893 class_put(parent); 893 class_put(parent);
894} 894}
895 895
896int virtual_device_parent(struct device *dev)
897{
898 if (!dev->class)
899 return -ENODEV;
900
901 if (!dev->class->virtual_dir) {
902 static struct kobject *virtual_dir = NULL;
903
904 if (!virtual_dir)
905 virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual");
906 dev->class->virtual_dir = kobject_add_dir(virtual_dir, dev->class->name);
907 }
908
909 dev->kobj.parent = dev->class->virtual_dir;
910 return 0;
911}
912
913int __init classes_init(void) 896int __init classes_init(void)
914{ 897{
915 int retval; 898 int retval;
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
387static 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.