diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-04-09 15:16:34 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-09-01 07:43:16 +0200 |
commit | 3f68a7698d882f1e1ce5827fac92736e19f76018 (patch) | |
tree | 4322b285f393124fefc5729780ce14dbbbf0a95c /fs/devfs-core.c | |
parent | 89ca3fcaad55a3847d1a6c576dedfcc9f7394e31 (diff) | |
download | barebox-3f68a7698d882f1e1ce5827fac92736e19f76018.tar.gz barebox-3f68a7698d882f1e1ce5827fac92736e19f76018.tar.xz |
cdev: Add function to find cdev by device_node
This adds a device_node member to struct cdev and a function
to find a cdev by device_node.
This also removes the setting of cdev->dev->device_node in
the of partition parser. We must not set the device since it
may not refer to a partition but to a whole device with partitions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/devfs-core.c')
-rw-r--r-- | fs/devfs-core.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/devfs-core.c b/fs/devfs-core.c index f45f8cadf1..62571fb8a3 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -57,6 +57,19 @@ struct cdev *cdev_by_name(const char *filename) return NULL; } +struct cdev *cdev_by_device_node(struct device_node *node) +{ + struct cdev *cdev; + + list_for_each_entry(cdev, &cdev_list, list) { + if (!cdev->device_node) + continue; + if (cdev->device_node == node) + return cdev; + } + return NULL; +} + /** * device_find_partition - find a partition belonging to a physical device * |