Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4099015imu; Mon, 10 Dec 2018 13:07:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/WQgG7kQm8vpUaniXnVjdM2H+SHYNZO1uD+TU7GU12bqI9c/MyIiljJ0/DW27sX2MuVMFH1 X-Received: by 2002:a17:902:8e8a:: with SMTP id bg10mr13610819plb.192.1544476050675; Mon, 10 Dec 2018 13:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544476050; cv=none; d=google.com; s=arc-20160816; b=cuyZ+n4PlwPQmjWZVMmpozZzK0ycw9DKv9MnRrc7pvawjbguxauoFUhhidKH/qBJa7 B+3HXyv5sH+7Y/1pD8HX4cGiFOjNWrBMTnku3yKqSNFmzgd/F/BSsPoAFOlZpOHU1LbY 9Tz6DHdyk9SEAJSvWEkTjfJiNg7KaKDddqhbEEreHvKkH5LLQ/Yr0qVNaNR8wi93If2n mA31t865mNmMYSCS2I4cGLqxsNAcHedOKjVe8yaRXAGB9gHs0VFvNy1GYBox2gNOrHJa VXkNIDPIxmXgNS/YC/AFI68UUpcnutFdFdZ/wGi2lo8bfCo1uxU8nbQHXgA2uYwIexB0 O4ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4rT3lUYN40QX2Fu+0pzB97GpzWy4C2ttYb/744qZbs8=; b=wC5k5Ib5Ytj2mfp48n98W766xnR2EtlQiWuDLaPVUxfTCLb+L8h8m+yeSIFSZgkG3P UFrb5rBq3JgtRk8ysa1Ka/UGHI0xkhuqAKDc+KP+uJgPJmDTJY6TTcupMqX//xTlSXce oCoqKCincIKeb8p3qBd77iO6iRfM/4rIusDaxeeeqBP2YnkVgXCoyYChY6gu7wgYvF65 4IgAe/Uflu7kqI660ysE8GT0vPxpOlmxQ0dy2pZ26GQW1D9RQ4PWTi+FH68IcT0wGRxB VuQPnbNHs4feazwbEYZoW9XvzLt1LbykCY3UsxeyOVvIktqb5XlMeYkvEqHz+YEIob/R 7Nyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si11010079pla.299.2018.12.10.13.07.15; Mon, 10 Dec 2018 13:07:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730081AbeLJVE3 (ORCPT + 99 others); Mon, 10 Dec 2018 16:04:29 -0500 Received: from sauhun.de ([88.99.104.3]:36688 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728001AbeLJVDQ (ORCPT ); Mon, 10 Dec 2018 16:03:16 -0500 Received: from localhost (p54B335CF.dip0.t-ipconnect.de [84.179.53.207]) by pokefinder.org (Postfix) with ESMTPSA id 783184C3C66; Mon, 10 Dec 2018 22:03:14 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Hans de Goede , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Wolfram Sang , Wolfram Sang , linux-kernel@vger.kernel.org Subject: [RFC/RFT 02/10] i2c: reject new transfers when adapters are suspended Date: Mon, 10 Dec 2018 22:03:00 +0100 Message-Id: <20181210210310.12677-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181210210310.12677-1-wsa+renesas@sang-engineering.com> References: <20181210210310.12677-1-wsa+renesas@sang-engineering.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using the new 'is_suspended' flag, we now reject new transfers if the adapter is already marked suspended. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-core-base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 9f89e258c8ff..5b2078a902f8 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -1866,6 +1866,8 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) if (WARN_ON(!msgs || num < 1)) return -EINVAL; + if (WARN_ON(adap->is_suspended)) + return -ESHUTDOWN; if (adap->quirks && i2c_check_for_quirks(adap, msgs, num)) return -EOPNOTSUPP; -- 2.11.0