Skip to content

Commit 64fa3bc

Browse files
andy-shevgregkh
authored andcommitted
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]>
1 parent 625fa77 commit 64fa3bc

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/usb/common/common.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,18 @@ EXPORT_SYMBOL_GPL(usb_speed_string);
107107
*/
108108
enum usb_device_speed usb_get_maximum_speed(struct device *dev)
109109
{
110-
const char *maximum_speed;
110+
const char *p = "maximum-speed";
111111
int ret;
112112

113-
ret = device_property_read_string(dev, "maximum-speed", &maximum_speed);
114-
if (ret < 0)
115-
return USB_SPEED_UNKNOWN;
116-
117-
ret = match_string(ssp_rate, ARRAY_SIZE(ssp_rate), maximum_speed);
113+
ret = device_property_match_property_string(dev, p, ssp_rate, ARRAY_SIZE(ssp_rate));
118114
if (ret > 0)
119115
return USB_SPEED_SUPER_PLUS;
120116

121-
ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed);
122-
return (ret < 0) ? USB_SPEED_UNKNOWN : ret;
117+
ret = device_property_match_property_string(dev, p, speed_names, ARRAY_SIZE(speed_names));
118+
if (ret > 0)
119+
return ret;
120+
121+
return USB_SPEED_UNKNOWN;
123122
}
124123
EXPORT_SYMBOL_GPL(usb_get_maximum_speed);
125124

0 commit comments

Comments
 (0)