Driver core: create devices/virtual/ tree

This change creates a devices/virtual/CLASS_NAME tree for struct devices
that belong to a class, yet do not have a "real" struct device for a
parent.  It automatically creates the directories on the fly as needed.


Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman
2006-08-07 22:19:37 -07:00
parent a2de48cace
commit c205ef4880
3 changed files with 28 additions and 1 deletions

View File

@@ -378,6 +378,13 @@ int device_add(struct device *dev)
if (!dev || !strlen(dev->bus_id))
goto Error;
/* if this is a class device, and has no parent, create one */
if ((dev->class) && (dev->parent == NULL)) {
error = virtual_device_parent(dev);
if (error)
goto Error;
}
parent = get_device(dev->parent);
pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id);