[PATCH 2/4] fs: devfs: Allow mount path in cdev_open

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 13 00:51:52 PDT 2015


When opening a cdev also allow a path beginning with /dev/ as some
users of cdev_open already open coded this behaviour.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/devfs-core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 62571fb..26f56d9 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -121,9 +121,13 @@ int cdev_do_open(struct cdev *cdev, unsigned long flags)
 
 struct cdev *cdev_open(const char *name, unsigned long flags)
 {
-	struct cdev *cdev = cdev_by_name(name);
+	struct cdev *cdev;
 	int ret;
 
+	if (strncmp(name, "/dev/", 5))
+		name += 5;
+
+	cdev = cdev_by_name(name);
 	if (!cdev)
 		return NULL;
 
-- 
2.6.0




More information about the barebox mailing list