From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-path: Received: from bhuna.collabora.co.uk ([46.235.227.227]:34549 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752751AbdF2MoA (ORCPT ); Thu, 29 Jun 2017 08:44:00 -0400 From: Sebastian Reichel To: Sebastian Reichel , Support Opensource , Lee Jones , Rob Herring , Mark Rutland , Jean Delvare , Guenter Roeck , Dmitry Torokhov Cc: devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel Subject: [PATCHv3 1/4] mfd: da9052: fix manual ADC read after timed out read Date: Thu, 29 Jun 2017 14:43:43 +0200 Message-Id: <20170629124346.22325-2-sebastian.reichel@collabora.co.uk> In-Reply-To: <20170629124346.22325-1-sebastian.reichel@collabora.co.uk> References: <20170629124346.22325-1-sebastian.reichel@collabora.co.uk> Sender: linux-hwmon-owner@vger.kernel.org List-Id: linux-hwmon@vger.kernel.org It is possible that under heavy system load, the counter in the completion struct, used for waiting for end of AD conversion, gets incremented twice. To make sure the driver recovers from this situation, the completion struct should be reinitialized. Signed-off-by: Sebastian Reichel --- drivers/mfd/da9052-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index a88c2065d8ab..977418ca9117 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c @@ -386,6 +386,8 @@ int da9052_adc_manual_read(struct da9052 *da9052, unsigned char channel) mutex_lock(&da9052->auxadc_lock); + reinit_completion(&da9052->done); + /* Channel gets activated on enabling the Conversion bit */ mux_sel = chan_mux[channel] | DA9052_ADC_MAN_MAN_CONV; -- 2.11.0