Re: [RFC 03/22] mmc: call device_probe() after scanning

AKASHI Takahiro
2021-10-11T01:10:49Z

On Sun, Oct 10, 2021 at 08:14:09AM -0600, Simon Glass wrote:
> Hi Takahiro,
>
> On Thu, 30 Sept 2021 at 23:03, AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > Every time a mmc bus/port is scanned and a new device is detected,
> > we want to call device_probe() as it will give us a chance to run additional
> > post-processings for some purposes.
> >
> > In particular, support for creating partitions on a device will be added.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> > drivers/mmc/mmc-uclass.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> > index 3ee92d03ca23..07b5c1736439 100644
> > --- a/drivers/mmc/mmc-uclass.c
> > +++ b/drivers/mmc/mmc-uclass.c
> > @@ -418,6 +418,13 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
> > bdesc->part_type = cfg->part_type;
> > mmc->dev = dev;
> > mmc->user_speed_mode = MMC_MODES_END;
> > +
> > + ret = device_probe(dev);
> > + if (ret) {
> > + device_unbind(dev);
> > + return ret;
> > + }
>
> We cannot probe a device within a bind() method. Can this be moved to
> mmc_blk_probe(), perhaps?

Ok, I will fix it.

Thanks,
-Takahiro Akashi

> Regards,
> Simon