Re: [RFC 06/10] i2c: fwnode: add fwnode_find_i2c_adapter_by_node()

Andy Shevchenko
2022-02-21T18:12:32Z

On Mon, Feb 21, 2022 at 05:26:48PM +0100, Clément Léger wrote:
> Add fwnode_find_i2c_adapter_by_node() which allows to retrieve a i2c
> adapter using a fwnode. Since dev_fwnode() uses the fwnode provided by
> the of_node member of the device, this will also work for devices were
> the of_node has been set and not the fwnode field.

...

> +static int fwnode_dev_or_parent_node_match(struct device *dev, const void *data)
> +{

> + if (dev_fwnode(dev) == data)
> + return 1;

This can use corresponding match function from bus.h.

> + if (dev->parent)
> + return dev_fwnode(dev->parent) == data;
> +
> + return 0;

The same.

> +}

--
With Best Regards,
Andy Shevchenko