[PATCH v6 03/12] dm: core: Add a helper to retrieve devices through graph endpoints

Miquel Raynal miquel.raynal at bootlin.com
Thu Apr 3 10:08:14 CEST 2025


> +int uclass_get_device_by_endpoint(enum uclass_id class_id, struct udevice *dev,
> +				  int port_idx, int ep_idx, struct udevice **devp)
> +{
> +	ofnode node_source = dev_ofnode(dev);
> +	ofnode node_dest = ofnode_graph_get_remote_node(node_source, port_idx, ep_idx);
> +	struct udevice *target = NULL;
> +	int ret;
> +
> +	if (!ofnode_valid(node_dest))
> +		return -EINVAL;
> +
> +	ret = uclass_find_device_by_ofnode(class_id, node_dest, &target);
> +	if (ret)
> +		return -ENODEV;
> +
> +	return uclass_get_device_tail(target, 0, devp);

Please disregard this version, I forgot to update this helper. Going
through another validation now...

Sorry for the noise,
Miquèl


More information about the U-Boot mailing list