mmc-uclass: correct the device number
PATCH v4 1/1 mmc-uclass: correct the device number
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().
---
Changes in v4:
- call blk_find_max_devnum() in mmc_get_next_devnum for error return.
Changes in v3:
- apply comments from Jaehoon Chung
Changes in v2:
- add comment for get_mmc_num() in mmc.h
- update mmc_get_next_devnum()
drivers/mmc/mmc-uclass.c | 6 +++--- include/mmc.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/mmc/mmc-uclass.c +3 -3
@@ -111,18 +111,18 @@ 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 ) {int ret; - ret =get_mmc_num (); + ret =blk_find_max_devnum (IF_TYPE_MMC );if (ret <0 )return ret; -return ret +1 ; +return ret; }struct blk_desc *mmc_get_blk_desc (struct mmc *mmc)
include/mmc.h +6 -0
@@ -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 0 if there is no MMC device, else the number of devices +*/ int get_mmc_num (void );int mmc_hwpart_config (struct mmc *mmc,const struct mmc_hwpart_conf *conf,enum mmc_hwpart_conf_mode mode);
Signature · 1 line
1.9.1
PATCH v4 1/1 mmc-uclass: correct the device number
Quoted 12 lines · Kever Yang
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 <[email protected]>---
Changes in v4:
- callblk_find_max_devnum()inmmc_get_next_devnumfor error return.Changes in v3:
- apply comments from Jaehoon Chung
Quoted 7 lines
Changes in v2:
- add comment forget_mmc_num()inmmc.h
- updatemmc_get_next_devnum()drivers/mmc/mmc-uclass.c | 6 +++--- include/mmc.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-)
PATCH v4 1/1 mmc-uclass: correct the device number
Quoted 17 lines · Simon Glass
Quoted 16 lines · Kever Yang
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 <[email protected]>---
Changes in v4:
- callblk_find_max_devnum()inmmc_get_next_devnumfor error return.Changes in v3:
- apply comments from Jaehoon ChungChanges in v2:
- add comment forget_mmc_num()inmmc.h
- updatemmc_get_next_devnum()
Quoted 6 lines
Quoted 3 lines
drivers/mmc/mmc-uclass.c | 6 +++--- include/mmc.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-)Acked-by Simon Glass <[email protected]>
Quoted 2 lines
PATCH v4 1/1 mmc-uclass: correct the device number
Quoted 18 lines · Jaehoon Chung
Quoted 17 lines · Simon Glass
Quoted 16 lines · Kever Yang
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 <[email protected]>---
Changes in v4:
- callblk_find_max_devnum()inmmc_get_next_devnumfor error return.Changes in v3:
- apply comments from Jaehoon ChungChanges in v2:
- add comment forget_mmc_num()inmmc.h
- updatemmc_get_next_devnum()
Quoted 12 lines
Quoted 6 lines
Quoted 3 lines
drivers/mmc/mmc-uclass.c | 6 +++--- include/mmc.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-)Acked-by Simon Glass <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>Quoted 2 lines
Applied to u-boot-rockchip, thanks!