[RFC 08/22] dm: blk: add a device-probe hook for scanning disk partitions

Simon Glass sjg at chromium.org
Sun Oct 10 16:14:14 CEST 2021


On Thu, 30 Sept 2021 at 23:03, AKASHI Takahiro
<takahiro.akashi at linaro.org> wrote:
>
> Now that all the block device drivers have enable a probe hook, we will
> call blk_create_partitions() to enumerate all the partitions and create
> associated udevices when a block device is detected.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> ---
>  drivers/block/blk-uclass.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>

Reviewed-by: Simon Glass <sjg at chromium.org>

But I don't see blk_create_partitions() in this patch.

> diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> index dd7f3c0fe31e..6ba11a8fa7f7 100644
> --- a/drivers/block/blk-uclass.c
> +++ b/drivers/block/blk-uclass.c
> @@ -741,11 +741,25 @@ static int blk_post_probe(struct udevice *dev)
>                 struct blk_desc *desc = dev_get_uclass_plat(dev);
>
>                 part_init(desc);
> +
> +               if (desc->part_type != PART_TYPE_UNKNOWN &&
> +                   blk_create_partitions(dev))
> +                       debug("*** creating partitions failed\n");
>         }
>
>         return 0;
>  }
>
> +static int blk_part_post_probe(struct udevice *dev)
> +{
> +       /*
> +        * TODO:
> +        * If we call blk_creat_partitions() here, it would allow for
> +        * "partitions in a partition".
> +        */

Would that be useful?


> +       return 0;
> +}
> +
>  UCLASS_DRIVER(blk) = {
>         .id             = UCLASS_BLK,
>         .name           = "blk",
> @@ -821,6 +835,7 @@ U_BOOT_DRIVER(blk_partition) = {
>
>  UCLASS_DRIVER(partition) = {
>         .id             = UCLASS_PARTITION,
> +       .post_probe     = blk_part_post_probe,
>         .per_device_plat_auto   = sizeof(struct disk_part),
>         .name           = "partition",
>  };
> --
> 2.33.0
>


More information about the U-Boot mailing list