Skip to contentSkip to conversation

of: re-use kernel's kbasename()

PATCH In review Andy Shevchenko 2 participants 2 messages Oct 31, 2012 1 message not in the archive Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of: re-use kernel's kbasename()

Cc Grant Likely <grant.likely-s3s/[email protected]>
Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>
---
 drivers/of/fdt.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/of/fdt.c +2 -8
index 91a375f..0ca0f9e 100644
@@ -486,14 +486,8 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
 		depth++;
 		pathp = (char *)p;
 		p = ALIGN(p + strlen(pathp) + 1, 4);
-		if ((*pathp) == '/') {
-			char *lp, *np;
-			for (lp = NULL, np = pathp; *np; np++)
-				if ((*np) == '/')
-					lp = np+1;
-			if (lp != NULL)
-				pathp = lp;
-		}
+		if (*pathp == '/')
+			pathp = kbasename(pathp);
 		rc = it(p, pathp, depth, data);
 		if (rc != 0)
 			break;
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1351690226-28152-1-git-send-email-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]

Acked-by
#2 lore raw
Quoted 3 lines · Andy Shevchenko
Cc Grant Likely <grant.likely-s3s/[email protected]>
Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>

Please merge through the same tree that adds the new kbasename function.

g.

Quoted 28 lines
---
 drivers/of/fdt.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/of/fdt.c +2 -9
index 91a375f..0ca0f9e 100644
@@ -486,14 +486,8 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
                depth++;
                pathp = (char *)p;
                p = ALIGN(p + strlen(pathp) + 1, 4);
-               if ((*pathp) == '/') {
-                       char *lp, *np;
-                       for (lp = NULL, np = pathp; *np; np++)
-                               if ((*np) == '/')
-                                       lp = np+1;
-                       if (lp != NULL)
-                               pathp = lp;
-               }
+               if (*pathp == '/')
+                       pathp = kbasename(pathp);
                rc = it(p, pathp, depth, data);
                if (rc != 0)
                        break;
--

1.7.10.4

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.