usb: common: Switch to device_property_match_property_string()

JIRA: https://issues.redhat.com/browse/RHEL-59052

commit 64fa3bc36d3cf6b58f9981d9c5d353777de7952e
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Tue, 3 Sep 2024 21:31:36 +0300

  Replace open coded device_property_match_property_string().

  Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  Link: https://lore.kernel.org/r/20240903183136.3641770-1-andriy.shevchenko@linux.intel.com
  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
This commit is contained in:
Desnes Nunes 2024-11-28 16:53:50 -03:00
parent 36e35a0ce0
commit 1d2fb0bf33
1 changed files with 7 additions and 8 deletions

View File

@ -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);