Skip to contentSkip to conversation

power: supply: core: remove opencoded string_lower()

PATCH Applied Thomas Weißschuh 2 participants 2 messages Sep 29, 2023 – Sep 30, 2023 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: core: remove opencoded string_lower()

string_lower from string_helpers.h can be used to modify the string in-place.
Use it to get rid of the custom str_to_lower().

---
 drivers/power/supply/power_supply_sysfs.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/power/supply/power_supply_sysfs.c +3 -9
index d483a81560ab..977611e16373 100644
@@ -15,6 +15,7 @@
 #include <linux/power_supply.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
+#include <linux/string_helpers.h>
 
 #include "power_supply.h"
 
@@ -398,14 +399,6 @@ static const struct attribute_group *power_supply_attr_groups[] = {
 	NULL,
 };
 
-static void str_to_lower(char *str)
-{
-	while (*str) {
-		*str = tolower(*str);
-		str++;
-	}
-}
-
 void power_supply_init_attrs(struct device_type *dev_type)
 {
 	int i;
@@ -420,7 +413,8 @@ void power_supply_init_attrs(struct device_type *dev_type)
 				__func__, i);
 			sprintf(power_supply_attrs[i].attr_name, "_err_%d", i);
 		} else {
-			str_to_lower(power_supply_attrs[i].attr_name);
+			string_lower(power_supply_attrs[i].attr_name,
+				     power_supply_attrs[i].attr_name);
 		}
 
 		attr = &power_supply_attrs[i].dev_attr;

---
base-commit: 71e58659bfc02e4171345f80b13d6485e9cdf687
change-id: 20230929-power_supply-string_lower-3161f977ee62

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
#1 lore raw
Quoted 5 lines · Thomas Weißschuh

string_lower from string_helpers.h can be used to modify the string in-place.
Use it to get rid of the custom str_to_lower().

Applied, thanks!

[1/1] power: supply: core: remove opencoded string_lower()

      commit: 0ce51459c8353b2b18ad3a430dbebf29af8b579c

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>