Skip to content

Commit

Permalink
Driver Core: Move virtual_device_parent() to core.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Kroah-Hartman committed Dec 1, 2006
1 parent 1901fb2 commit f0ee61a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
17 changes: 0 additions & 17 deletions drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,23 +893,6 @@ void class_interface_unregister(struct class_interface *class_intf)
class_put(parent);
}

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;
}

int __init classes_init(void)
{
int retval;
Expand Down
17 changes: 17 additions & 0 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
__attribute__((format(printf,4,5)));
extern void device_destroy(struct class *cls, dev_t devt);

extern int virtual_device_parent(struct device *dev);

/*
* Platform "fixup" functions - allow the platform to have their say
* about devices and actions that the general device layer doesn't
Expand Down

0 comments on commit f0ee61a

Please sign in to comment.