From patchwork Tue Jun 27 14:38:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 9811925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0FB76603D7 for ; Tue, 27 Jun 2017 14:39:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01DC7286AB for ; Tue, 27 Jun 2017 14:39:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9268286B2; Tue, 27 Jun 2017 14:39:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F867286AB for ; Tue, 27 Jun 2017 14:39:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752409AbdF0OjY (ORCPT ); Tue, 27 Jun 2017 10:39:24 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58219 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbdF0OjO (ORCPT ); Tue, 27 Jun 2017 10:39:14 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 23DC326BDF9 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: [PATCHv2 1/3] mfd: da9052: fix manual ADC read after timed out read Date: Tue, 27 Jun 2017 16:38:57 +0200 Message-Id: <20170627143859.21312-2-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170627143859.21312-1-sebastian.reichel@collabora.co.uk> References: <20170627143859.21312-1-sebastian.reichel@collabora.co.uk> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;