Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4097465imu; Mon, 10 Dec 2018 13:06:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/UoXpuEHoBrchDFISBuFpAZxsidJM+Y/bIL9iSKyLPTqfbMSpYoJ1ZpXKQa2072KCnY0TKV X-Received: by 2002:a62:9f01:: with SMTP id g1mr13748858pfe.223.1544475960463; Mon, 10 Dec 2018 13:06:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544475960; cv=none; d=google.com; s=arc-20160816; b=trkhih0iHVsQrjmSlFdQqU1i9grIIgZBKlOdUM5XgBLQ+js6pSAf6Zdd8p6oRXdSsp 1nw9VolUnyo7m5Q4BEDhFnwU/TwWldFFptGhRnyEsp5ADh8kPGN3M1CowjCa5Wnkvr5t Y1e9TKQxsVpDPmbsOshL8sDLWziwjsgfnnndo7IlwYO4GgFNjUqNPdccqn+7R25eouGD t1ixQjN23nmIjRrALne6f1h8Hty93+Lw77qpPrE3VMePnkP32y4GadcdIgMQ8xc1jNDW JUe8Vq1aD2WHHcdUG7PZL3ezAshgkN4f305dGr3gPYmO++RuIeDVhJhuJXwDKWm5p9ZC QFrg== 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=WrnnNByEnBElngFhVjo/4ouxyadFJSj6PyVCpLjowCY=; b=jSZevuY6Hls56kfisO9/zNk7MKB+AuJ0pup0FSJmPkyEO3wEaVoCvjRh8qC4wrHYim zSVyIcsgtjwj1PWVv0tpM/dlFJLg8bD4sbMt/wdKCTTP1MGcBT9fG/EdKcXBEUxfwNmH djgrKBXZi4IY3kklty5pklVZeBrG3uJen/ZwX64tncJf4DU97eTdURr66OWix8LM+1Kl JgNADtOwHRwUShn9+YjE//ydOchaEMy5Oa0ZHHBi1q5g9VBLbScUfVVNDtniPBiAwKAt xcdO/79zexnUowcjnj6iiOGXG+0KQSOCO59WsHg8Oe2YNo9aOAIoWZVdDszx507yPEad wW9Q== 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 bj2si10326562plb.27.2018.12.10.13.05.44; Mon, 10 Dec 2018 13:06:00 -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 S1730057AbeLJVEG (ORCPT + 99 others); Mon, 10 Dec 2018 16:04:06 -0500 Received: from sauhun.de ([88.99.104.3]:36716 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729921AbeLJVDS (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 A7ECC4C3C71; Mon, 10 Dec 2018 22:03:16 +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 , Jun Nie , Shawn Guo , linux-kernel@vger.kernel.org Subject: [RFC/RFT 05/10] i2c: zx2967: use core helper to mark adapter suspended Date: Mon, 10 Dec 2018 22:03:03 +0100 Message-Id: <20181210210310.12677-6-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. Also, this will ensure proper locking which was forgotten in this open coded version and make sure resume mark is set after enabling clocks (not before). Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-zx2967.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-zx2967.c b/drivers/i2c/busses/i2c-zx2967.c index b8f9e020d80e..9fa48bbe0719 100644 --- a/drivers/i2c/busses/i2c-zx2967.c +++ b/drivers/i2c/busses/i2c-zx2967.c @@ -66,7 +66,6 @@ struct zx2967_i2c { int msg_rd; u8 *cur_trans; u8 access_cnt; - bool is_suspended; int error; }; @@ -313,9 +312,6 @@ static int zx2967_i2c_xfer(struct i2c_adapter *adap, int ret; int i; - if (i2c->is_suspended) - return -EBUSY; - zx2967_set_addr(i2c, msgs->addr); for (i = 0; i < num; i++) { @@ -470,7 +466,7 @@ static int __maybe_unused zx2967_i2c_suspend(struct device *dev) { struct zx2967_i2c *i2c = dev_get_drvdata(dev); - i2c->is_suspended = true; + i2c_mark_adapter_suspended(&i2c->adap, true); clk_disable_unprepare(i2c->clk); return 0; @@ -480,8 +476,8 @@ static int __maybe_unused zx2967_i2c_resume(struct device *dev) { struct zx2967_i2c *i2c = dev_get_drvdata(dev); - i2c->is_suspended = false; clk_prepare_enable(i2c->clk); + i2c_mark_adapter_suspended(&i2c->adap, false); return 0; } -- 2.11.0