From: Kamil Konieczny <k.konieczny@partner.samsung.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Kukjin Kim <kgene@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
Mark Rutland <mark.rutland@arm.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Nishanth Menon <nm@ti.com>, Rob Herring <robh+dt@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Viresh Kumar <vireshk@kernel.org>,
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
Subject: Re: [PATCH 1/3] opp: core: add regulators enable and disable
Date: Thu, 11 Jul 2019 14:58:02 +0200 [thread overview]
Message-ID: <fc404004-510e-5e76-df5f-ea78fdf51bf7@partner.samsung.com> (raw)
In-Reply-To: <20190711062226.4i4bvbsyczshdlyr@vireshk-i7>
On 11.07.2019 08:22, Viresh Kumar wrote:
> On 08-07-19, 16:11, k.konieczny@partner.samsung.com wrote:
>> From: Kamil Konieczny <k.konieczny@partner.samsung.com>
>>
>> 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().
>>
>> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
>> ---
>> drivers/opp/core.c | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
>> index 0e7703fe733f..947cac452854 100644
>> --- a/drivers/opp/core.c
>> +++ b/drivers/opp/core.c
>> @@ -1580,8 +1580,19 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
>> if (ret)
>> goto free_regulators;
>>
>> + for (i = 0; i < opp_table->regulator_count; i++) {
>> + ret = regulator_enable(opp_table->regulators[i]);
>> + if (ret < 0)
>> + goto disable;
>> + }
>
> What about doing this in the same loop of regulator_get_optional() ?
yes, this is good, it will simplify code
>> +
>> return opp_table;
>>
>> +disable:
>> + while (i != 0)
>> + regulator_disable(opp_table->regulators[--i]);
>> +
>> + i = opp_table->regulator_count;
>
> You also need to call _free_set_opp_data() here.
good catch
if I move enable in loop above, then this will not be needed
>> free_regulators:
>> while (i != 0)
>> regulator_put(opp_table->regulators[--i]);
>> @@ -1609,6 +1620,8 @@ 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));
>
> Preserve the blank line here.
>
>> + for (i = opp_table->regulator_count - 1; i >= 0; i--)
>> + regulator_disable(opp_table->regulators[i]);
>>
>> for (i = opp_table->regulator_count - 1; i >= 0; i--)
>> regulator_put(opp_table->regulators[i]);
>
> Only single loop should be sufficient for this.
you are right, I will do this in single loop
I will send v2
--
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland
next prev parent reply other threads:[~2019-07-11 12:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190708141158eucas1p17d4b50978dbe1e5c876ce6d8f433cc95@eucas1p1.samsung.com>
2019-07-08 14:11 ` [PATCH 0/3] add coupled regulators for Exynos5422/5800 k.konieczny
2019-07-08 14:11 ` [PATCH 1/3] opp: core: add regulators enable and disable k.konieczny
2019-07-09 5:40 ` Viresh Kumar
2019-07-10 10:16 ` Kamil Konieczny
2019-07-10 10:42 ` Kamil Konieczny
2019-07-10 10:43 ` Kamil Konieczny
2019-07-10 13:52 ` Kamil Konieczny
2019-07-10 17:01 ` Krzysztof Kozlowski
2019-07-11 6:22 ` Viresh Kumar
2019-07-11 12:58 ` Kamil Konieczny [this message]
2019-07-08 14:11 ` [PATCH 2/3] devfreq: exynos-bus: convert to use dev_pm_opp_set_rate() k.konieczny
2019-07-10 17:04 ` Krzysztof Kozlowski
2019-07-11 13:36 ` Kamil Konieczny
2019-07-08 14:11 ` [PATCH 3/3] ARM: dts: exynos: add initial data for coupled regulators for Exynos5422/5800 k.konieczny
2019-07-10 9:02 ` Krzysztof Kozlowski
2019-07-10 9:00 ` [PATCH 0/3] add " Krzysztof Kozlowski
2019-07-10 10:03 ` Kamil Konieczny
2019-07-10 10:14 ` Krzysztof Kozlowski
2019-07-10 13:51 ` Kamil Konieczny
2019-07-10 17:01 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc404004-510e-5e76-df5f-ea78fdf51bf7@partner.samsung.com \
--to=k.konieczny@partner.samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.com \
--cc=myungjoo.ham@samsung.com \
--cc=nm@ti.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox