Message ID | 1398712412-15503-7-git-send-email-m.zalega@samsung.com |
---|---|
State | Accepted |
Delegated to: | Marek Vasut |
Headers | show |
On 04/28/2014 01:13 PM, Mateusz Zalega wrote: > In cases when MMC hadn't been initialized before, ie. by the user or other > subsystem, it was still uninitialized while UMS media capacity check, > leading to broken ums command. > > UMS has to initialize resources it uses. It's probably better to just switch from find_mmc_device() to get_device(), which does the initialization internally. patch "ums: use get_device() not find_mmc_device()" does this. http://patchwork.ozlabs.org/patch/344328/ That said, at this point, it's probably simplest to just apply this series, and I'll rebase my series on top of this in a day or two.
Hi Mateusz, > In cases when MMC hadn't been initialized before, ie. by the user or > other subsystem, it was still uninitialized while UMS media capacity > check, leading to broken ums command. > > UMS has to initialize resources it uses. > > Tested on Samsung Goni. > > Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> > Tested-by: Mateusz Zalega <m.zalega@samsung.com> > Acked-by: Lukasz Majewski <l.majewski@samsung.com> > Cc: Minkyu Kang <mk7.kang@samsung.com> Applied to u-boot-dfu. THanks, > --- > Changes since v3: > - Added const attribute of ums_disk_init introduced type warnings. It > would take a lot of changes to MMC core code to fix it, so it was > dropped, even though ums_disk_init shouldn't and doesn't change > struct mmc it is passed. Changes since v4: > - added slightly more detailed commit message > --- > board/samsung/common/ums.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c > index dc155ad..cebabe9 100644 > --- a/board/samsung/common/ums.c > +++ b/board/samsung/common/ums.c > @@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc) > > struct ums *ums_init(unsigned int dev_num) > { > - struct mmc *mmc = NULL; > + struct mmc *mmc = find_mmc_device(dev_num); > > - mmc = find_mmc_device(dev_num); > - if (!mmc) > + if (!mmc || mmc_init(mmc)) > return NULL; > - > return ums_disk_init(mmc); > }
diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c index dc155ad..cebabe9 100644 --- a/board/samsung/common/ums.c +++ b/board/samsung/common/ums.c @@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc) struct ums *ums_init(unsigned int dev_num) { - struct mmc *mmc = NULL; + struct mmc *mmc = find_mmc_device(dev_num); - mmc = find_mmc_device(dev_num); - if (!mmc) + if (!mmc || mmc_init(mmc)) return NULL; - return ums_disk_init(mmc); }