* [U-Boot] [PATCH v2] mmc-uclass: correct the device number @ 2016-07-19 9:28 ` Kever Yang 2016-07-19 10:01 ` Jaehoon Chung 0 siblings, 1 reply; 2+ messages in thread From: Kever Yang @ 2016-07-19 9:28 UTC (permalink / raw) To: u-boot Not like the mmc-legacy which the devnum starts from 1, it starts from 0 in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num(). Signed-off-by: Kever Yang <kever.yang@rock-chips.com> --- Changes in v2: - add comment for get_mmc_num() in mmc.h - update mmc_get_next_devnum() drivers/mmc/mmc-uclass.c | 4 ++-- include/mmc.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 38ced41..d0ca91b 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -111,7 +111,7 @@ struct mmc *find_mmc_device(int dev_num) int get_mmc_num(void) { - return max(blk_find_max_devnum(IF_TYPE_MMC), 0); + return max((blk_find_max_devnum(IF_TYPE_MMC) + 1), 0); } int mmc_get_next_devnum(void) @@ -122,7 +122,7 @@ int mmc_get_next_devnum(void) if (ret < 0) return ret; - return ret + 1; + return ret; } struct blk_desc *mmc_get_blk_desc(struct mmc *mmc) diff --git a/include/mmc.h b/include/mmc.h index 8f309f1..4288e59 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -503,6 +503,12 @@ void mmc_set_clock(struct mmc *mmc, uint clock); struct mmc *find_mmc_device(int dev_num); int mmc_set_dev(int dev_num); void print_mmc_devices(char separator); + +/** + * get_mmc_num() - get the total MMC device number + * + * @return number of MMC device + */ int get_mmc_num(void); int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf, enum mmc_hwpart_conf_mode mode); -- 1.9.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH v2] mmc-uclass: correct the device number 2016-07-19 9:28 ` [U-Boot] [PATCH v2] mmc-uclass: correct the device number Kever Yang @ 2016-07-19 10:01 ` Jaehoon Chung 0 siblings, 0 replies; 2+ messages in thread From: Jaehoon Chung @ 2016-07-19 10:01 UTC (permalink / raw) To: u-boot On 07/19/2016 06:28 PM, Kever Yang wrote: > Not like the mmc-legacy which the devnum starts from 1, it starts from 0 > in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num(). > > Signed-off-by: Kever Yang <kever.yang@rock-chips.com> > --- > > Changes in v2: > - add comment for get_mmc_num() in mmc.h > - update mmc_get_next_devnum() > > drivers/mmc/mmc-uclass.c | 4 ++-- > include/mmc.h | 6 ++++++ > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c > index 38ced41..d0ca91b 100644 > --- a/drivers/mmc/mmc-uclass.c > +++ b/drivers/mmc/mmc-uclass.c > @@ -111,7 +111,7 @@ struct mmc *find_mmc_device(int dev_num) > > int get_mmc_num(void) > { > - return max(blk_find_max_devnum(IF_TYPE_MMC), 0); > + return max((blk_find_max_devnum(IF_TYPE_MMC) + 1), 0); > } > > int mmc_get_next_devnum(void) > @@ -122,7 +122,7 @@ int mmc_get_next_devnum(void) > if (ret < 0) > return ret; > > - return ret + 1; > + return ret; > } > > struct blk_desc *mmc_get_blk_desc(struct mmc *mmc) > diff --git a/include/mmc.h b/include/mmc.h > index 8f309f1..4288e59 100644 > --- a/include/mmc.h > +++ b/include/mmc.h > @@ -503,6 +503,12 @@ void mmc_set_clock(struct mmc *mmc, uint clock); > struct mmc *find_mmc_device(int dev_num); > int mmc_set_dev(int dev_num); > void print_mmc_devices(char separator); > + > +/** > + * get_mmc_num() - get the total MMC device number > + * > + * @return number of MMC device > + */ If you add the comment for get_mmc_num(), i think you need to mention that it has what means when return 0. @return 0 if there is no MMC device, else the number of devices. Best Regards, Jaehoon Chung > int get_mmc_num(void); > int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf, > enum mmc_hwpart_conf_mode mode); > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-19 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20160719093035epcas1p3c8cf6a4cd433f217f8b204a74a540e87@epcas1p3.samsung.com>
2016-07-19 9:28 ` [U-Boot] [PATCH v2] mmc-uclass: correct the device number Kever Yang
2016-07-19 10:01 ` Jaehoon Chung
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox