Re: [PATCH v11 3/9] drm/display: Add Type-C switch helpers

From: Andy Shevchenko
Date: Mon Feb 06 2023 - 07:09:53 EST


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

?

--
With Best Regards,
Andy Shevchenko