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

Andy Shevchenko andriy.shevchenko at linux.intel.com
Mon Feb 6 12:08:34 UTC 2023


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




More information about the dri-devel mailing list