diff options
| author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2025-01-14 21:05:38 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-15 18:28:13 +0100 |
| commit | 5b6dc50e9ed870fffbf2ae6de77b30fb0d15eab8 (patch) | |
| tree | 04f6e6277c0d536821d6f6218ff49c6ca3cd0e87 /drivers/usb/gadget/function/u_serial.c | |
| parent | USB: phy: Use str_enable_disable-like helpers (diff) | |
| download | linux-5b6dc50e9ed870fffbf2ae6de77b30fb0d15eab8.tar.gz linux-5b6dc50e9ed870fffbf2ae6de77b30fb0d15eab8.zip | |
USB: gadget: 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-5-c8405df47c19@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/u_serial.c')
| -rw-r--r-- | drivers/usb/gadget/function/u_serial.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index bc143a86c2dd..5413882b1498 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -21,6 +21,7 @@ #include <linux/tty.h> #include <linux/tty_flip.h> #include <linux/slab.h> +#include <linux/string_choices.h> #include <linux/export.h> #include <linux/module.h> #include <linux/console.h> @@ -1545,7 +1546,7 @@ static int __init userial_init(void) pr_debug("%s: registered %d ttyGS* device%s\n", __func__, MAX_U_SERIAL_PORTS, - (MAX_U_SERIAL_PORTS == 1) ? "" : "s"); + str_plural(MAX_U_SERIAL_PORTS)); return status; fail: |
