Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3811545pxf; Mon, 29 Mar 2021 12:07:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbeNeaKjiYYS40QTLdz67A7x/U2UxHjctL6a52ll9yJpKTwSnYG5EXwep064erYvjXfVfh X-Received: by 2002:a17:906:3b48:: with SMTP id h8mr29631773ejf.261.1617044867713; Mon, 29 Mar 2021 12:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617044867; cv=none; d=google.com; s=arc-20160816; b=zwJSM+zZu970tLNggPJ2jKYcf6B7h5oF04/FPpbvrlo2w880o4dU59haINKLBii33I vrSWXCVm8dpvSiNslPjgMBtyGuKWO6EYIeCkJ6W/9S0uXCG0HJYS90+KU7pteHI5JbLP ainBoyhLVfJV20x/0L32z/FHb5H5WS7iN+0Jvu0syPg+xoBa2coXtvFSRBBTD0Kd1zHC AoMiMFd8DPgksdQ1lPX9X7CG02cHRcUPKlRWPSvIYtDkca62ORjJo/QYFCWXlqO8lCPE B0L6gB66tnrIsyxAPcParEq4/d9oN4QKCLnK47vQHpIb93NwUmU4dOjeXLhKME4M6nYv th0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aKWS0aU8jyoXVgDBn/hCQzo9I1d/OWR4aJoN4goeeos=; b=BdcwffHlW7DOe8Em5rDBvmk/+fAjY5ba+QRBlRtOyEpDi9mw0WPqXegmaBkuURO+CT l9fJyh90wCPj6QYLVYIp0/3c/nC99E0/KLioX+FEGVwMLUhd9KuvKtnW9FfOu6trawY+ N8YZEc5XroSLSRqmPITS0ef//uxKEk1+yO2JYunzjFhqfJdx3vN0XKAuyt4FIwQLF+oG LG6LsSkPlfUf/b/7MGiM/4C1m2Hj/C7RoN8/DevAVICPs23i8dSyFH+Q94eZQ3QGorWP 8+ZkD9R/gdIaG9XKv55/tDZIgQNpZl3s3jUniYSdEA2jZhadIfsqwvYGm3YfNtaUYqZb k1rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Oa4FP0Sk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si15106553edq.209.2021.03.29.12.07.25; Mon, 29 Mar 2021 12:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Oa4FP0Sk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231660AbhC2TG0 (ORCPT + 99 others); Mon, 29 Mar 2021 15:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbhC2TGO (ORCPT ); Mon, 29 Mar 2021 15:06:14 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25B9CC061574; Mon, 29 Mar 2021 12:06:14 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id s17so17137289ljc.5; Mon, 29 Mar 2021 12:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aKWS0aU8jyoXVgDBn/hCQzo9I1d/OWR4aJoN4goeeos=; b=Oa4FP0SkefTa6Se+tHek4r1Tw7YP/bZXJtm+tUdMjsEONH7j2675FgEABAHnpht99t L47fRuaCue2u7tQvT7rAFZQj/SFzq+nHirWGZxFhB1gdFykuEfM45mjgIFNFJaUc5pDE f8UcmCJAUS5fWwIuClsm70MQb7ZWP7DYMI3Mg+cWuuBummVx4b76pruYaPi3EEmzXL0W NgeXpo9rQEap3xj73HZRR3qCyrUQ0NRECse8GJwuccgZZtTGolcItFA3pnT8m84qd6Pi MskaIwfwBlXZTir+z5prJav1gEGI1wTTuilfZHkcmqfrFossleuIu04SVGtSP64ZAPXR pDAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aKWS0aU8jyoXVgDBn/hCQzo9I1d/OWR4aJoN4goeeos=; b=rdjhZyStjScPmdFBaUr/gfdtmXy9o/rFpzDAj9ouoblDQCeoQTDsSUbFbE2AOtm1vl Va936QWlH7f1DQbRhPB1V+HhNIDALhZrpFhMjp4b9l8PTisEcmRKMjKMO8SdWeSVurP6 HdHqmUxiSo1r+6YTi5csoMjMRcGgrENuM2RBMCmuxJgiW0cuk7BjWUS1OZUCrkkopvr4 vxN7nR0hkAXwY3nmbSKWm/JWQtJoarpneINlKp7Nl2hEqtZgQXTh7TdZTpwsa5cNm8E9 kkXPW2ByXq0Hn7nvxzcIJ1RDXLOHzs9qgmwOTlPsNom86dhXS4XBP48AUn2656H5+Xn+ mKWg== X-Gm-Message-State: AOAM532I69a9mdwQtpcwqcqIVtw/7D/RVwvhIEIzDJgGJhjA9VDRO+YQ J55WdYrS8p6v8OP1EC7ZrNo= X-Received: by 2002:a05:651c:212a:: with SMTP id a42mr18299065ljq.505.1617044772740; Mon, 29 Mar 2021 12:06:12 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:814d:b259:a10:76ff:fe69:21b6]) by smtp.gmail.com with ESMTPSA id o139sm1923041lfa.129.2021.03.29.12.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 12:06:12 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Laxman Dewangan , Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] i2c: tegra: Improve handling of i2c_recover_bus() Date: Mon, 29 Mar 2021 22:05:46 +0300 Message-Id: <20210329190546.24869-1-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The i2c_recover_bus() returns -EOPNOTSUPP if bus recovery isn't wired up, which the case for older Tegra SoCs at the moment. This error code is then propagated to I2C client and might be confusing, thus return -EIO instead. Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index c883044715f3..cb5e3cc96160 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1196,8 +1196,14 @@ static int tegra_i2c_error_recover(struct tegra_i2c_dev *i2c_dev, /* start recovery upon arbitration loss in single master mode */ if (i2c_dev->msg_err == I2C_ERR_ARBITRATION_LOST) { - if (!i2c_dev->multimaster_mode) - return i2c_recover_bus(&i2c_dev->adapter); + if (!i2c_dev->multimaster_mode) { + int err = i2c_recover_bus(&i2c_dev->adapter); + + if (err == -EOPNOTSUPP) + return -EIO; + + return err; + } return -EAGAIN; } -- 2.30.2