Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4098098imu; Mon, 10 Dec 2018 13:06:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/VzCn6moknAM9JHuhtYF8bYEkHC8iSHAb2XDd+sff169Q8hqTa8aQYkCmozIal5pC7bgho8 X-Received: by 2002:a65:4142:: with SMTP id x2mr11929845pgp.356.1544475996195; Mon, 10 Dec 2018 13:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544475996; cv=none; d=google.com; s=arc-20160816; b=nSGf+5kF7i8T8v/n4g5YSAt6UNTJ/2NZmqMpLjfGI/yScGT/f9gZMRvw4hMBr3gSiz rQB79UiASHUQcI1nQAlRsVMyj9gR64onzlIYc5GPPcmiyQSe6j1+6mWgCT04UnTQnoMF XCTf9awwYRqjvheqLqQLoOQXPNZG9p/E7AoiVjQDxvZoMU5/Lr3Arkd+ZjMwGp34d2Em v6uv0KA7tRSMr5tQnw/+WLlm/ZD1mQmWuG6zTNqAYeKZWSPebshb1tlj/i1F3n3exwAt gGEn9SxwCaNsqprU613L+76+vl01r6vXS7VfyL6J7XIkDvPsq4RXhPdprxD/r2Dc5H1P cISw== 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=5nP14Rs2ILyXrFqI7+wA1+/YhUfMQVDZDkO9NSlh8Y8=; b=urXTfVJYOyfKeNvoQdBibMR3EiSpRuhmeXk6iCbIQr9sNI5MS2pvJW+4IrBYab6OOp 7K3RI1+BUIHdNbJyBdNNHCGdQl1mb0E9Ih972U57edZSop+KQzRecMxzYvOqjq/3KlDl Xm8U3zadH5mC8HYErZXyxwSgcJMwtveFTAfYV5MAfX6cQIpj18jtFmB/ggiA/v+Kri98 HgZJCbwTMei2OoPEP2FkzJ7WrvcXRcJuQ8FHypgArkExnWLFrpgoQvTLqaI0Shl0ac0n CfRU7/AjVro1TfmRb0gIKfXONSnJSghX65nTIt0VGe8AVaW79CgoiCTTkCuX0mD7oAvG stQw== 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 p16si10971588pff.272.2018.12.10.13.06.20; Mon, 10 Dec 2018 13:06:36 -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 S1730047AbeLJVEE (ORCPT + 99 others); Mon, 10 Dec 2018 16:04:04 -0500 Received: from sauhun.de ([88.99.104.3]:36710 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729910AbeLJVDS (ORCPT ); Mon, 10 Dec 2018 16:03:18 -0500 Received: from localhost (p54B335CF.dip0.t-ipconnect.de [84.179.53.207]) by pokefinder.org (Postfix) with ESMTPSA id E8F174C3C6E; Mon, 10 Dec 2018 22:03:15 +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 , Kamal Dasu , Brian Norris , Gregory Fong , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org Subject: [RFC/RFT 04/10] i2c: brcmstb: use core helper to mark adapter suspended Date: Mon, 10 Dec 2018 22:03:02 +0100 Message-Id: <20181210210310.12677-5-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-brcmstb.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c index 826d32049996..05c822e5a3f6 100644 --- a/drivers/i2c/busses/i2c-brcmstb.c +++ b/drivers/i2c/busses/i2c-brcmstb.c @@ -170,7 +170,6 @@ struct brcmstb_i2c_dev { struct bsc_regs *bsc_regmap; struct i2c_adapter adapter; struct completion done; - bool is_suspended; u32 clk_freq_hz; int data_regsz; }; @@ -467,9 +466,6 @@ static int brcmstb_i2c_xfer(struct i2c_adapter *adapter, int xfersz = brcmstb_i2c_get_xfersz(dev); u32 cond, cond_per_msg; - if (dev->is_suspended) - return -EBUSY; - /* Loop through all messages */ for (i = 0; i < num; i++) { pmsg = &msgs[i]; @@ -689,10 +685,7 @@ static int brcmstb_i2c_suspend(struct device *dev) { struct brcmstb_i2c_dev *i2c_dev = dev_get_drvdata(dev); - i2c_lock_bus(&i2c_dev->adapter, I2C_LOCK_ROOT_ADAPTER); - i2c_dev->is_suspended = true; - i2c_unlock_bus(&i2c_dev->adapter, I2C_LOCK_ROOT_ADAPTER); - + i2c_mark_adapter_suspended(&i2c_dev->adapter, true); return 0; } @@ -700,10 +693,8 @@ static int brcmstb_i2c_resume(struct device *dev) { struct brcmstb_i2c_dev *i2c_dev = dev_get_drvdata(dev); - i2c_lock_bus(&i2c_dev->adapter, I2C_LOCK_ROOT_ADAPTER); brcmstb_i2c_set_bsc_reg_defaults(i2c_dev); - i2c_dev->is_suspended = false; - i2c_unlock_bus(&i2c_dev->adapter, I2C_LOCK_ROOT_ADAPTER); + i2c_mark_adapter_suspended(&i2c_dev->adapter, false); return 0; } -- 2.11.0