mmc: core: skip card initialization if power class selection fails
Subsystems (2)
PATCH v2 1/1 mmc: core: skip card initialization if power class selection fails
With current implementation of power class selection, mmc_select_powerclass() should never fail. So treat any error returned by this function as serious enough to skip the card initialization.
--- drivers/mmc/core/mmc.c | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-)
drivers/mmc/core/mmc.c +15 -11
@@ -722,6 +722,18 @@ static int mmc_select_powerclass(struct mmc_card *card, card->ext_csd.generic_cmd6_time); } +if (err) { +int width =4 ; +int ddr = (bus_width <=EXT_CSD_BUS_WIDTH_8 ) ?0 :1 ; + +if ((bus_width ==EXT_CSD_BUS_WIDTH_8 ) || + (bus_width ==EXT_CSD_DDR_BUS_WIDTH_8 )) + width =8 ; + +pr_err ("%s: power class selection to bus width %d ddr %d" +" failed\n" ,mmc_hostname (card->host), width, ddr); + } +return err; }
@@ -1115,9 +1127,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, EXT_CSD_BUS_WIDTH_8 :EXT_CSD_BUS_WIDTH_4 ; err =mmc_select_powerclass (card, ext_csd_bits, ext_csd);if (err) -pr_warning ("%s: power class selection to bus width %d" -" failed\n" ,mmc_hostname (card->host), -1 << bus_width); + goto err; }/*
@@ -1149,10 +1159,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err =mmc_select_powerclass (card, ext_csd_bits[idx][0 ], ext_csd);if (err) -pr_warning ("%s: power class selection to " -"bus width %d failed\n" , -mmc_hostname (card->host), -1 << bus_width); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,
@@ -1180,10 +1187,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err =mmc_select_powerclass (card, ext_csd_bits[idx][1 ], ext_csd);if (err) -pr_warning ("%s: power class selection to " -"bus width %d ddr %d failed\n" , -mmc_hostname (card->host), -1 << bus_width, ddr); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,
Signature · 5 lines
1.7.1.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 58 lines · Subhash Jadavani
With current implementation of power class selection,
mmc_select_powerclass()should never fail. So treat any error returned by this function as serious enough to skip the card initialization.Signed-off-by Subhash Jadavani <[email protected]>---
drivers/mmc/core/mmc.c | 26 +++++++++++++++-----------1 files changed, 15 insertions(+), 11 deletions(-)drivers/mmc/core/mmc.c +14
-7@@ -722,6 +722,18 @@ static int mmc_select_powerclass(struct mmc_card *card, card->ext_csd.generic_cmd6_time); } + if (err) { + int width = 4; + int ddr = (bus_width <= EXT_CSD_BUS_WIDTH_8) ? 0 : 1; + + if ((bus_width == EXT_CSD_BUS_WIDTH_8) || + (bus_width == EXT_CSD_DDR_BUS_WIDTH_8)) + width = 8; + + pr_err("%s: power class selection to bus width %d ddr %d" + " failed\n", mmc_hostname(card->host), width, ddr); + } + return err; }@@ -1115,9 +1127,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); if (err) - pr_warning("%s: power class selection to bus width %d" - " failed\n", mmc_hostname(card->host), - 1 << bus_width); + goto err; } /*@@ -1149,10 +1159,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][0], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d failed\n", - mmc_hostname(card->host), - 1 << bus_width); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,@@ -1180,10 +1187,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][1],
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host, u32 ocr, · line 1193
Quoted 10 lines
drivers/mmc/core/mmc.c +1
-4ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d ddr %d failed\n", - mmc_hostname(card->host), - 1 << bus_width, ddr); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,
Looks Good
Acked By: Girish K S <[email protected]>
Quoted 10 lines
--
1.7.1.1--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi. Subhash.
Have you considered return -EINVAL in switch ?
And looks complex more.. how about getting bus_width and ddr value from argument ?
Thanks.
2012/4/11 Subhash Jadavani <[email protected]>:
Quoted 78 lines
With current implementation of power class selection,
mmc_select_powerclass()should never fail. So treat any error returned by this function as serious enough to skip the card initialization.Signed-off-by Subhash Jadavani <[email protected]>---
drivers/mmc/core/mmc.c | 26 +++++++++++++++-----------1 files changed, 15 insertions(+), 11 deletions(-)drivers/mmc/core/mmc.c +15
-12@@ -722,6 +722,18 @@ static int mmc_select_powerclass(struct mmc_card *card, card->ext_csd.generic_cmd6_time); } + if (err) { + int width = 4; + int ddr = (bus_width <= EXT_CSD_BUS_WIDTH_8) ? 0 : 1; + + if ((bus_width == EXT_CSD_BUS_WIDTH_8) || + (bus_width == EXT_CSD_DDR_BUS_WIDTH_8)) + width = 8; + + pr_err("%s: power class selection to bus width %d ddr %d" + " failed\n", mmc_hostname(card->host), width, ddr); + } + return err; }@@ -1115,9 +1127,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); if (err) - pr_warning("%s: power class selection to bus width %d" - " failed\n", mmc_hostname(card->host), - 1 << bus_width); + goto err; } /*@@ -1149,10 +1159,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][0], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d failed\n", - mmc_hostname(card->host), - 1 << bus_width); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,@@ -1180,10 +1187,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][1], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d ddr %d failed\n", - mmc_hostname(card->host), - 1 << bus_width, ddr); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, --1.7.1.1
--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Namjae Jeon
Hi. Subhash.
Have you considered return-EINVALin switch ?
That is case which should never enter.
Quoted 2 lines
And looks complex more.. how about getting
bus_widthand ddr value from argument ?
bus_width is already a argument of mmc_select_powerclass.
Quoted 81 lines
Thanks.
2012/4/11 Subhash Jadavani <[email protected]>:Quoted 78 lines
With current implementation of power class selection,
mmc_select_powerclass()should never fail. So treat any error returned by this function as serious enough to skip the card initialization.Signed-off-by Subhash Jadavani <[email protected]>---
drivers/mmc/core/mmc.c | 26 +++++++++++++++-----------1 files changed, 15 insertions(+), 11 deletions(-)drivers/mmc/core/mmc.c +15
-12@@ -722,6 +722,18 @@ static int mmc_select_powerclass(struct mmc_card *card, card->ext_csd.generic_cmd6_time); } + if (err) { + int width = 4; + int ddr = (bus_width <= EXT_CSD_BUS_WIDTH_8) ? 0 : 1; + + if ((bus_width == EXT_CSD_BUS_WIDTH_8) || + (bus_width == EXT_CSD_DDR_BUS_WIDTH_8)) + width = 8; + + pr_err("%s: power class selection to bus width %d ddr %d" + " failed\n", mmc_hostname(card->host), width, ddr); + } + return err; }@@ -1115,9 +1127,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); if (err) - pr_warning("%s: power class selection to bus width %d" - " failed\n", mmc_hostname(card->host), - 1 << bus_width); + goto err; } /*@@ -1149,10 +1159,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][0], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d failed\n", - mmc_hostname(card->host), - 1 << bus_width); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,@@ -1180,10 +1187,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][1], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d ddr %d failed\n", - mmc_hostname(card->host), - 1 << bus_width, ddr); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, --1.7.1.1
--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
2012/4/12 Girish K S <[email protected]>:
Quoted 2 lines · Namjae Jeon
Quoted 1 line
Hi. Subhash.
Hi.
Quoted 2 lines
Quoted 1 line
Have you considered return
-EINVALin switch ?That is case which should never enter.
Would you explain more why entering never in case?
Quoted 3 lines
Quoted 2 lines
And looks complex more.. how about getting
bus_widthand ddr value from argument ?
bus_widthis already a argument ofmmc_select_powerclass.
bus_width I point is width for printk.
Thanks.
Quoted 81 lines
Quoted 81 lines
Thanks.
2012/4/11 Subhash Jadavani <[email protected]>:Quoted 78 lines
With current implementation of power class selection,
mmc_select_powerclass()should never fail. So treat any error returned by this function as serious enough to skip the card initialization.Signed-off-by Subhash Jadavani <[email protected]>---
drivers/mmc/core/mmc.c | 26 +++++++++++++++-----------1 files changed, 15 insertions(+), 11 deletions(-)drivers/mmc/core/mmc.c +15
-12@@ -722,6 +722,18 @@ static int mmc_select_powerclass(struct mmc_card *card, card->ext_csd.generic_cmd6_time); } + if (err) { + int width = 4; + int ddr = (bus_width <= EXT_CSD_BUS_WIDTH_8) ? 0 : 1; + + if ((bus_width == EXT_CSD_BUS_WIDTH_8) || + (bus_width == EXT_CSD_DDR_BUS_WIDTH_8)) + width = 8; + + pr_err("%s: power class selection to bus width %d ddr %d" + " failed\n", mmc_hostname(card->host), width, ddr); + } + return err; }@@ -1115,9 +1127,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); if (err) - pr_warning("%s: power class selection to bus width %d" - " failed\n", mmc_hostname(card->host), - 1 << bus_width); + goto err; } /*@@ -1149,10 +1159,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][0], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d failed\n", - mmc_hostname(card->host), - 1 << bus_width); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH,@@ -1180,10 +1187,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_powerclass(card, ext_csd_bits[idx][1], ext_csd); if (err) - pr_warning("%s: power class selection to " - "bus width %d ddr %d failed\n", - mmc_hostname(card->host), - 1 << bus_width, ddr); + goto err; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, --1.7.1.1
--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html