[RFC/PATCH 5/8] drivers/base/core.c: Use strreplace

From: Rasmus Villemoes
Date: Thu Jun 04 2015 - 05:39:46 EST


This eliminates a local variable and a little .text.

Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
drivers/base/core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 21d13038534e..01f2c1214f06 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1282,8 +1282,6 @@ const char *device_get_devnode(struct device *dev,
umode_t *mode, kuid_t *uid, kgid_t *gid,
const char **tmp)
{
- char *s;
-
*tmp = NULL;

/* the device type may provide a specific name */
@@ -1306,8 +1304,7 @@ const char *device_get_devnode(struct device *dev,
*tmp = kstrdup(dev_name(dev), GFP_KERNEL);
if (!*tmp)
return NULL;
- while ((s = strchr(*tmp, '!')))
- s[0] = '/';
+ strreplace((char *)*tmp, '!', '/');
return *tmp;
}

--
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/