diff options
| author | Krzysztof Kozlowski <[email protected]> | 2025-01-14 20:05:39 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-01-15 17:28:13 +0000 |
| commit | f386bfad038d07fc356df267592f5fd812c8cf3e (patch) | |
| tree | 8a3210bf4c1fe4e3d193633c3f8f613894057aa4 /drivers/usb/core/port.c | |
| parent | USB: gadget: Use str_enable_disable-like helpers (diff) | |
| download | kernel-f386bfad038d07fc356df267592f5fd812c8cf3e.tar.gz kernel-f386bfad038d07fc356df267592f5fd812c8cf3e.zip | |
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/core/port.c')
| -rw-r--r-- | drivers/usb/core/port.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index e857e532b35a..f54198171b6a 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -9,6 +9,7 @@ #include <linux/kstrtox.h> #include <linux/slab.h> +#include <linux/string_choices.h> #include <linux/sysfs.h> #include <linux/pm_qos.h> #include <linux/component.h> @@ -25,7 +26,7 @@ static ssize_t early_stop_show(struct device *dev, { struct usb_port *port_dev = to_usb_port(dev); - return sysfs_emit(buf, "%s\n", port_dev->early_stop ? "yes" : "no"); + return sysfs_emit(buf, "%s\n", str_yes_no(port_dev->early_stop)); } static ssize_t early_stop_store(struct device *dev, struct device_attribute *attr, |
