[PATCH] thermal: armada: simplify name sanitization

Rasmus Villemoes posted 1 patch 1 year, 10 months ago
drivers/thermal/armada_thermal.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
[PATCH] thermal: armada: simplify name sanitization
Posted by Rasmus Villemoes 1 year, 10 months ago
Simplify the code by using the helper we have for doing exactly this.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/thermal/armada_thermal.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index f783547ef964..fdcb077cfd54 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -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, '-', '_');
 }
 
 /*
-- 
2.40.1.1.g1c60b9335d
Re: [PATCH] thermal: armada: simplify name sanitization
Posted by Daniel Lezcano 1 year, 10 months ago
On 20/03/2024 11:49, Rasmus Villemoes wrote:
> Simplify the code by using the helper we have for doing exactly this.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---

Applied, thanks

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Re: [PATCH] thermal: armada: simplify name sanitization
Posted by Miquel Raynal 1 year, 10 months ago
Hi Rasmus,

linux@rasmusvillemoes.dk wrote on Wed, 20 Mar 2024 11:49:39 +0100:

> 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>


Thanks,
Miquèl