summaryrefslogtreecommitdiff
path: root/drivers/power/supply/test_power.c
AgeCommit message (Collapse)Author
2023-02-03power: supply: test-power: use strscpy() instead of strncpy()Xu Panda
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-10-09power: supply: test-power: revise parameter printing to use sprintfHarley A.W. Lorenzo
Simplify code by using sprintf instead of strcpy+strcat+strlen. Signed-off-by: Harley A.W. Lorenzo <hl1998@protonmail.com> Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-10-03power: supply: test_power: add missing newlines when printing parameters by ↵Xiongfeng Wang
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>
2020-07-29power: supply: test_power: Fix battery_current initial valueLH Lin
Since default battery_status is POWER_SUPPLY_STATUS_DISCHARGING, we should change default battery_current to a negative value. Signed-off-by: LH Lin <lh.lin@mediatek.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-04-21drivers: Remove inclusion of vermagic headerLeon Romanovsky
Get rid of linux/vermagic.h includes, so that MODULE_ARCH_VERMAGIC from the arch header arch/x86/include/asm/module.h won't be redefined. In file included from ./include/linux/module.h:30, from drivers/net/ethernet/3com/3c515.c:56: ./arch/x86/include/asm/module.h:73: warning: "MODULE_ARCH_VERMAGIC" redefined 73 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY | In file included from drivers/net/ethernet/3com/3c515.c:25: ./include/linux/vermagic.h:28: note: this is the location of the previous definition 28 | #define MODULE_ARCH_VERMAGIC "" | Fixes: 6bba2e89a88c ("net/3com: Delete driver and module versions from 3com drivers") Co-developed-by: Borislav Petkov <bp@suse.de> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Shannon Nelson <snelson@pensando.io> # ionic Acked-by: Sebastian Reichel <sre@kernel.org> # power Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-10-10test_power: Add CURRENT propertieslecopzer@gmail.com
CURRENT is really general in other battery drivers, Android also has an interface to monitor CURRENT, so let's add it into test framework. The default value (1.6A) is just a random but reasonable value. Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-10-10test_power: Add CHARGE_COUNTER propertieslecopzer@gmail.com
CHARGE_COUNTER is really general in other power supply drivers and Android also has an interface to monitor CHARGE_COUNTER, so let's add it into test framework. Set default as -1000 is because the default status is POWER_SUPPLY_STATUS_DISCHARGING, which means the counter should be negative, and 1000 means not zero but small enough. Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-11power: move power supply drivers to power/supplySebastian Reichel
This moves all power supply drivers from drivers/power/ to drivers/power/supply/. The intention is a cleaner source tree, since drivers/power/ also contains frameworks unrelated to power supply, like adaptive voltage scaling. Signed-off-by: Sebastian Reichel <sre@kernel.org>