* [PATCH] PM: opp: simplify with dev_err_probe()
@ 2022-04-08 11:10 Krzysztof Kozlowski
2022-04-11 2:53 ` Viresh Kumar
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-08 11:10 UTC (permalink / raw)
To: Viresh Kumar, Nishanth Menon, Stephen Boyd, linux-pm, linux-kernel
Cc: Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and the error value gets printed.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/opp/core.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 0b5357b9d342..ed72df835f8c 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2030,10 +2030,9 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
for (i = 0; i < count; i++) {
reg = regulator_get_optional(dev, names[i]);
if (IS_ERR(reg)) {
- ret = PTR_ERR(reg);
- if (ret != -EPROBE_DEFER)
- dev_err(dev, "%s: no regulator (%s) found: %d\n",
- __func__, names[i], ret);
+ ret = dev_err_probe(dev, PTR_ERR(reg),
+ "%s: no regulator (%s) found\n",
+ __func__, names[i]);
goto free_regulators;
}
@@ -2179,11 +2178,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name)
/* Find clk for the device */
opp_table->clk = clk_get(dev, name);
if (IS_ERR(opp_table->clk)) {
- ret = PTR_ERR(opp_table->clk);
- if (ret != -EPROBE_DEFER) {
- dev_err(dev, "%s: Couldn't find clock: %d\n", __func__,
- ret);
- }
+ ret = dev_err_probe(dev, PTR_ERR(opp_table->clk),
+ "%s: Couldn't find clock\n", __func__);
goto err;
}
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PM: opp: simplify with dev_err_probe()
2022-04-08 11:10 [PATCH] PM: opp: simplify with dev_err_probe() Krzysztof Kozlowski
@ 2022-04-11 2:53 ` Viresh Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2022-04-11 2:53 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, linux-pm, linux-kernel
On 08-04-22, 13:10, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/opp/core.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 0b5357b9d342..ed72df835f8c 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2030,10 +2030,9 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
> for (i = 0; i < count; i++) {
> reg = regulator_get_optional(dev, names[i]);
> if (IS_ERR(reg)) {
> - ret = PTR_ERR(reg);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "%s: no regulator (%s) found: %d\n",
> - __func__, names[i], ret);
> + ret = dev_err_probe(dev, PTR_ERR(reg),
> + "%s: no regulator (%s) found\n",
> + __func__, names[i]);
> goto free_regulators;
> }
>
> @@ -2179,11 +2178,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name)
> /* Find clk for the device */
> opp_table->clk = clk_get(dev, name);
> if (IS_ERR(opp_table->clk)) {
> - ret = PTR_ERR(opp_table->clk);
> - if (ret != -EPROBE_DEFER) {
> - dev_err(dev, "%s: Couldn't find clock: %d\n", __func__,
> - ret);
> - }
> + ret = dev_err_probe(dev, PTR_ERR(opp_table->clk),
> + "%s: Couldn't find clock\n", __func__);
> goto err;
> }
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-11 2:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08 11:10 [PATCH] PM: opp: simplify with dev_err_probe() Krzysztof Kozlowski
2022-04-11 2:53 ` Viresh Kumar
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).