diff options
| author | Krzysztof Kozlowski <[email protected]> | 2025-01-14 20:05:34 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-01-15 17:28:12 +0000 |
| commit | bd693544854b025765514e8948469c618000993a (patch) | |
| tree | a2e13c33f99245c1ee5e6b3659813f3789ee7c50 /drivers/usb/core/generic.c | |
| parent | Merge tag 'thunderbolt-for-v6.14-rc1' of ssh://gitolite.kernel.org/pub/scm/li... (diff) | |
| download | kernel-bd693544854b025765514e8948469c618000993a.tar.gz kernel-bd693544854b025765514e8948469c618000993a.zip | |
USB: Replace own str_plural with common one
Use existing str_plural() helper from string_choices.h to reduce amount
of duplicated code.
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/generic.c')
| -rw-r--r-- | drivers/usb/core/generic.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index b134bff5c3fe..9c6ae5e1198b 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c @@ -21,14 +21,10 @@ #include <linux/usb.h> #include <linux/usb/hcd.h> +#include <linux/string_choices.h> #include <uapi/linux/usb/audio.h> #include "usb.h" -static inline const char *plural(int n) -{ - return (n == 1 ? "" : "s"); -} - static int is_rndis(struct usb_interface_descriptor *desc) { return desc->bInterfaceClass == USB_CLASS_COMM @@ -194,18 +190,18 @@ int usb_choose_configuration(struct usb_device *udev) if (insufficient_power > 0) dev_info(&udev->dev, "rejected %d configuration%s " "due to insufficient available bus power\n", - insufficient_power, plural(insufficient_power)); + insufficient_power, str_plural(insufficient_power)); if (best) { i = best->desc.bConfigurationValue; dev_dbg(&udev->dev, "configuration #%d chosen from %d choice%s\n", - i, num_configs, plural(num_configs)); + i, num_configs, str_plural(num_configs)); } else { i = -1; dev_warn(&udev->dev, "no configuration chosen from %d choice%s\n", - num_configs, plural(num_configs)); + num_configs, str_plural(num_configs)); } return i; } |
