summaryrefslogtreecommitdiff
path: root/drivers/power/supply
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2023-09-29 19:39:00 +0200
committerSebastian Reichel <sebastian.reichel@collabora.com>2023-09-30 21:22:25 +0200
commit0ce51459c8353b2b18ad3a430dbebf29af8b579c (patch)
tree7aa8e347c6bc0368d7ebdd412ae2e455e553efc0 /drivers/power/supply
parent15a4e422f3c9b041261b6810c90ce09d4ebe2a14 (diff)
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(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20230929-power_supply-string_lower-v1-1-3141a2634d53@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply')
-rw-r--r--drivers/power/supply/power_supply_sysfs.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index 06e5b6b0e255..09bf9a094c77 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -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;