diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-08 01:19:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-26 00:08:38 -0400 |
commit | c205ef4880273d2de4ee5388d4e52227ff688cc4 (patch) | |
tree | 78e7cde849b9c40fd323b5550a8e64d5d169c55f /drivers/base/core.c | |
parent | a2de48cace5d0993da6cfa28b276ae724dc3569b (diff) |
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>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 0db47561331e..e21a65fc043e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -378,6 +378,13 @@ int device_add(struct device *dev) | |||
378 | if (!dev || !strlen(dev->bus_id)) | 378 | if (!dev || !strlen(dev->bus_id)) |
379 | goto Error; | 379 | goto Error; |
380 | 380 | ||
381 | /* if this is a class device, and has no parent, create one */ | ||
382 | if ((dev->class) && (dev->parent == NULL)) { | ||
383 | error = virtual_device_parent(dev); | ||
384 | if (error) | ||
385 | goto Error; | ||
386 | } | ||
387 | |||
381 | parent = get_device(dev->parent); | 388 | parent = get_device(dev->parent); |
382 | 389 | ||
383 | pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id); | 390 | pr_debug("DEV: registering device: ID = '%s'\n", dev->bus_id); |