Steffen Trumtrar
2017-07-05 10:56:33 UTC
Signed-off-by: Steffen Trumtrar <***@pengutronix.de>
---
fs/devfs-core.c | 14 ++++++++++++++
include/driver.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 3368d3ed68bd..be56edd18d80 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -95,6 +95,20 @@ struct cdev *cdev_by_device_node(struct device_node *node)
return NULL;
}
+struct cdev *cdev_by_partuuid(const char *partuuid)
+{
+ struct cdev *cdev;
+
+ if (!partuuid)
+ return NULL;
+
+ list_for_each_entry(cdev, &cdev_list, list) {
+ if (!strcmp(cdev->partuuid, partuuid))
+ return cdev;
+ }
+ return NULL;
+}
+
/**
* device_find_partition - find a partition belonging to a physical device
*
diff --git a/include/driver.h b/include/driver.h
index 3d701f24398a..8617872053d8 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -472,6 +472,7 @@ struct cdev *cdev_by_name(const char *filename);
struct cdev *lcdev_by_name(const char *filename);
struct cdev *cdev_readlink(struct cdev *cdev);
struct cdev *cdev_by_device_node(struct device_node *node);
+struct cdev *cdev_by_partuuid(const char *partuuid);
struct cdev *cdev_open(const char *name, unsigned long flags);
struct cdev *cdev_create_loop(const char *path, ulong flags);
void cdev_remove_loop(struct cdev *cdev);
---
fs/devfs-core.c | 14 ++++++++++++++
include/driver.h | 1 +
2 files changed, 15 insertions(+)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 3368d3ed68bd..be56edd18d80 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -95,6 +95,20 @@ struct cdev *cdev_by_device_node(struct device_node *node)
return NULL;
}
+struct cdev *cdev_by_partuuid(const char *partuuid)
+{
+ struct cdev *cdev;
+
+ if (!partuuid)
+ return NULL;
+
+ list_for_each_entry(cdev, &cdev_list, list) {
+ if (!strcmp(cdev->partuuid, partuuid))
+ return cdev;
+ }
+ return NULL;
+}
+
/**
* device_find_partition - find a partition belonging to a physical device
*
diff --git a/include/driver.h b/include/driver.h
index 3d701f24398a..8617872053d8 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -472,6 +472,7 @@ struct cdev *cdev_by_name(const char *filename);
struct cdev *lcdev_by_name(const char *filename);
struct cdev *cdev_readlink(struct cdev *cdev);
struct cdev *cdev_by_device_node(struct device_node *node);
+struct cdev *cdev_by_partuuid(const char *partuuid);
struct cdev *cdev_open(const char *name, unsigned long flags);
struct cdev *cdev_create_loop(const char *path, ulong flags);
void cdev_remove_loop(struct cdev *cdev);
--
2.11.0
2.11.0