Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4097066imu; Mon, 10 Dec 2018 13:05:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/VwS2qQk5V1jrBwjM76nwSMapb9+bA+eFAHVSMSQv+7M8pKw1nVmkKEkfg0esCF6JHMq0FL X-Received: by 2002:a17:902:930b:: with SMTP id bc11mr13952988plb.17.1544475937153; Mon, 10 Dec 2018 13:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544475937; cv=none; d=google.com; s=arc-20160816; b=VQ3Mhe5oWdyaJZxNhHBW8MRoM/ikwAriDBbm8m2aqVvLDrh/ArQzZ5WlsZJunifE9P hSLcM5sImWVfm2VXEdC5vN3NF/4js4YaR/Ht3Fz9mrIWM2Bd1TMn+rx4e4tC/S+ZSLMW enqz8ZMcwfynXbkOwUoyhVQ7Ft20c6X9L6HY8p2HWKELGEBSPAxosxLthWSx40rk01iH WbSPri9yndxp6x0jxy/bekIJZQYrywtLvoFRHpvkqD+erPsKkWF75BBKEYoFOr6FGtrO 1lr17nD5UNUhuul6le4qJi0BelhMDVRsjKBFb9alg1DjuQAHceREqWJLG0BFC5oGJ4qJ Bv4w== 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=628QJf39Te/B1UDyOhkG5OxUL1zF0ayxH/pScy+UCdc=; b=w/DjnGFxy5SHVkSkT5eR/y2TYiYvTkila12Aj1cDqwZ09UGTdQEKXwFv4UhmaS8ssd t640bRzhEt3ZgaRRansE4PMbcNSI+AIhoTBUZuNW5pVcWQYAZ9l+Q+cpTpkz2gMS/SiM DAsT6Nkxq/XJoAcJ8910Ey1+VyNURhSPZA01xGeh9kn46FLGhsunWwEasBTiWdOw6Q7H Rw4nYRWPuJ+fmhsf4zqTvS8jBURrdAm4WebirhBgzepg7EOzrsyqGgQX9wb8Noh93fkE +VZEmd4i3HNZwZUS7PNhn99qhmkEoBcsL62kQP2mENKbJuqsUR0U/uLYaiCEJnXQ3ruQ p64A== 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 a34si10358792pgm.427.2018.12.10.13.05.19; Mon, 10 Dec 2018 13:05:37 -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 S1729976AbeLJVDX (ORCPT + 99 others); Mon, 10 Dec 2018 16:03:23 -0500 Received: from sauhun.de ([88.99.104.3]:36738 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729927AbeLJVDU (ORCPT ); Mon, 10 Dec 2018 16:03:20 -0500 Received: from localhost (p54B335CF.dip0.t-ipconnect.de [84.179.53.207]) by pokefinder.org (Postfix) with ESMTPSA id 222B34C3C79; Mon, 10 Dec 2018 22:03:18 +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 , Orson Zhai , Baolin Wang , Chunyan Zhang , linux-kernel@vger.kernel.org Subject: [RFC/RFT 07/10] i2c: sprd: use core helper to mark adapter suspended Date: Mon, 10 Dec 2018 22:03:05 +0100 Message-Id: <20181210210310.12677-8-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 Rejecting transfers should be handled by the core. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-sprd.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c index e266d8a713d9..acbaf5fd29ee 100644 --- a/drivers/i2c/busses/i2c-sprd.c +++ b/drivers/i2c/busses/i2c-sprd.c @@ -86,7 +86,6 @@ struct sprd_i2c { u32 count; int irq; int err; - bool is_suspended; }; static void sprd_i2c_set_count(struct sprd_i2c *i2c_dev, u32 count) @@ -284,9 +283,6 @@ static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct sprd_i2c *i2c_dev = i2c_adap->algo_data; int im, ret; - if (i2c_dev->is_suspended) - return -EBUSY; - ret = pm_runtime_get_sync(i2c_dev->dev); if (ret < 0) return ret; @@ -590,10 +586,7 @@ static int __maybe_unused sprd_i2c_suspend_noirq(struct device *dev) { struct sprd_i2c *i2c_dev = dev_get_drvdata(dev); - i2c_lock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER); - i2c_dev->is_suspended = true; - i2c_unlock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER); - + i2c_mark_adapter_suspended(&i2c_dev->adap, true); return pm_runtime_force_suspend(dev); } @@ -601,10 +594,7 @@ static int __maybe_unused sprd_i2c_resume_noirq(struct device *dev) { struct sprd_i2c *i2c_dev = dev_get_drvdata(dev); - i2c_lock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER); - i2c_dev->is_suspended = false; - i2c_unlock_bus(&i2c_dev->adap, I2C_LOCK_ROOT_ADAPTER); - + i2c_mark_adapter_suspended(&i2c_dev->adap, false); return pm_runtime_force_resume(dev); } -- 2.11.0