From f3df0b7533ccad7bb3ef25383fea9c990b0033a2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 1 Mar 2009 20:11:58 +0100 Subject: [PATCH] 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 Signed-off-by: Samuel Ortiz --- drivers/mfd/wm8350-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index a285cc0cc70..c2be3088e2e 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c @@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref) do { schedule_timeout_interruptible(1); reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); - } while (--tries && (reg & WM8350_AUXADC_POLL)); + } while ((reg & WM8350_AUXADC_POLL) && --tries); if (!tries) dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); -- 2.41.0