Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp417547imm; Mon, 9 Jul 2018 04:21:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd9gwKHBm9AOVwq9ELwi/ZShZS9Dp+GcHhSNI4Rg+Z1LbmQ+RvzWlPqHh57vAbs77feoEBy X-Received: by 2002:a17:902:6b0b:: with SMTP id o11-v6mr20664851plk.101.1531135279049; Mon, 09 Jul 2018 04:21:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531135279; cv=none; d=google.com; s=arc-20160816; b=cfvZvxceQDJ3ZNXSpYdAi8wqBEtlk15JoNrmRxivQBuOVNdoaMnBukE1qfE/JLGUwd ZmYEhGVp5FP8Vxvag4+pse/LAUiPSY4LJk0x0GcFukX5YXT2r+8zKvEF01nhha9lwDoL cAESAdBdrsx9JkF54gTk8m/2Pny50qvS4lhoc2yKettdTtamhX3vk6nLaKJ4vMfgtHFe hmtkmjqXZQDFbKUhEy86ZtEHWfV2ML3f15zYPWvSTCQhDnk1JypxnHKW+mIIMsiQJ/8+ 1Yrhwa+JM6qBKqAXIYA/zaqc2OLl/9KgoIaN8JSYv3j94ufja/4hoZ7UiYGrjdW5YRNA rorw== 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:message-id :content-language:content-transfer-encoding:in-reply-to:mime-version :user-agent:date:from:cc:to:subject:dkim-signature:dkim-filter :arc-authentication-results; bh=0IAq8Dz54plyNYwA5MiBHBzAPGU//JmBsb+n2HptJ8s=; b=cLtMr13eAixKojN8HaiK+jXgF6YSwO5Fn/ZA759PE7x1oJP3OJjt8AZbg7FGYAXRmq elTCshvn6gaEBIXNwQBw7iUs7Jw7vqObmsxWWmeDM53qTdmngE3ZrSavW8MEuKknEEsp 7gOJuOjI3yqpGmxvsmWUVSyjhP/qqeJ6lZ3g4GXG+T38jcHwA/PmtqW8xcPz2o9tWyh8 w3nMdtMCyhjxdez7wL1+4noOVnA19HwIoftYjMrnckv9j205rf8KFx77iXORDKUj82Lu QImDyrM2tdxLUB64GXETulVrGzkHDGgx92LU0qA7KDmRFRwrJz6x3VkkJK1uLWnjJbVC c67w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=R5okUei2; 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 r1-v6si14504286plb.172.2018.07.09.04.21.04; Mon, 09 Jul 2018 04:21:19 -0700 (PDT) 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=R5okUei2; 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 S932842AbeGILR6 (ORCPT + 99 others); Mon, 9 Jul 2018 07:17:58 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:52640 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932638AbeGILR4 (ORCPT ); Mon, 9 Jul 2018 07:17:56 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180709111754euoutp01be269992049aaabe0c2cd17cb53f1a25~-rzz9NJIc1588315883euoutp01K for ; Mon, 9 Jul 2018 11:17:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180709111754euoutp01be269992049aaabe0c2cd17cb53f1a25~-rzz9NJIc1588315883euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1531135074; bh=0IAq8Dz54plyNYwA5MiBHBzAPGU//JmBsb+n2HptJ8s=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=R5okUei2Q/IeV+5El0cEXEWiVBl0R3BE6hHCDzfi1f6ElSQTKzlGDAOhiCelkjcvg dR/Ldz1tabv3qnq+u3R2uM/aon1VRGjTp9tjuoWSALtiqeRvNZLryCCY35lAbkmL3t qO7FU6Bk4WgoopLIP65EOx+4STRQnM4+kuqDa95U= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180709111754eucas1p14f1641347a2370d36c17cb279687a2a2~-rzzQRULv3176131761eucas1p1Y; Mon, 9 Jul 2018 11:17:54 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 69.9F.05700.164434B5; Mon, 9 Jul 2018 12:17:53 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d~-rzycA5Rg0378203782eucas1p1C; Mon, 9 Jul 2018 11:17:53 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20180709111752eusmtrp16db6c54ddda9fce418669d7c4b591a54~-rzyNeu8P2291522915eusmtrp1P; Mon, 9 Jul 2018 11:17:52 +0000 (GMT) X-AuditID: cbfec7f2-1c1ff70000011644-3b-5b434461ee86 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 56.CA.04178.064434B5; Mon, 9 Jul 2018 12:17:52 +0100 (BST) Received: from [106.116.147.30] (unknown [106.116.147.30]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180709111752eusmtip2970bfd66be7950d11907c544933c2c9d~-rzxzo_2w0322003220eusmtip2T; Mon, 9 Jul 2018 11:17:52 +0000 (GMT) Subject: Re: Applied "regulator: core: Link consumer with regulator driver" to the regulator tree To: Mark Brown , pascal paillet Cc: "gregkh@linuxfoundation.org" , "lgirdwood@gmail.com" , "linux-kernel@vger.kernel.org" , "benjamin.gaignard@linaro.org" , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz From: Marek Szyprowski Date: Mon, 9 Jul 2018 13:17:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNKsWRmVeSWpSXmKPExsWy7djPc7qJLs7RBotn6FhsnLGe1aLp0Ck2 i6kPn7BZNC9ez2Zx/vwGdotvVzqYLC7vmsNm8e7MU3YHDo+ds+6ye2xa1cnmcefaHjaP/XPX sHv0bVnF6PH0x15mj8+b5ALYo7hsUlJzMstSi/TtErgytr37y17wRbvi9PktLA2Mb1W6GDk5 JARMJI5PfsDSxcjFISSwglGi4eVhZgjnC6PEqpuNbBDOZ0aJlU9eMcK0zJh1igkisZxRYu2S iVBV7xkleqd3gVUJCyRLzDi0kw3EFhFwkzi5YBKYzSxwlkni60I5EJtNwFCi620XWJxFQEVi 1e8+FhBbVCBGYt6iv2A2r4CgxMmZT8BsTgEtifcXe5gh5shLbH87B8oWl7j1ZD7YRRICx9gl 9s9cxQ7RXCaxonEy1NkuEpdmdrFD2MISr45vgbJlJE5P7mGBaG5mlGifMYsdwulhlNg6Zwcb RJW1xOHjF1m7GDmA1mlKrN+lDxF2lPj48hAbSFhCgE/ixltBiIP4JCZtm84MEeaV6GgTgqhW k5h1fB3c2oMXLjFPYFSaheTNWU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g2MWqmbnvFsVv42I0Z+c9jz mZrPw2+fvGymsvpV8vu/d9JXzimJn+ZV4l5/dP+UUq7r2jYp30tD7l4vElssvXyK6ud5ORoc RTd/7LzXGxzwdo+xi/oiS+aCkzl7BUv2HD5XHxEms/NML0c81+vdPdvYnThmVl5X3s5u6btb 5NH+cwk/C3VOsug+UGIpzkg01GIuKk4EADjvu//fAgAA Message-Id: <20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d~-rzycA5Rg0378203782eucas1p1C@eucas1p1.samsung.com> X-CMS-MailID: 20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear All, On 2018-07-05 19:55, Mark Brown wrote: > The patch > > regulator: core: Link consumer with regulator driver > > has been applied to the regulator tree at > > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git > > All being well this means that it will be integrated into the linux-next > tree (usually sometime in the next 24 hours) and sent to Linus during > the next merge window (or sooner if it is a bug fix), however if > problems are discovered then the patch may be dropped or reverted. > > You may get further e-mails resulting from automated or manual testing > and review of the tree, please engage with people reporting problems and > send followup patches addressing any issues that are reported if needed. > > If any updates are required or you are submitting further changes they > should be sent as incremental updates against current git, existing > patches will not be replaced. > > Please add any relevant lists and maintainers to the CCs when replying > to this mail. > > Thanks, > Mark > > >From ed1ae2dd9f242c7a36e8e39100f6a7f6bcdfdd89 Mon Sep 17 00:00:00 2001 > From: pascal paillet > Date: Thu, 5 Jul 2018 14:25:56 +0000 > Subject: [PATCH] regulator: core: Link consumer with regulator driver > > Add a device link between the consumer and the driver so that > the consumer is not suspended before the driver. The goal is to avoid > implementing suspend_late ops in regulator drivers. > > Signed-off-by: pascal paillet > Signed-off-by: Mark Brown This patch triggers the following warning on several Exynos SoC based boards: ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1 at drivers/base/core.c:108 device_is_dependent+0xa4/0xb4 Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.18.0-rc3-next-20180706 #112 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x98/0xc4) [] (dump_stack) from [] (__warn+0x10c/0x124) [] (__warn) from [] (warn_slowpath_null+0x40/0x48) [] (warn_slowpath_null) from [] (device_is_dependent+0xa4/0xb4) [] (device_is_dependent) from [] (device_for_each_child+0x50/0x94) [] (device_for_each_child) from [] (device_is_dependent+0x20/0xb4) [] (device_is_dependent) from [] (device_link_add+0x70/0x2a8) [] (device_link_add) from [] (_regulator_get+0xbc/0x270) [] (_regulator_get) from [] (regulator_bulk_get+0x60/0xcc) [] (regulator_bulk_get) from [] (wm8994_i2c_probe+0x334/0x8ec) [] (wm8994_i2c_probe) from [] (i2c_device_probe+0x240/0x2b8) [] (i2c_device_probe) from [] (driver_probe_device+0x2dc/0x4ac) [] (driver_probe_device) from [] (__driver_attach+0x128/0x144) [] (__driver_attach) from [] (bus_for_each_dev+0x68/0xb4) [] (bus_for_each_dev) from [] (bus_add_driver+0x1a8/0x268) [] (bus_add_driver) from [] (driver_register+0x78/0x10c) [] (driver_register) from [] (i2c_register_driver+0x3c/0xa8) [] (i2c_register_driver) from [] (do_one_initcall+0x8c/0x4b0) [] (do_one_initcall) from [] (kernel_init_freeable+0x3e4/0x570) [] (kernel_init_freeable) from [] (kernel_init+0x8/0x10c) [] (kernel_init) from [] (ret_from_fork+0x14/0x20) Exception stack(0xee8c9fb0 to 0xee8c9ff8) ... ---[ end trace 4ed89cca1d70ea82 ]--- The above stack comes from Exynos5250 Arndale board (arch/arm/boot/dts/exynos5250-arndale.dts), where wm8994 codec tries to get regulator, which is provided by its parent mfd device. Similar issue can be observed on Exynos4412-based Trats2 and Exynos5433 TM2(e) boards. It looks that some more checks have to be done before adding a link between regulator consumer and regulator driver, because it is not that uncommon that regulator consumer shares the parent device with regulator provider. > --- > drivers/regulator/core.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c > index da9b0fed8330..bb1324f93143 100644 > --- a/drivers/regulator/core.c > +++ b/drivers/regulator/core.c > @@ -1740,6 +1740,8 @@ struct regulator *_regulator_get(struct device *dev, const char *id, > rdev->use_count = 0; > } > > + device_link_add(dev, &rdev->dev, DL_FLAG_STATELESS); > + > return regulator; > } > > @@ -1829,9 +1831,21 @@ static void _regulator_put(struct regulator *regulator) > > debugfs_remove_recursive(regulator->debugfs); > > - /* remove any sysfs entries */ > - if (regulator->dev) > + if (regulator->dev) { > + int count = 0; > + struct regulator *r; > + > + list_for_each_entry(r, &rdev->consumer_list, list) > + if (r->dev == regulator->dev) > + count++; > + > + if (count == 1) > + device_link_remove(regulator->dev, &rdev->dev); > + > + /* remove any sysfs entries */ > sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); > + } > + > regulator_lock(rdev); > list_del(®ulator->list); > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland