diff mbox series

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

Message ID 20211001050228.55183-6-takahiro.akashi@linaro.org
State Superseded
Headers show
Series efi_loader: more tightly integrate UEFI disks to device model | expand

Commit Message

AKASHI Takahiro Oct. 1, 2021, 5:01 a.m. UTC
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(+)

-- 
2.33.0

Comments

Simon Glass Oct. 10, 2021, 2:14 p.m. UTC | #1
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?

Regards,
Simon
AKASHI Takahiro Oct. 11, 2021, 1:10 a.m. UTC | #2
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
diff mbox series

Patch

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;
+	}
+
 	return 0;
 }