[PATCH 3/3] efi: Drop unnecessary calls to blk_find_device()

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Jan 25 05:20:58 CET 2022


On 1/22/22 02:16, Simon Glass wrote:
> When we have the block descriptor we can simply access the device. Drop
> the unnecessary function call.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>   lib/efi_loader/efi_device_path.c | 14 ++------------
>   1 file changed, 2 insertions(+), 12 deletions(-)
>
> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
> index a838a32b810..f415741d528 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -768,13 +768,8 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
>   static unsigned dp_part_size(struct blk_desc *desc, int part)
>   {
>   	unsigned dpsize;
> -	struct udevice *dev;
> -	int ret;
> +	struct udevice *dev = desc->bdev;

drivers/block/blk_legacy.c still exists but it does not set bdev.
CONFIG_EFI_LOADER does not require CONFIG_BLK.

Are all non-DM block devices eliminated by now?

Best regards

Heinrich

>
> -	ret = blk_find_device(desc->if_type, desc->devnum, &dev);
> -
> -	if (ret)
> -		dev = desc->bdev->parent;
>   	dpsize = dp_size(dev);
>
>   	if (part == 0) /* the actual disk, not a partition */
> @@ -865,13 +860,8 @@ static void *dp_part_node(void *buf, struct blk_desc *desc, int part)
>    */
>   static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
>   {
> -	struct udevice *dev;
> -	int ret;
> -
> -	ret = blk_find_device(desc->if_type, desc->devnum, &dev);
> +	struct udevice *dev = desc->bdev;
>
> -	if (ret)
> -		dev = desc->bdev->parent;
>   	buf = dp_fill(buf, dev);
>
>   	if (part == 0) /* the actual disk, not a partition */



More information about the U-Boot mailing list