diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2025-01-14 21:36:11 +0100 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2025-01-15 21:41:22 +0100 |
commit | 2d678e3e1e1564780562614ebb099a1e8cbd025f (patch) | |
tree | ebfd8870769d51679a1308eb1ad3673e4dbb8dac /drivers/power/supply/da9030_battery.c | |
parent | platform/x86: dell-laptop: Use power_supply_charge_types_show/_parse() helpers (diff) | |
download | linux-2d678e3e1e1564780562614ebb099a1e8cbd025f.tar.xz linux-2d678e3e1e1564780562614ebb099a1e8cbd025f.zip |
power: supply: Use str_enable_disable-like helpers
Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:
1. Simple function call with one argument is easier to read. Ternary
operator has three arguments and with wrapping might lead to quite
long code.
2. Is slightly shorter thus also easier to read.
3. It brings uniformity in the text - same string.
4. Allows deduping by the linker, which results in a smaller binary
file.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250114203611.1013324-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/da9030_battery.c')
-rw-r--r-- | drivers/power/supply/da9030_battery.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/power/supply/da9030_battery.c b/drivers/power/supply/da9030_battery.c index 34328f5d556e..ac2e319e9517 100644 --- a/drivers/power/supply/da9030_battery.c +++ b/drivers/power/supply/da9030_battery.c @@ -15,6 +15,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/power_supply.h> +#include <linux/string_choices.h> #include <linux/mfd/da903x.h> #include <linux/debugfs.h> @@ -138,7 +139,7 @@ static int bat_debug_show(struct seq_file *s, void *data) { struct da9030_charger *charger = s->private; - seq_printf(s, "charger is %s\n", charger->is_on ? "on" : "off"); + seq_printf(s, "charger is %s\n", str_on_off(charger->is_on)); if (charger->chdet) { seq_printf(s, "iset = %dmA, vset = %dmV\n", charger->mA, charger->mV); |