[PATCH v3 07/10] common: add initial barebox deep-probe support

Sascha Hauer s.hauer at pengutronix.de
Thu Oct 22 03:23:29 EDT 2020


Hi Marco,

Looks mostly good, only a few things, mostly nitpicks, left.

> +int of_device_ensure_probed_by_alias(const char *alias)
> +{
> +	struct device_node *dev_node;
> +
> +	dev_node = of_find_node_by_alias(NULL, alias);
> +	if (!dev_node)
> +		return -EINVAL;
> +
> +	return of_device_ensure_probed(dev_node);
> +}
> +EXPORT_SYMBOL_GPL(of_device_ensure_probed_by_alias);
> +
> +/**
> + * of_devices_ensure_probed_by_dev_id() - ensures that a devices are probed

s/a//

> + *
> + * @np: the start point device_node handle
> + * @ids: the matching 'struct of_device_id' ids
> + *
> + * The function start searching the device tree from @np and populates and
> + * probes devices which matches @ids.

s/matches/match/

> + *
> + * Return: %0 on success
> + *	   %-ENODEV if either the device wasn't found, can't be populated,
> + *	     the driver is missing or the driver probe returns an error
> + */
> +int of_devices_ensure_probed_by_dev_id(struct device_node *np,
> +				       const struct of_device_id *ids)
> +{
> +	struct device_node *child;
> +
> +	if (of_match_node(ids, np))
> +		return of_device_ensure_probed(np);
> +
> +	for_each_child_of_node(np, child) {
> +		int ret;
> +
> +		ret = of_devices_ensure_probed_by_dev_id(child, ids);
> +		if (!ret)
> +			return 0;
> +	}
> +
> +	return -ENODEV;
> +}
> +EXPORT_SYMBOL_GPL(of_devices_ensure_probed_by_dev_id);

I think you want to use for_each_matching_node() here which iterates
over the tree without recursion.

> +
> +/**
> + * of_devices_ensure_probed_by_property() - ensures that a devices are probed

s/a//

> + *
> + * @property_name: The property name to search for
> + *
> + * The function start searching the whole device tree and populates and probe

s/probe/probes/

> + * devices which matches @property_name.

s/matches/match/

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list