thermal/drivers/armada: Simplify name sanitization
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 20 Mar 2024 10:49:39 +0000 (11:49 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 23 Apr 2024 10:40:29 +0000 (12:40 +0200)
Simplify the code by using the helper we have for doing exactly this.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20240320104940.65031-1-linux@rasmusvillemoes.dk
drivers/thermal/armada_thermal.c

index f783547ef964a32f8e8aaa79f670bfa9b75eb02e..fdcb077cfd54e76720a9a2cdc38c2845375294b5 100644 (file)
@@ -763,7 +763,6 @@ static void armada_set_sane_name(struct platform_device *pdev,
                                 struct armada_thermal_priv *priv)
 {
        const char *name = dev_name(&pdev->dev);
-       char *insane_char;
 
        if (strlen(name) > THERMAL_NAME_LENGTH) {
                /*
@@ -781,12 +780,8 @@ static void armada_set_sane_name(struct platform_device *pdev,
        /* Save the name locally */
        strscpy(priv->zone_name, name, THERMAL_NAME_LENGTH);
 
-       /* Then check there are no '-' or hwmon core will complain */
-       do {
-               insane_char = strpbrk(priv->zone_name, "-");
-               if (insane_char)
-                       *insane_char = '_';
-       } while (insane_char);
+       /* Then ensure there are no '-' or hwmon core will complain */
+       strreplace(priv->zone_name, '-', '_');
 }
 
 /*