[PATCH 2/3] efi: Use device_get_uclass_id() where appropriate

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Jan 25 05:06:59 CET 2022


On 1/22/22 02:16, Simon Glass wrote:
> Use this function rather than following the pointers, since it is there
> for this purpose.
>
> Add the uclass name to the debug call at the end of dp_fill() since it is
> quite useful.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>   lib/efi_loader/efi_device_path.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
> index c61f4859330..a838a32b810 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -494,7 +494,7 @@ __maybe_unused static unsigned int dp_size(struct udevice *dev)
>   	if (!dev || !dev->driver)
>   		return sizeof(ROOT);
>
> -	switch (dev->driver->id) {
> +	switch (device_get_uclass_id(dev)) {
>   	case UCLASS_ROOT:
>   	case UCLASS_SIMPLE_BUS:
>   		/* stop traversing parents at this point: */
> @@ -579,7 +579,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
>   	if (!dev || !dev->driver)
>   		return buf;
>
> -	switch (dev->driver->id) {
> +	switch (device_get_uclass_id(dev)) {
>   	case UCLASS_ROOT:
>   	case UCLASS_SIMPLE_BUS: {
>   		/* stop traversing parents at this point: */
> @@ -759,9 +759,8 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
>   		return &udp[1];
>   	}
>   	default:
> -		debug("%s(%u) %s: unhandled device class: %s (%u)\n",
> -		      __FILE__, __LINE__, __func__,
> -		      dev->name, dev->driver->id);
> +		log_debug("unhandled device class: %s (%u:%s)\n", dev->name,
> +			  device_get_uclass_id(dev), dev_get_uclass_name(dev));

The uclass id is hidden in enum uclass_id. I can't grep for it. The
uclass name seems enough.

Best regards

Heinrich

>   		return dp_fill(buf, dev->parent);
>   	}
>   }



More information about the U-Boot mailing list