mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
power: supply: test_power: add missing newlines when printing parameters by sysfs
When I cat some module parameters by sysfs, it displays as follows. It's better to add a newline for easy reading. root@syzkaller:~# cd /sys/module/test_power/parameters/ root@syzkaller:/sys/module/test_power/parameters# cat ac_online onroot@syzkaller:/sys/module/test_power/parameters# cat battery_present trueroot@syzkaller:/sys/module/test_power/parameters# cat battery_health goodroot@syzkaller:/sys/module/test_power/parameters# cat battery_status dischargingroot@syzkaller:/sys/module/test_power/parameters# cat battery_technology LIONroot@syzkaller:/sys/module/test_power/parameters# cat usb_online onroot@syzkaller:/sys/module/test_power/parameters# Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
f87d092fe4
commit
c07fa6c163
1 changed files with 6 additions and 0 deletions
|
@ -353,6 +353,7 @@ static int param_set_ac_online(const char *key, const struct kernel_param *kp)
|
||||||
static int param_get_ac_online(char *buffer, const struct kernel_param *kp)
|
static int param_get_ac_online(char *buffer, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
strcpy(buffer, map_get_key(map_ac_online, ac_online, "unknown"));
|
strcpy(buffer, map_get_key(map_ac_online, ac_online, "unknown"));
|
||||||
|
strcat(buffer, "\n");
|
||||||
return strlen(buffer);
|
return strlen(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +367,7 @@ static int param_set_usb_online(const char *key, const struct kernel_param *kp)
|
||||||
static int param_get_usb_online(char *buffer, const struct kernel_param *kp)
|
static int param_get_usb_online(char *buffer, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
strcpy(buffer, map_get_key(map_ac_online, usb_online, "unknown"));
|
strcpy(buffer, map_get_key(map_ac_online, usb_online, "unknown"));
|
||||||
|
strcat(buffer, "\n");
|
||||||
return strlen(buffer);
|
return strlen(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,6 +382,7 @@ static int param_set_battery_status(const char *key,
|
||||||
static int param_get_battery_status(char *buffer, const struct kernel_param *kp)
|
static int param_get_battery_status(char *buffer, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
strcpy(buffer, map_get_key(map_status, battery_status, "unknown"));
|
strcpy(buffer, map_get_key(map_status, battery_status, "unknown"));
|
||||||
|
strcat(buffer, "\n");
|
||||||
return strlen(buffer);
|
return strlen(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +397,7 @@ static int param_set_battery_health(const char *key,
|
||||||
static int param_get_battery_health(char *buffer, const struct kernel_param *kp)
|
static int param_get_battery_health(char *buffer, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
strcpy(buffer, map_get_key(map_health, battery_health, "unknown"));
|
strcpy(buffer, map_get_key(map_health, battery_health, "unknown"));
|
||||||
|
strcat(buffer, "\n");
|
||||||
return strlen(buffer);
|
return strlen(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,6 +413,7 @@ static int param_get_battery_present(char *buffer,
|
||||||
const struct kernel_param *kp)
|
const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
strcpy(buffer, map_get_key(map_present, battery_present, "unknown"));
|
strcpy(buffer, map_get_key(map_present, battery_present, "unknown"));
|
||||||
|
strcat(buffer, "\n");
|
||||||
return strlen(buffer);
|
return strlen(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +431,7 @@ static int param_get_battery_technology(char *buffer,
|
||||||
{
|
{
|
||||||
strcpy(buffer,
|
strcpy(buffer,
|
||||||
map_get_key(map_technology, battery_technology, "unknown"));
|
map_get_key(map_technology, battery_technology, "unknown"));
|
||||||
|
strcat(buffer, "\n");
|
||||||
return strlen(buffer);
|
return strlen(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue