On Mon, 06 Feb 2023, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > On Sat, Feb 04, 2023 at 09:30:34PM +0800, Pin-yen Lin wrote: >> Add helpers to register and unregister Type-C "switches" for bridges >> capable of switching their output between two downstream devices. >> >> The helper registers USB Type-C mode switches when the "mode-switch" >> and the "reg" properties are available in Device Tree. > > ... > >> + fwnode_for_each_child_node(port, sw) { >> + if (fwnode_property_present(sw, "mode-switch")) > > This idiom is being used at least twice (in this code, haven't checked the rest > of the patches, though), perhaps > > #define fwnode_for_each_typec_mode_switch(port, sw) \ > fwnode_for_each_child_node(port, sw) \ > if (!fwnode_property_present(sw, "mode-switch")) {} else > > ? See for_each_if() in drm_util.h. BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center