From: Charles Keepax Date: Mon, 23 Sep 2013 13:33:58 +0000 (+0100) Subject: extcon: arizona: Correct typo in headphone detect range transitions X-Git-Tag: firefly_0821_release~176^2~5060^2~46^2~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4ba1a9ff5955df443a0ed6c956501f796a18abfa;p=firefly-linux-kernel-4.4.55.git extcon: arizona: Correct typo in headphone detect range transitions We should move range when the measured value is greater than or equal to the max value not when greater than. Signed-off-by: Charles Keepax Signed-off-by: Chanwoo Choi --- diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 2064eac1b92b..1878415bd1ae 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -388,7 +388,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info) >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT; if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 && - (val < 100 || val > 0x3fb)) { + (val < 100 || val >= 0x3fb)) { range++; dev_dbg(arizona->dev, "Moving to HPDET range %d\n", range); @@ -401,7 +401,7 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info) } /* If we go out of range report top of range */ - if (val < 100 || val > 0x3fb) { + if (val < 100 || val >= 0x3fb) { dev_dbg(arizona->dev, "Measurement out of range\n"); return ARIZONA_HPDET_MAX; }