2021-08-12 11:29:36

by Rajendra Nayak

[permalink] [raw]
Subject: [PATCH v7 1/3] opp: Don't print an error if required-opps is missing

The 'required-opps' property is considered optional, hence remove
the pr_err() in of_parse_required_opp() when we find the property is
missing.
While at it, also fix the return value of
of_get_required_opp_performance_state() when of_parse_required_opp()
fails, return a -ENODEV instead of the -EINVAL.

Signed-off-by: Rajendra Nayak <[email protected]>
---
drivers/opp/of.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index d298e38..9bdabad 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -95,15 +95,7 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table,
static struct device_node *of_parse_required_opp(struct device_node *np,
int index)
{
- struct device_node *required_np;
-
- required_np = of_parse_phandle(np, "required-opps", index);
- if (unlikely(!required_np)) {
- pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n",
- __func__, np, index);
- }
-
- return required_np;
+ return of_parse_phandle(np, "required-opps", index);
}

/* The caller must call dev_pm_opp_put_opp_table() after the table is used */
@@ -1327,7 +1319,7 @@ int of_get_required_opp_performance_state(struct device_node *np, int index)

required_np = of_parse_required_opp(np, index);
if (!required_np)
- return -EINVAL;
+ return -ENODEV;

opp_table = _find_table_of_opp_np(required_np);
if (IS_ERR(opp_table)) {
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


2021-08-12 14:41:19

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] opp: Don't print an error if required-opps is missing

On Thu, 12 Aug 2021 at 13:27, Rajendra Nayak <[email protected]> wrote:
>
> The 'required-opps' property is considered optional, hence remove
> the pr_err() in of_parse_required_opp() when we find the property is
> missing.
> While at it, also fix the return value of
> of_get_required_opp_performance_state() when of_parse_required_opp()
> fails, return a -ENODEV instead of the -EINVAL.
>
> Signed-off-by: Rajendra Nayak <[email protected]>

Reviewed-by: Ulf Hansson <[email protected]>

Kind regards
Uffe


> ---
> drivers/opp/of.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index d298e38..9bdabad 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -95,15 +95,7 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table,
> static struct device_node *of_parse_required_opp(struct device_node *np,
> int index)
> {
> - struct device_node *required_np;
> -
> - required_np = of_parse_phandle(np, "required-opps", index);
> - if (unlikely(!required_np)) {
> - pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n",
> - __func__, np, index);
> - }
> -
> - return required_np;
> + return of_parse_phandle(np, "required-opps", index);
> }
>
> /* The caller must call dev_pm_opp_put_opp_table() after the table is used */
> @@ -1327,7 +1319,7 @@ int of_get_required_opp_performance_state(struct device_node *np, int index)
>
> required_np = of_parse_required_opp(np, index);
> if (!required_np)
> - return -EINVAL;
> + return -ENODEV;
>
> opp_table = _find_table_of_opp_np(required_np);
> if (IS_ERR(opp_table)) {
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>

2021-08-13 04:46:24

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] opp: Don't print an error if required-opps is missing

On 12-08-21, 16:57, Rajendra Nayak wrote:
> The 'required-opps' property is considered optional, hence remove
> the pr_err() in of_parse_required_opp() when we find the property is
> missing.
> While at it, also fix the return value of
> of_get_required_opp_performance_state() when of_parse_required_opp()
> fails, return a -ENODEV instead of the -EINVAL.
>
> Signed-off-by: Rajendra Nayak <[email protected]>
> ---
> drivers/opp/of.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)

Acked-by: Viresh Kumar <[email protected]>

--
viresh