History log of /linux-master/drivers/power/supply/test_power.c
Revision Date Author Comments
# 3639dbd7 22-Dec-2022 Xu Panda <xu.panda@zte.com.cn>

power: supply: test-power: use strscpy() instead of strncpy()

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>


# 411643e9 04-Oct-2020 Harley A.W. Lorenzo <hl1998@protonmail.com>

power: supply: test-power: revise parameter printing to use sprintf

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>


# c07fa6c1 04-Sep-2020 Xiongfeng Wang <wangxiongfeng2@huawei.com>

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>


# c365ee56 29-Jul-2020 LH Lin <lh.lin@mediatek.com>

power: supply: test_power: Fix battery_current initial value

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>


# 1c79031f 19-Apr-2020 Leon Romanovsky <leon@kernel.org>

drivers: Remove inclusion of vermagic header

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>


# 69318b39 12-Sep-2019 lecopzer@gmail.com <lecopzer@gmail.com>

test_power: Add CURRENT properties

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>


# 4b082ac6 12-Sep-2019 lecopzer@gmail.com <lecopzer@gmail.com>

test_power: Add CHARGE_COUNTER properties

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>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

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>


# 8c0984e5 17-Jun-2016 Sebastian Reichel <sre@kernel.org>

power: move power supply drivers to power/supply

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>