Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp940044ybi; Wed, 17 Jul 2019 07:14:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqIgUNWzmNp2hhWxUMZM0vx4OjPzS1QuXp+2y+eQx1zMI71GAmPO1dCw1b8h6SxoG7wda1 X-Received: by 2002:a17:902:b713:: with SMTP id d19mr43584541pls.267.1563372852579; Wed, 17 Jul 2019 07:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563372852; cv=none; d=google.com; s=arc-20160816; b=008F6oExzJS2XQ4d22bULYLJ1h2OnvLQeITsQjau4FfyLWVR5B/4CDVo1PNzAOhTwW /Pum/xJnjZ9w2NX3DGRJmTCRAuPzv8NnhzO58jqaS7HJYJcZ1diVqo2LVguxSayXMnxX 9/5U2wbQcIJZlc0Jv3jdHr3FC+tfY63wWVYRO9oZxBENw+MOkEAw1cdT1m626zdqetf9 PDzxtwhb05i2AGQNNIF1dAdlIBuVhr4UcZPOahwau8POYRyScKri188KY5R1uIzC9Y8n ePJdWCstasddYYJXt3Ja8OqM9183b8BHmO0xy0iYwgxwn+l5gToyHqoD8Acwdl3XC9p+ 98cg== 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-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=e7owagyzm32/x8fQaeiUS1HzPuby4JB3XeoTnzx54mQ=; b=xZDVXNw757VAcBqXIsZGaIcXgLFi4PofeDPL8dMBE2RZl42DM+D1iqZdCvPJIfffpA Y4NE2BK9mTiSXitgvw3WqnWWXk7tuF/Uqvwr03lOYRKte70QnNMmWsiYdMNIShbrmeBA SmIQaD+BKEUNdYTr2zsMyLthSUcpHmUJOEGN0jd3wuK4l4SR8XrYIpLnlU/KCpszS3U6 8mbQxMR+VZ6tUNRppTBZrXcG73SdcyKsweq7EiSRwBa/mxtvFvEojGlHPohM5vRgVpfB dtKLrDf7tmF5UJ3qOOSIOVW3bOcm7AEC5aCC2lqVGZnDIKwbZXSLJ86qfBc1iXTrTxaQ OKoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="ABpsfu/A"; 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 w3si23317276pgh.525.2019.07.17.07.13.55; Wed, 17 Jul 2019 07:14:12 -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="ABpsfu/A"; 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 S1727777AbfGQOMs (ORCPT + 99 others); Wed, 17 Jul 2019 10:12:48 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:44397 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbfGQOMs (ORCPT ); Wed, 17 Jul 2019 10:12:48 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190717141246euoutp02eca645e8620be574dcb0cae43a72c280~yNz9-K2gX1337913379euoutp02Q for ; Wed, 17 Jul 2019 14:12:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190717141246euoutp02eca645e8620be574dcb0cae43a72c280~yNz9-K2gX1337913379euoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1563372766; bh=e7owagyzm32/x8fQaeiUS1HzPuby4JB3XeoTnzx54mQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=ABpsfu/AoPIpQ92e1e+OBC5bBSrkVN1FDhP4sqoygoxo8n0bTjyktWFxwegStsYog lnh3m1MItmuBO2A7SR05R/CGqpxlYFsFHW5Pp+dbD8whn9Q+SFaxS91pSHqkpMgaM5 hCeLB9S3jPiZKjX66W+VJZPXuAm7z9sdIEyIdeCc= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190717141245eucas1p2c16ff22a3ed0ebf0f56c021d47ca5616~yNz9Otly70335803358eucas1p2Y; Wed, 17 Jul 2019 14:12:45 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id E5.49.04298.DDC2F2D5; Wed, 17 Jul 2019 15:12:45 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190717141244eucas1p2f2a29627d97d942a7afad36f794a5190~yNz8UkrW40549205492eucas1p2P; Wed, 17 Jul 2019 14:12:44 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190717141244eusmtrp298844cfbbfdb6604b73f714120ca8a82~yNz8GN5zb3155131551eusmtrp2H; Wed, 17 Jul 2019 14:12:44 +0000 (GMT) X-AuditID: cbfec7f2-f2dff700000010ca-1d-5d2f2cdd021f Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 36.A8.04146.CDC2F2D5; Wed, 17 Jul 2019 15:12:44 +0100 (BST) Received: from [106.120.51.18] (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190717141243eusmtip2a6e78e0dcb3c2d83be7dcabbbaf919ef~yNz7aE4OC2299922999eusmtip2e; Wed, 17 Jul 2019 14:12:43 +0000 (GMT) Subject: Re: [PATCH v2 1/4] opp: core: add regulators enable and disable To: Chanwoo Choi Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , Krzysztof Kozlowski , Kukjin Kim , Kyungmin Park , Mark Rutland , MyungJoo Ham , Nishanth Menon , Rob Herring , Stephen Boyd , Viresh Kumar , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org From: Kamil Konieczny Message-ID: <297179a4-a542-0836-6192-e06369fdcae5@partner.samsung.com> Date: Wed, 17 Jul 2019 16:12:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9acc7dd0-614b-ccd3-a485-eeca3dab494b@samsung.com> Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0iTURjGO/su+xSnx7nwRSNjEV3UWZR0SLtSuaAioj/Cslz6YZIz3Zym /dFmljdSUciaogXdMM2ctxS7TXOEmpRRM82GZnaTyksk0sztU/K/33ne5+F9XjgcJbUxPlxs fBKviVfFyVlXuqF9qjvwfUBQxNrqSh9Sc6WaIW8nRhhS3vaCIflD3yjS3X1fTLrSv4uJaegN Q3qaS1kyfqkNkSvdj0Skqu29mNx8+1JE+gx3WPL9T5eIXHjYJib2NzU0qbW1s9s8lZVllUhp qshmlbU3zinz6iqQ0mJtFCnHTUsPsOGuodF8XGwyrwnaEul60lRURCfUys68erZPj5pwDnLh AG+A6SfXaAdL8R0EVaMJOch1licQFD0zscJjHEF7p5GdT0ykD1LC4DaC4inrnGsUwZcffxmH ywsrwfJ6xJmQ4VVw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PU0M4jNIqAq0dB3B6xeVCBC4vCOWYwQNYISJ2c+YQGxOQXs Jba9uA0WZxZQl/gz7xIzhC0ucevJfCYIW16ieets5gmMQrOQtM9C0jILScssJC0LGFlWMYqk lhbnpucWG+oVJ+YWl+al6yXn525iBEb4tmM/N+9gvLQx+BCjAAejEg/vDSX9WCHWxLLiytxD jBIczEoivLZftWOFeFMSK6tSi/Lji0pzUosPMZoCPTeRWUo0OR+YfPJK4g1NDc0tLA3Njc2N zSyUxHk7BA7GCAmkJ5akZqemFqQWwfQxcXBKNTAWVIhl16SXv1+4ws8/RNiDp2/fGY7bfGKx VhflZj3kUJ4T3VFYe6h+5blAEdO8jeEhBRfVl/2PiH/Im7raZlPN5RknueN0W68ceBrZaSMY OEdwysLIwoc22kf7ctPa+5XuJlp0JpsIaHnePeYyS/xr86cpot63mOO6/u1cr7PU6+uqJr9t O5VYijMSDbWYi4oTAS3AVUMGAwAA X-CMS-MailID: 20190717141244eucas1p2f2a29627d97d942a7afad36f794a5190 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190715120430eucas1p19dddcc93756e6a110d3476229f9428b3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190715120430eucas1p19dddcc93756e6a110d3476229f9428b3 References: <20190715120416.3561-1-k.konieczny@partner.samsung.com> <20190715120416.3561-2-k.konieczny@partner.samsung.com> <9acc7dd0-614b-ccd3-a485-eeca3dab494b@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.07.2019 06:03, Chanwoo Choi wrote: > Hi Kamil, > > On 19. 7. 15. 오후 9:04, Kamil Konieczny wrote: >> Add enable regulators to dev_pm_opp_set_regulators() and disable >> regulators to dev_pm_opp_put_regulators(). This prepares for >> converting exynos-bus devfreq driver to use dev_pm_opp_set_rate(). > > IMHO, it is not proper to mention the specific driver name. > If you explain the reason why enable the regulator before using it, > it is enough description. > >> >> Signed-off-by: Kamil Konieczny >> -- >> Changes in v2: >> >> - move regulator enable and disable into loop >> >> --- >> drivers/opp/core.c | 18 +++++++++++++++--- >> 1 file changed, 15 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index 0e7703fe733f..069c5cf8827e 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -1570,6 +1570,10 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, >> goto free_regulators; >> } >> >> + ret = regulator_enable(reg); >> + if (ret < 0) >> + goto disable; >> + >> opp_table->regulators[i] = reg; >> } >> >> @@ -1582,9 +1586,15 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, >> >> return opp_table; >> >> +disable: >> + regulator_put(reg); >> + --i; >> + >> free_regulators: >> - while (i != 0) >> - regulator_put(opp_table->regulators[--i]); >> + for (; i >= 0; --i) { >> + regulator_disable(opp_table->regulators[i]); >> + regulator_put(opp_table->regulators[i]); >> + } >> >> kfree(opp_table->regulators); >> opp_table->regulators = NULL; >> @@ -1610,8 +1620,10 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) >> /* Make sure there are no concurrent readers while updating opp_table */ >> WARN_ON(!list_empty(&opp_table->opp_list)); >> >> - for (i = opp_table->regulator_count - 1; i >= 0; i--) >> + for (i = opp_table->regulator_count - 1; i >= 0; i--) { >> + regulator_disable(opp_table->regulators[i]); >> regulator_put(opp_table->regulators[i]); >> + } >> >> _free_set_opp_data(opp_table); >> >> > > I agree to enable the regulator before using it. > The bootloader might not enable the regulators > and the kernel need to enable regulator in order to increase > the reference count explicitly event if bootloader enables it. > > Reviewed-by: Chanwoo Choi Thank you, I will change commit description and send v3. -- Best regards, Kamil Konieczny Samsung R&D Institute Poland