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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user