projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2abf114
)
drivers/base/core.c: use strreplace()
author
Rasmus Villemoes
<
[email protected]
>
Thu, 25 Jun 2015 22:02:33 +0000
(15:02 -0700)
committer
Linus Torvalds
<
[email protected]
>
Fri, 26 Jun 2015 00:00:40 +0000
(17:00 -0700)
This eliminates a little .text and avoids repeating the strchr call when
we meet a '!' (which will happen at least once).
Signed-off-by: Rasmus Villemoes <
[email protected]
>
Cc: Greg Kroah-Hartman <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/base/core.c
patch
|
blob
|
history
diff --git
a/drivers/base/core.c
b/drivers/base/core.c
index 21d13038534e347f4fcccfc10f532659e2444928..dafae6d2f7ace1fd2941fcbc26ca50fa6450b0f9 100644
(file)
--- a/
drivers/base/core.c
+++ b/
drivers/base/core.c
@@
-1303,12
+1303,11
@@
const char *device_get_devnode(struct device *dev,
return dev_name(dev);
/* replace '!' in the name with '/' */
-
*tmp
= kstrdup(dev_name(dev), GFP_KERNEL);
- if (!
*tmp
)
+
s
= kstrdup(dev_name(dev), GFP_KERNEL);
+ if (!
s
)
return NULL;
- while ((s = strchr(*tmp, '!')))
- s[0] = '/';
- return *tmp;
+ strreplace(s, '!', '/');
+ return *tmp = s;
}
/**