Skip to content

Commit 0ce5145

Browse files
t-8chsre
authored andcommitted
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>
1 parent 15a4e42 commit 0ce5145

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

drivers/power/supply/power_supply_sysfs.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/power_supply.h>
1616
#include <linux/slab.h>
1717
#include <linux/stat.h>
18+
#include <linux/string_helpers.h>
1819

1920
#include "power_supply.h"
2021

@@ -398,14 +399,6 @@ static const struct attribute_group *power_supply_attr_groups[] = {
398399
NULL,
399400
};
400401

401-
static void str_to_lower(char *str)
402-
{
403-
while (*str) {
404-
*str = tolower(*str);
405-
str++;
406-
}
407-
}
408-
409402
void power_supply_init_attrs(struct device_type *dev_type)
410403
{
411404
int i;
@@ -420,7 +413,8 @@ void power_supply_init_attrs(struct device_type *dev_type)
420413
__func__, i);
421414
sprintf(power_supply_attrs[i].attr_name, "_err_%d", i);
422415
} else {
423-
str_to_lower(power_supply_attrs[i].attr_name);
416+
string_lower(power_supply_attrs[i].attr_name,
417+
power_supply_attrs[i].attr_name);
424418
}
425419

426420
attr = &power_supply_attrs[i].dev_attr;

0 commit comments

Comments
 (0)