From: Viresh Kumar <viresh.kumar@linaro.org>
To: k.konieczny@partner.samsung.com
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 v3 2/5] opp: core: add regulators enable and disable
Date: Tue, 23 Jul 2019 07:18:41 +0530 [thread overview]
Message-ID: <20190723014841.yyttacgagktbkwg2@vireshk-i7> (raw)
In-Reply-To: <20190719150535.15501-3-k.konieczny@partner.samsung.com>
On 19-07-19, 17:05, k.konieczny@partner.samsung.com wrote:
> Add enable regulators to dev_pm_opp_set_regulators() and disable
> regulators to dev_pm_opp_put_regulators(). Even if bootloader
> leaves regulators enabled, they should be enabled in kernel in
> order to increase the reference count.
>
> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
> ---
> Changes in v3:
> - corrected error path in enable
> - improved commit message
> Changes in v2:
> - move regulator enable and disable into loop
> ---
> drivers/opp/core.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 0e7703fe733f..a8a480cdabab 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1570,6 +1570,12 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
> goto free_regulators;
> }
>
> + ret = regulator_enable(reg);
> + if (ret < 0) {
> + regulator_put(reg);
> + goto free_regulators;
> + }
> +
> opp_table->regulators[i] = reg;
> }
>
> @@ -1583,8 +1589,10 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
> return opp_table;
>
> free_regulators:
> - while (i != 0)
> - regulator_put(opp_table->regulators[--i]);
> + while (i--) {
> + regulator_disable(opp_table->regulators[i]);
> + regulator_put(opp_table->regulators[i]);
> + }
>
> kfree(opp_table->regulators);
> opp_table->regulators = NULL;
> @@ -1610,8 +1618,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);
Applied. Thanks.
--
viresh
next prev parent reply other threads:[~2019-07-23 1:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190719150553eucas1p142b965afae13224712d51f9c28162165@eucas1p1.samsung.com>
2019-07-19 15:05 ` [PATCH v3 0/5] add coupled regulators for Exynos5422/5800 k.konieczny
[not found] ` <CGME20190719150553eucas1p1665462f3fc0e06fc9c082e258be3a851@eucas1p1.samsung.com>
2019-07-19 15:05 ` [PATCH v3 1/5] devfreq: exynos-bus: correct clock enable sequence k.konieczny
2019-07-25 9:58 ` Chanwoo Choi
[not found] ` <CGME20190719150554eucas1p2f4c9e4d2767ab740d419c42d4aeed6d5@eucas1p2.samsung.com>
2019-07-19 15:05 ` [PATCH v3 2/5] opp: core: add regulators enable and disable k.konieczny
2019-07-23 1:48 ` Viresh Kumar [this message]
[not found] ` <CGME20190719150555eucas1p197adc3c58e45c53137fd70cadbfae60e@eucas1p1.samsung.com>
2019-07-19 15:05 ` [PATCH v3 3/5] devfreq: exynos-bus: convert to use dev_pm_opp_set_rate() k.konieczny
2019-07-25 10:17 ` Chanwoo Choi
2019-07-25 13:35 ` Kamil Konieczny
2019-07-25 14:53 ` Chanwoo Choi
2019-07-25 15:15 ` Kamil Konieczny
2019-07-26 1:02 ` Chanwoo Choi
[not found] ` <CGME20190719150556eucas1p291b9e533a80d77e2f58452f0e1fe8b35@eucas1p2.samsung.com>
2019-07-19 15:05 ` [PATCH v3 4/5] ARM: dts: exynos: add initial data for coupled regulators for Exynos5422/5800 k.konieczny
[not found] ` <CGME20190719150556eucas1p2bc6f133c48ec1be9b36119a414887969@eucas1p2.samsung.com>
2019-07-19 15:05 ` [PATCH v3 5/5] dt-bindings: devfreq: exynos-bus: remove unused property k.konieczny
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=20190723014841.yyttacgagktbkwg2@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=k.konieczny@partner.samsung.com \
--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=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;
as well as URLs for NNTP newsgroup(s).