Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3737566imu; Tue, 18 Dec 2018 03:25:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/XWG1Wy5qA/NhHp3dKdMRRK8RANWtLof1a/62Dy2ZB5HaqDO3qlKxm1tMgLsCdYR/LDTBIo X-Received: by 2002:a63:170c:: with SMTP id x12mr15018486pgl.364.1545132311566; Tue, 18 Dec 2018 03:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545132311; cv=none; d=google.com; s=arc-20160816; b=xUjJTEYcCjJj2KvRA0Kv+P3jEkVfursXQFnC3Yc7vrsi6N+LjYCmE7Zw7tO1G4hjTO OuIkv6xmi2lHhnU1F5OtiIF6aNAySvQ8U9Z0qMPo/VYWmcVXcGpznbNjNKblFkWpM6jD 561yPOIIFh3SqsHL3ucmEEKpab04WXqsvISW7pciq3Bq2M7b9gYDiQm2LDMxJ41HoY4r lbpTK8n9nfCqpE7u59vUxxv4bPf8vki+l5Rnt7Epsv2v/mm84XlfbKK7st6hcTA4URop nX0/fej1omyxTyabFzHrgcXxhFimRu8UZt9+FHGWeZOyYIutiEjtmYHJS77HsQ9kEpuk puPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=NKvXK1MeO0eV8j/6E9wS58HIqqN66Hhn9V6+QE8HPyg=; b=vFEIzhC9RImGKI572BDsiViNGzLYa/N8KKDOhGBrgkc25TgiUvE66jlpAYZPrN0ZyW 3PDrMKorGFc44oGSeUViplusIBz+X4BoiW3KfvlN/yVA2WRd4qRaieupaxMW/SsR71ta Q+ZcNuahUeyc8e1Iik4exznXQjXw5FXq7Mb4oyJBmr6gOBquIW0I4ukWVtYI0Mb68/4l NKZdqiimqGxOqjPoBcjdItl/kViDcoi/3xlKIF6VXLJHYHMPST8jjdyDzzEev8Ec5KMX gHZiiWAI7vcRKvcREAllKlBl1zkIGCdnNqDB0JOtKfe0Bm7MrsRIwUYG3gACA9yWEiI6 WjeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CBfanqvL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si12564894plr.311.2018.12.18.03.24.55; Tue, 18 Dec 2018 03:25:11 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CBfanqvL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726505AbeLRLXy (ORCPT + 99 others); Tue, 18 Dec 2018 06:23:54 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:55782 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbeLRLXx (ORCPT ); Tue, 18 Dec 2018 06:23:53 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181218112351euoutp02055b68a3fa4478fe96148a30a0a20d7f~xaZQZSDrV1261112611euoutp02L for ; Tue, 18 Dec 2018 11:23:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181218112351euoutp02055b68a3fa4478fe96148a30a0a20d7f~xaZQZSDrV1261112611euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1545132232; bh=NKvXK1MeO0eV8j/6E9wS58HIqqN66Hhn9V6+QE8HPyg=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=CBfanqvLBszOFu4o9AJxnPy0+4wqpB8SJqwEc9p4VuGIGBB/f8ehVzmARSeKuXi4C ubMLUe38QKQRxHcLqoFCMc3kanm67Q+Lsy8vciMsVFuXn3FS8w+jw+VYJBLtl90YFX 4rpeeG2uiZQa45w0K49kbZ8cu3Fc1yzXnjLlGU4E= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181218112351eucas1p27a66e9dea27a1526287a03d021f724ff~xaZPs7p5l0905109051eucas1p2O; Tue, 18 Dec 2018 11:23:51 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A8.C2.04441.6C8D81C5; Tue, 18 Dec 2018 11:23:50 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181218112350eucas1p1b689ae88b6f9d0ed24b1bf9b53be4c2f~xaZOlt2FE1673916739eucas1p12; Tue, 18 Dec 2018 11:23:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181218112349eusmtrp1af386196ad1262bf1ad5f74158fac2ad~xaZOXCwtd0258502585eusmtrp1Z; Tue, 18 Dec 2018 11:23:49 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-dc-5c18d8c656cd Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id CA.9B.04284.5C8D81C5; Tue, 18 Dec 2018 11:23:49 +0000 (GMT) Received: from [106.116.147.30] (unknown [106.116.147.30]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181218112349eusmtip2c53e0aa0711150b09801e4ade0166dfa~xaZNw3Rzi3126731267eusmtip2j; Tue, 18 Dec 2018 11:23:49 +0000 (GMT) Subject: Re: [RFC/RFT 08/10] i2c: exynos5: use core helper to mark adapter suspended To: Wolfram Sang , 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, Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Andrzej Hajda From: Marek Szyprowski Message-ID: <87b6a87b-92d3-a1eb-b77b-f91651c72270@samsung.com> Date: Tue, 18 Dec 2018 12:23:49 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <20181210210310.12677-9-wsa+renesas@sang-engineering.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02SfyyUcRzHfe957rnH6epx2H2Gal3Tph9+LKtHmtikm/6hP2qra7p4wuLo zinS2MyR+R1xF0VT7NZOOz8yxUIcaaf8zmQtNCkhtNlE7p4p/70+3/f7831/PtuHxITtXEcy Sh7PKOSyaDHBxxu7Vk1HukZB6jE7dIge05u49A9jCYfOm/yO0X19z3m0YXKYS2f+WUb0QHMZ QS/lvEF0w7efHLq0r5VD55rO+NlIDLq7hKSuKkUy3zpESHLrdUjytbIWlywZ9gQTF/knw5no qARG4e57hR853P0aj5uDW/rcIZSKZuyzkDUJlBekly5ysxCfFFI1CNRPRnC2WEZQOKUm2GIJ wTPdAL7VUr6wbmEhVY0g3ZDCmuYRVHws4JkFO+o81PSUY2a2p4Ihf6PSkoFRrRx4WZjKMQsE 5QlZc1mEmQWUL7SslVgYp1xg/N2CxeNASWE6tRVnPbbQo5mysDUVCB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VjCKppcW56bnFhnrFibnFpXnpesn5uZsYgTG67djPzTsYL20MPsQo wMGoxMPLcEI8Rog1say4MvcQowQHs5II761SiRgh3pTEyqrUovz4otKc1OJDjKZAv01klhJN zgemj7ySeENTQ3MLS0NzY3NjMwslcd7zBpVRQgLpiSWp2ampBalFMH1MHJxSDYwlz4LKBdf7 eH+49KvgdLGLpcZn07kV7L1MF9+1qE1hPBXnPJN/j/LXK64LFqV7/lD9HhVW/ulWzuSOi/35 B+/l9BziYLOscL7aobK31EVd9/d5iZB6S8UNtismfd30KWbhhScp7HcN7/xJX75mt+zOVqWN +4M3HVdsWtekm7uNwd3k9QMXty4lluKMREMt5qLiRACdA0D65wIAAA== X-CMS-MailID: 20181218112350eucas1p1b689ae88b6f9d0ed24b1bf9b53be4c2f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181210210429epcas5p2b545f32165b5025e7cec0b5f5b98f783 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181210210429epcas5p2b545f32165b5025e7cec0b5f5b98f783 References: <20181210210310.12677-1-wsa+renesas@sang-engineering.com> <20181210210310.12677-9-wsa+renesas@sang-engineering.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2018-12-10 22:03, Wolfram Sang wrote: > Rejecting transfers should be handled by the core. Also, this will > ensure proper locking which was forgotten in this open coded version. > > Signed-off-by: Wolfram Sang Tested-by: Marek Szyprowski Works fine on TM2e and OdroidXU3. The only minor issue is the following warning: WARNING: CPU: 4 PID: 28 at drivers/i2c/i2c-core-base.c:1869 __i2c_transfer+0x428/0x5e0 Modules linked in: CPU: 4 PID: 28 Comm: cpuhp/4 Tainted: G        W         4.20.0-rc1-00031-ga1c77790d03f #5130 Hardware name: Samsung TM2E board (DT) pstate: 20000005 (nzCv daif -PAN -UAO) pc : __i2c_transfer+0x428/0x5e0 lr : i2c_transfer+0x64/0xb8 ... Call trace:  __i2c_transfer+0x428/0x5e0  i2c_transfer+0x64/0xb8  regmap_i2c_read+0x5c/0xa0  _regmap_raw_read+0xac/0x2a8  _regmap_bus_read+0x3c/0x70  _regmap_read+0x64/0x1a0  regmap_read+0x48/0x70  regulator_is_enabled_regmap+0x38/0xb8  _regulator_is_enabled.part.1+0x1c/0x30  create_regulator+0x264/0x270  _regulator_get+0x90/0x2b0  regulator_get_optional+0x10/0x18  dev_pm_opp_set_regulators+0xb8/0x1e8  cpufreq_init+0xd0/0x2f8  cpufreq_online+0xc0/0x660  cpuhp_cpufreq_online+0xc/0x18  cpuhp_invoke_callback+0xac/0x7b0  cpuhp_thread_fun+0xec/0x180  smpboot_thread_fn+0x1f0/0x290  kthread+0xfc/0x128  ret_from_fork+0x10/0x1c ---[ end trace bea5412bc21deb81 ]--- Similar warning was already there ('HS-I2C is not initialized' message, without backtrace) during system suspend/resume. It looks that cpu freq is resumed too early, before any device drivers, but this is not an issue for this patchset. > --- > drivers/i2c/busses/i2c-exynos5.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c > index c1ce2299a76e..fe2f2031ea36 100644 > --- a/drivers/i2c/busses/i2c-exynos5.c > +++ b/drivers/i2c/busses/i2c-exynos5.c > @@ -183,7 +183,6 @@ enum i2c_type_exynos { > > struct exynos5_i2c { > struct i2c_adapter adap; > - unsigned int suspended:1; > > struct i2c_msg *msg; > struct completion msg_complete; > @@ -715,11 +714,6 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, > struct exynos5_i2c *i2c = adap->algo_data; > int i, ret; > > - if (i2c->suspended) { > - dev_err(i2c->dev, "HS-I2C is not initialized.\n"); > - return -EIO; > - } > - > ret = clk_enable(i2c->clk); > if (ret) > return ret; > @@ -847,8 +841,7 @@ static int exynos5_i2c_suspend_noirq(struct device *dev) > { > struct exynos5_i2c *i2c = dev_get_drvdata(dev); > > - i2c->suspended = 1; > - > + i2c_mark_adapter_suspended(&i2c->adap, true); > clk_unprepare(i2c->clk); > > return 0; > @@ -871,7 +864,7 @@ static int exynos5_i2c_resume_noirq(struct device *dev) > > exynos5_i2c_init(i2c); > clk_disable(i2c->clk); > - i2c->suspended = 0; > + i2c_mark_adapter_suspended(&i2c->adap, false); > > return 0; > } Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland