From patchwork Sat Jun 30 17:08:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10498341 X-Patchwork-Delegate: geert@linux-m68k.org 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 6B6C160230 for ; Sat, 30 Jun 2018 17:08:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5288228F10 for ; Sat, 30 Jun 2018 17:08:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46E8428F41; Sat, 30 Jun 2018 17:08:22 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 EA5AF28F10 for ; Sat, 30 Jun 2018 17:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751280AbeF3RIV (ORCPT ); Sat, 30 Jun 2018 13:08:21 -0400 Received: from sauhun.de ([88.99.104.3]:56714 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751189AbeF3RIU (ORCPT ); Sat, 30 Jun 2018 13:08:20 -0400 Received: from localhost (p54B334D6.dip0.t-ipconnect.de [84.179.52.214]) by pokefinder.org (Postfix) with ESMTPSA id 3CBBE5601C5; Sat, 30 Jun 2018 19:08:19 +0200 (CEST) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Wolfram Sang Subject: [PATCH] i2c: recovery: directly exit when SCL is stuck low Date: Sat, 30 Jun 2018 19:08:13 +0200 Message-Id: <20180630170813.13194-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If SCL is stuck low, the bus cannot be recovered. No need to check SDA or futilely trying to send a STOP. Just exit. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-core-base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index bfefeb2ab2fd..cbbfe3fd387b 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -189,7 +189,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) dev_err(&adap->dev, "SCL is stuck low, exit recovery\n"); ret = -EBUSY; - break; + goto exit_unprepare; } /* Break if SDA is high */ if (bri->get_sda && bri->get_sda(adap)) @@ -227,6 +227,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) ndelay(RECOVERY_NDELAY / 2); } + exit_unprepare: if (bri->unprepare_recovery) bri->unprepare_recovery(adap);