On 12/15/2011 2:03 PM, amit kachhap wrote: > On Thu, Dec 15, 2011 at 9:28 AM, Girish K S > <girish.shivananjappa@xxxxxxxxxx> wrote: >> This patch adds a check whether the host supports maximum current value >> obtained from the device's extended csd register for a selected interface >> voltage and frequency. >> >> cc: Chris Ball <cjb@xxxxxxxxxx> >> Signed-off-by: Girish K S <girish.shivananjappa@xxxxxxxxxx> >> --- >> Changes in v2: >> deleted a unnecessary if else condition identified by subhash J >> Changes in v1: >> reduced the number of comparisons as per Hein's suggestion >> >> drivers/mmc/core/mmc.c | 19 +++++++++++++++++++ >> include/linux/mmc/card.h | 4 ++++ >> 2 files changed, 23 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c >> index 006e932..b9ef777 100644 >> --- a/drivers/mmc/core/mmc.c >> +++ b/drivers/mmc/core/mmc.c >> @@ -688,6 +688,25 @@ static int mmc_select_powerclass(struct mmc_card *card, >> pwrclass_val = (pwrclass_val & EXT_CSD_PWR_CL_4BIT_MASK) >> >> EXT_CSD_PWR_CL_4BIT_SHIFT; >> >> + if (pwrclass_val >= MMC_MAX_CURRENT_800) > Hi girish, > > These checks can be made like , > if (pwrclass_val > MMC_MAX_CURRENT_800) > pwrclass_val = MMC_MAX_CURRENT_800; > Applicable in all below conditional checks. Hi both, Suppose pwrclass_val == MMC_MAX_CURRENT_800 (13), then with + if (pwrclass_val > MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val > MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; it would get a value of MMC_MAX_CURRENT_600, which is too low Hein -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html