Message ID | 20211001050228.55183-17-takahiro.akashi@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | None | expand |
On Thu, 30 Sept 2021 at 23:03, AKASHI Takahiro <takahiro.akashi@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@linaro.org> > --- > drivers/block/blk-uclass.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > Reviewed-by: Simon Glass <sjg@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 >
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". + */ + 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", };
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@linaro.org> --- drivers/block/blk-uclass.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.33.0