diff options
| author | Zhang Zekun <[email protected]> | 2024-08-09 08:27:11 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2024-08-13 08:37:21 +0000 |
| commit | 88177cd4537faf927fe994db99b62d75f73cb1fe (patch) | |
| tree | c05d0d241692d7255d63883abc2f4f04696440f7 /drivers/usb/common/common.c | |
| parent | usb: musb: poll ID pin status in dual-role mode in mpfs glue layer (diff) | |
| download | kernel-88177cd4537faf927fe994db99b62d75f73cb1fe.tar.gz kernel-88177cd4537faf927fe994db99b62d75f73cb1fe.zip | |
usb: common: Use helper function for_each_node_with_property()
for_each_node_with_property() can iterate through the device_node
with a given property name, and we don't need to find the device_node
in the while loop. Since of_device_is_available() will return false if
the "controller" is NULL and break the while loop, there is no functional
change with such conversion.
Signed-off-by: Zhang Zekun <[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.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 59b55d6cf490..84ec00b7966c 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -276,14 +276,13 @@ EXPORT_SYMBOL_GPL(usb_decode_interval); */ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0) { - struct device_node *controller = NULL; + struct device_node *controller; struct of_phandle_args args; const char *dr_mode; int index; int err; - do { - controller = of_find_node_with_property(controller, "phys"); + for_each_node_with_property(controller, "phys") { if (!of_device_is_available(controller)) continue; index = 0; @@ -306,7 +305,7 @@ enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0) goto finish; index++; } while (args.np); - } while (controller); + } finish: err = of_property_read_string(controller, "dr_mode", &dr_mode); |
