diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2025-01-14 23:05:39 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-15 20:28:13 +0300 |
commit | f386bfad038d07fc356df267592f5fd812c8cf3e (patch) | |
tree | 8a3210bf4c1fe4e3d193633c3f8f613894057aa4 /drivers/usb/common/usb-conn-gpio.c | |
parent | 5b6dc50e9ed870fffbf2ae6de77b30fb0d15eab8 (diff) | |
download | linux-f386bfad038d07fc356df267592f5fd812c8cf3e.tar.xz |
USB: 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/20250114-str-enable-disable-usb-v1-6-c8405df47c19@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/common/usb-conn-gpio.c')
-rw-r--r-- | drivers/usb/common/usb-conn-gpio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c index c84b4a700084..aa710b50791b 100644 --- a/drivers/usb/common/usb-conn-gpio.c +++ b/drivers/usb/common/usb-conn-gpio.c @@ -19,6 +19,7 @@ #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/regulator/consumer.h> +#include <linux/string_choices.h> #include <linux/usb/role.h> #define USB_GPIO_DEB_MS 20 /* ms */ @@ -111,7 +112,7 @@ static void usb_conn_detect_cable(struct work_struct *work) if (info->vbus) dev_dbg(info->dev, "vbus regulator is %s\n", - regulator_is_enabled(info->vbus) ? "enabled" : "disabled"); + str_enabled_disabled(regulator_is_enabled(info->vbus))); power_supply_changed(info->charger); } |