Commit f3df0b7533ccad7bb3ef25383fea9c990b0033a2

Authored by Mark Brown
Committed by Samuel Ortiz
1 parent 3446d4bb93

mfd: Use the value of the final spin when reading the AUXADC

Reverse the order of the tests for loop exit so we use a valid value
before we time out.  Vanishingly unlikely to happen since we retry for
several times the expected conversion time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/mfd/wm8350-core.c
... ... @@ -1111,7 +1111,7 @@
1111 1111 do {
1112 1112 schedule_timeout_interruptible(1);
1113 1113 reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
1114   - } while (--tries && (reg & WM8350_AUXADC_POLL));
  1114 + } while ((reg & WM8350_AUXADC_POLL) && --tries);
1115 1115  
1116 1116 if (!tries)
1117 1117 dev_err(wm8350->dev, "adc chn %d read timeout\n", channel);