opp: Don't print error message if getting optional regulator fails
PATCH 1/1 opp: Don't print error message if getting optional regulator fails
The regulators are optional, therefore I see no need to bother users with an error level message if -ENODEV is returned.
Inspiration was the following error on my system:
lima d00c0000.gpu: dev_pm_opp_set_regulators: no regulator (mali) found: -19
--- drivers/opp/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/opp/core.c +4 -1
@@ -2020,7 +2020,10 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, reg =regulator_get_optional (dev, names[i]);if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) +if (ret == -ENODEV ) +dev_info (dev,"%s: no regulator (%s) found\n" , + __func__, names[i]); +else if (ret != -EPROBE_DEFER )dev_err (dev,"%s: no regulator (%s) found: %d\n" , __func__, names[i], ret); goto free_regulators;
Signature · 1 line
2.35.1
drivers/opp/core.c struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
Quoted 16 lines · Heiner Kallweit
The regulators are optional, therefore I see no need to bother users with an error level message if
-ENODEVis returned.Inspiration was the following error on my system:
lima d00c0000.gpu:dev_pm_opp_set_regulators: no regulator (mali) found: -19Signed-off-by Heiner Kallweit <[email protected]>--- drivers/opp/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/opp/core.c +0
-0@@ -2020,7 +2020,10 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
If this API is called by the platform specific code, then the regulator should be compulsory. Isn't it ?
Maybe we shouldn't use regulator_get_optional() here.
Quoted 11 lines
drivers/opp/core.c +4
-1reg =regulator_get_optional (dev, names[i]);if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) +if (ret == -ENODEV ) +dev_info (dev,"%s: no regulator (%s) found\n" , + __func__, names[i]); +else if (ret != -EPROBE_DEFER )dev_err (dev,"%s: no regulator (%s) found: %d\n" , __func__, names[i], ret); goto free_regulators;
Signature · 1 line
viresh
Quoted 21 lines · Viresh Kumar
drivers/opp/core.c struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
Quoted 16 lines · Heiner Kallweit
The regulators are optional, therefore I see no need to bother users with an error level message if
-ENODEVis returned.Inspiration was the following error on my system:
lima d00c0000.gpu:dev_pm_opp_set_regulators: no regulator (mali) found: -19Signed-off-by Heiner Kallweit <[email protected]>--- drivers/opp/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/opp/core.c +0
-0@@ -2020,7 +2020,10 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,If this API is called by the platform specific code, then the regulator should be compulsory. Isn't it ?
Quoted 2 lines
Maybe we shouldn't use
regulator_get_optional()here.
There are two types of users of dev(m)_pm_opp_set_regulators():
1. Caller ignores -ENODEV and goes on.
2. Caller treats -ENODEV like any other error and bails out.
For type 1 callers a missing regulator should not result in an error message. Switching to regulator_get() wouldn't be too nice because then a missing regulator would result in the dummy regulator being used. This would create a related warning and a functional change that may break something.
Type 2 callers still have the option to print an own error message in case of -ENODEV. AFAICS all of them do so already.
Quoted 12 lines
Quoted 11 lines
drivers/opp/core.c +4
-1reg =regulator_get_optional (dev, names[i]);if (IS_ERR (reg)) { ret =PTR_ERR (reg); -if (ret != -EPROBE_DEFER ) +if (ret == -ENODEV ) +dev_info (dev,"%s: no regulator (%s) found\n" , + __func__, names[i]); +else if (ret != -EPROBE_DEFER )dev_err (dev,"%s: no regulator (%s) found: %d\n" , __func__, names[i], ret); goto free_regulators;
Quoted 2 lines · Heiner Kallweit
There are two types of users of dev(m)_pm_opp_set_regulators():
1. Caller ignores-ENODEVand goes on.
This is abuse of the API as far as I can tell. If the OPP core was doing something like this automatically for everyone, then we can agree that missing regulator isn't necessarily a problem.
But in this case the platforms (lima and panfrost) are asking explicitly to get the regulators added. To me this is a plain and simple error.
Take cpufreq-dt for example, it makes sure beforehand if the supply is available or not, and then only calls this API.
Quoted 7 lines
For type 1 callers a missing regulator should not result in an error message. Switching to
regulator_get()wouldn't be too nice because then a missing regulator would result in the dummy regulator being used. This would create a related warning and a functional change that may break something.Type 2 callers still have the option to print an own error message in case of
-ENODEV. AFAICS all of them do so already.
Signature · 1 line
viresh