aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/common/common.c
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2024-09-03 18:31:36 +0000
committerGreg Kroah-Hartman <[email protected]>2024-09-11 13:34:34 +0000
commit64fa3bc36d3cf6b58f9981d9c5d353777de7952e (patch)
tree8104df324c1a136710c537204a13f2528e257634 /drivers/usb/common/common.c
parentUSB: usbtmc: prevent kernel-usb-infoleak (diff)
downloadkernel-64fa3bc36d3cf6b58f9981d9c5d353777de7952e.tar.gz
kernel-64fa3bc36d3cf6b58f9981d9c5d353777de7952e.zip
usb: common: Switch to device_property_match_property_string()
Replace open coded device_property_match_property_string(). Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/common/common.c')
-rw-r--r--drivers/usb/common/common.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 84ec00b7966c..b7bea1015d7c 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -107,19 +107,18 @@ EXPORT_SYMBOL_GPL(usb_speed_string);
*/
enum usb_device_speed usb_get_maximum_speed(struct device *dev)
{
- const char *maximum_speed;
+ const char *p = "maximum-speed";
int ret;
- ret = device_property_read_string(dev, "maximum-speed", &maximum_speed);
- if (ret < 0)
- return USB_SPEED_UNKNOWN;
-
- ret = match_string(ssp_rate, ARRAY_SIZE(ssp_rate), maximum_speed);
+ ret = device_property_match_property_string(dev, p, ssp_rate, ARRAY_SIZE(ssp_rate));
if (ret > 0)
return USB_SPEED_SUPER_PLUS;
- ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed);
- return (ret < 0) ? USB_SPEED_UNKNOWN : ret;
+ ret = device_property_match_property_string(dev, p, speed_names, ARRAY_SIZE(speed_names));
+ if (ret > 0)
+ return ret;
+
+ return USB_SPEED_UNKNOWN;
}
EXPORT_SYMBOL_GPL(usb_get_maximum_speed);