* Re: [PATCH] opp: Don't ignore clk_get() errors other than -ENODEV
[not found] ` <49983ca1-feb3-48f5-bdf5-b2f39c963a74@gmail.com>
@ 2021-01-29 17:46 ` Viresh Kumar
2021-01-29 19:26 ` Dmitry Osipenko
0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2021-01-29 17:46 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, linux-pm,
Vincent Guittot, Rafael Wysocki, linux-kernel
On 29-01-21, 18:23, Dmitry Osipenko wrote:
> 29.01.2021 13:51, Viresh Kumar пишет:
> > Not all devices that need to use OPP core need to have clocks, a missing
> > clock is fine in which case -ENODEV shall be returned by clk_get().
> >
> > Anything else is an error and must be handled properly.
> >
> > Reported-by: Dmitry Osipenko <digetx@gmail.com>
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> > Stephen, is the understanding correct that -ENODEV is the only error
> > returned for missing clocks ?
> >
> > Dmitry: I hope this is on the lines of what you were looking for ?
>
> Viresh, thank you! This is not what I was looking for because clk core
> doesn't return -ENODEV for a missing clock, but -ENOENT. The ENODEV
> certainly should break drivers.
My bad.
> I was looking for this:
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 0305861fee1b..3dd9cdbc0e75 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1264,7 +1264,7 @@ static struct opp_table
> *_update_opp_table_clk(struct device *dev,
> if (IS_ERR(opp_table->clk)) {
> int ret = PTR_ERR(opp_table->clk);
>
> - if (ret == -EPROBE_DEFER) {
> + if (ret != -ENOENT) {
> dev_pm_opp_put_opp_table(opp_table);
> return ERR_PTR(ret);
> }
You should be looking for this instead, isn't it ?
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 049d45e70807..4bfcbe5b57af 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1268,7 +1268,7 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
if (!ret)
return opp_table;
- if (ret == -ENODEV) {
+ if (ret == -ENOENT) {
dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
return opp_table;
}
--
viresh
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] opp: Don't ignore clk_get() errors other than -ENODEV
2021-01-29 17:46 ` [PATCH] opp: Don't ignore clk_get() errors other than -ENODEV Viresh Kumar
@ 2021-01-29 19:26 ` Dmitry Osipenko
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Osipenko @ 2021-01-29 19:26 UTC (permalink / raw)
To: Viresh Kumar
Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, linux-pm,
Vincent Guittot, Rafael Wysocki, linux-kernel
29.01.2021 20:46, Viresh Kumar пишет:
> On 29-01-21, 18:23, Dmitry Osipenko wrote:
>> 29.01.2021 13:51, Viresh Kumar пишет:
>>> Not all devices that need to use OPP core need to have clocks, a missing
>>> clock is fine in which case -ENODEV shall be returned by clk_get().
>>>
>>> Anything else is an error and must be handled properly.
>>>
>>> Reported-by: Dmitry Osipenko <digetx@gmail.com>
>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>> ---
>>> Stephen, is the understanding correct that -ENODEV is the only error
>>> returned for missing clocks ?
>>>
>>> Dmitry: I hope this is on the lines of what you were looking for ?
>>
>> Viresh, thank you! This is not what I was looking for because clk core
>> doesn't return -ENODEV for a missing clock, but -ENOENT. The ENODEV
>> certainly should break drivers.
>
> My bad.
>
>> I was looking for this:
>>
>> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
>> index 0305861fee1b..3dd9cdbc0e75 100644
>> --- a/drivers/opp/core.c
>> +++ b/drivers/opp/core.c
>> @@ -1264,7 +1264,7 @@ static struct opp_table
>> *_update_opp_table_clk(struct device *dev,
>> if (IS_ERR(opp_table->clk)) {
>> int ret = PTR_ERR(opp_table->clk);
>>
>> - if (ret == -EPROBE_DEFER) {
>> + if (ret != -ENOENT) {
>> dev_pm_opp_put_opp_table(opp_table);
>> return ERR_PTR(ret);
>> }
>
> You should be looking for this instead, isn't it ?
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 049d45e70807..4bfcbe5b57af 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1268,7 +1268,7 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
> if (!ret)
> return opp_table;
>
> - if (ret == -ENODEV) {
> + if (ret == -ENOENT) {
> dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
> return opp_table;
> }
>
>
This will work too.
Then also could be better to replace the "if (ret != -EPROBE_DEFER)"
with dev_err_probe(..).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-29 19:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <28d24b4c5b9ceabbd32b7b312dee050992610be9.1611917396.git.viresh.kumar@linaro.org>
[not found] ` <49983ca1-feb3-48f5-bdf5-b2f39c963a74@gmail.com>
2021-01-29 17:46 ` [PATCH] opp: Don't ignore clk_get() errors other than -ENODEV Viresh Kumar
2021-01-29 19:26 ` Dmitry Osipenko
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).