* [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails
@ 2012-04-09 13:00 Subhash Jadavani
2012-04-09 14:35 ` Namjae Jeon
0 siblings, 1 reply; 5+ messages in thread
From: Subhash Jadavani @ 2012-04-09 13:00 UTC (permalink / raw)
To: linux-mmc; +Cc: saugata.das, 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 <subhashj@codeaurora.org>
---
drivers/mmc/core/mmc.c | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 54df5ad..d5ff192 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1116,10 +1116,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
ext_csd_bits = (bus_width == MMC_BUS_WIDTH_8) ?
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);
+ if (err) {
+ pr_err("%s: power class selection to bus width %d"
+ " failed\n", mmc_hostname(card->host),
+ 1 << bus_width);
+ goto err;
+ }
}
/*
@@ -1150,11 +1152,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
ddr = 0; /* no DDR for 1-bit width */
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);
+ if (err) {
+ pr_err("%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,
@@ -1181,11 +1185,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
if (!err && ddr) {
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);
+ if (err) {
+ pr_err("%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.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails
2012-04-09 13:00 [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails Subhash Jadavani
@ 2012-04-09 14:35 ` Namjae Jeon
2012-04-10 14:15 ` Chris Ball
0 siblings, 1 reply; 5+ messages in thread
From: Namjae Jeon @ 2012-04-09 14:35 UTC (permalink / raw)
To: Subhash Jadavani; +Cc: linux-mmc, saugata.das
Hi Subhash.
There are duplicate printks in three places. Is there no way to avoid
duplicate printks ?
Thanks.
2012/4/9 Subhash Jadavani <subhashj@codeaurora.org>:
> 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 <subhashj@codeaurora.org>
> ---
> drivers/mmc/core/mmc.c | 34 ++++++++++++++++++++--------------
> 1 files changed, 20 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 54df5ad..d5ff192 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1116,10 +1116,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> ext_csd_bits = (bus_width == MMC_BUS_WIDTH_8) ?
> 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);
> + if (err) {
> + pr_err("%s: power class selection to bus width %d"
> + " failed\n", mmc_hostname(card->host),
> + 1 << bus_width);
> + goto err;
> + }
> }
>
> /*
> @@ -1150,11 +1152,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> ddr = 0; /* no DDR for 1-bit width */
> 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);
> + if (err) {
> + pr_err("%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,
> @@ -1181,11 +1185,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> if (!err && ddr) {
> 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);
> + if (err) {
> + pr_err("%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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails
2012-04-09 14:35 ` Namjae Jeon
@ 2012-04-10 14:15 ` Chris Ball
2012-04-10 17:56 ` Subhash Jadavani
2012-04-11 9:12 ` Namjae Jeon
0 siblings, 2 replies; 5+ messages in thread
From: Chris Ball @ 2012-04-10 14:15 UTC (permalink / raw)
To: Namjae Jeon; +Cc: Subhash Jadavani, linux-mmc, saugata.das
Hi,
On Mon, Apr 09 2012, Namjae Jeon wrote:
> Hi Subhash.
> There are duplicate printks in three places. Is there no way to avoid
> duplicate printks ?
The printk can go just before the final "return err" in
mmc_select_powerclass().
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails
2012-04-10 14:15 ` Chris Ball
@ 2012-04-10 17:56 ` Subhash Jadavani
2012-04-11 9:12 ` Namjae Jeon
1 sibling, 0 replies; 5+ messages in thread
From: Subhash Jadavani @ 2012-04-10 17:56 UTC (permalink / raw)
To: 'Chris Ball', 'Namjae Jeon'; +Cc: linux-mmc, saugata.das
> -----Original Message-----
> From: Chris Ball [mailto:cjb@laptop.org]
> Sent: Tuesday, April 10, 2012 7:46 PM
> To: Namjae Jeon
> Cc: Subhash Jadavani; linux-mmc@vger.kernel.org; saugata.das@linaro.org
> Subject: Re: [PATCH v1 1/1] mmc: core: skip card initialization if power
class
> selection fails
>
> Hi,
>
> On Mon, Apr 09 2012, Namjae Jeon wrote:
> > Hi Subhash.
> > There are duplicate printks in three places. Is there no way to avoid
> > duplicate printks ?
>
> The printk can go just before the final "return err" in
mmc_select_powerclass().
Yes. will fix it and post another patch.
Thanks,
Subhash
>
> Thanks,
>
> - Chris.
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
> One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails
2012-04-10 14:15 ` Chris Ball
2012-04-10 17:56 ` Subhash Jadavani
@ 2012-04-11 9:12 ` Namjae Jeon
1 sibling, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2012-04-11 9:12 UTC (permalink / raw)
To: Chris Ball; +Cc: Subhash Jadavani, linux-mmc, saugata.das
Hi. Chris.
You're right~ we can optmize code properly by moving printk to
mmc_select_powerclass.
Thanks for your reply.
2012/4/10 Chris Ball <cjb@laptop.org>:
> Hi,
>
> On Mon, Apr 09 2012, Namjae Jeon wrote:
>> Hi Subhash.
>> There are duplicate printks in three places. Is there no way to avoid
>> duplicate printks ?
>
> The printk can go just before the final "return err" in
> mmc_select_powerclass().
>
> Thanks,
>
> - Chris.
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
> One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-11 9:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-09 13:00 [PATCH v1 1/1] mmc: core: skip card initialization if power class selection fails Subhash Jadavani
2012-04-09 14:35 ` Namjae Jeon
2012-04-10 14:15 ` Chris Ball
2012-04-10 17:56 ` Subhash Jadavani
2012-04-11 9:12 ` Namjae Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox