* [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled
@ 2023-04-25 10:04 Xingyu Wu
2023-04-25 14:06 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Xingyu Wu @ 2023-04-25 10:04 UTC (permalink / raw)
To: linux-watchdog, Wim Van Sebroeck, Guenter Roeck
Cc: Xingyu Wu, Samin Guo, linux-kernel
When the starfive watchdog driver uses 'pm_runtime_put_sync()' as probe
return value at last and 'early_enable' is disabled, it could return the
error '-ENOSYS' if the CONFIG_PM is disabled, but the driver should works
normally.
Add a check to make sure the PM is enabled and then use
'pm_runtime_put_sync()' as return value when 'early_enable' is disabled.
Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver")
Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
---
Hi, Guenter and Wim,
This patch fixes the issue of StarFive watchdog driver and rebases on
the master branch of linux-next.
Thanks.
---
drivers/watchdog/starfive-wdt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
index 1995cceca51e..51e487e09960 100644
--- a/drivers/watchdog/starfive-wdt.c
+++ b/drivers/watchdog/starfive-wdt.c
@@ -492,7 +492,8 @@ static int starfive_wdt_probe(struct platform_device *pdev)
goto err_exit;
if (!early_enable)
- return pm_runtime_put_sync(&pdev->dev);
+ if (pm_runtime_enabled(&pdev->dev))
+ return pm_runtime_put_sync(&pdev->dev);
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled
2023-04-25 10:04 [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled Xingyu Wu
@ 2023-04-25 14:06 ` Guenter Roeck
2023-04-26 1:49 ` Xingyu Wu
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2023-04-25 14:06 UTC (permalink / raw)
To: Xingyu Wu, linux-watchdog, Wim Van Sebroeck; +Cc: Samin Guo, linux-kernel
On 4/25/23 03:04, Xingyu Wu wrote:
> When the starfive watchdog driver uses 'pm_runtime_put_sync()' as probe
> return value at last and 'early_enable' is disabled, it could return the
> error '-ENOSYS' if the CONFIG_PM is disabled, but the driver should works
> normally.
>
> Add a check to make sure the PM is enabled and then use
> 'pm_runtime_put_sync()' as return value when 'early_enable' is disabled.
>
> Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver")
> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
> ---
>
> Hi, Guenter and Wim,
>
> This patch fixes the issue of StarFive watchdog driver and rebases on
> the master branch of linux-next.
>
> Thanks.
>
> ---
> drivers/watchdog/starfive-wdt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 1995cceca51e..51e487e09960 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -492,7 +492,8 @@ static int starfive_wdt_probe(struct platform_device *pdev)
> goto err_exit;
>
> if (!early_enable)
> - return pm_runtime_put_sync(&pdev->dev);
> + if (pm_runtime_enabled(&pdev->dev))
> + return pm_runtime_put_sync(&pdev->dev);
>
Why not just
if (!early_enable)
pm_runtime_put_sync(&pdev->dev)
like almost every other caller of pm_runtime_put_sync() ?
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled
2023-04-25 14:06 ` Guenter Roeck
@ 2023-04-26 1:49 ` Xingyu Wu
2023-04-26 2:01 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Xingyu Wu @ 2023-04-26 1:49 UTC (permalink / raw)
To: Guenter Roeck, linux-watchdog, Wim Van Sebroeck; +Cc: Samin Guo, linux-kernel
On 2023/4/25 22:06, Guenter Roeck wrote:
> On 4/25/23 03:04, Xingyu Wu wrote:
>> When the starfive watchdog driver uses 'pm_runtime_put_sync()' as probe
>> return value at last and 'early_enable' is disabled, it could return the
>> error '-ENOSYS' if the CONFIG_PM is disabled, but the driver should works
>> normally.
>>
>> Add a check to make sure the PM is enabled and then use
>> 'pm_runtime_put_sync()' as return value when 'early_enable' is disabled.
>>
>> Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver")
>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>> ---
>>
>> Hi, Guenter and Wim,
>>
>> This patch fixes the issue of StarFive watchdog driver and rebases on
>> the master branch of linux-next.
>>
>> Thanks.
>> ---
>> drivers/watchdog/starfive-wdt.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
>> index 1995cceca51e..51e487e09960 100644
>> --- a/drivers/watchdog/starfive-wdt.c
>> +++ b/drivers/watchdog/starfive-wdt.c
>> @@ -492,7 +492,8 @@ static int starfive_wdt_probe(struct platform_device *pdev)
>> goto err_exit;
>> if (!early_enable)
>> - return pm_runtime_put_sync(&pdev->dev);
>> + if (pm_runtime_enabled(&pdev->dev))
>> + return pm_runtime_put_sync(&pdev->dev);
>>
>
> Why not just
>
> if (!early_enable)
> pm_runtime_put_sync(&pdev->dev)
>
> like almost every other caller of pm_runtime_put_sync() ?
>
The function of pm_runtime_put_sync() is that:
static inline int pm_runtime_put_sync(struct device *dev)
{
return __pm_runtime_idle(dev, RPM_GET_PUT);
}
and when do not enable CONFIG_PM, the __pm_runtime_idle() is that:
static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
{
return -ENOSYS;
}
If I do not open PM, it will return error saying probe failed
but it works fine without PM. I had tested that and probe really
was failed. So I should add this check before using pm_runtime_put_sync().
Best regards,
Xingyu Wu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled
2023-04-26 1:49 ` Xingyu Wu
@ 2023-04-26 2:01 ` Guenter Roeck
2023-04-26 2:44 ` Xingyu Wu
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2023-04-26 2:01 UTC (permalink / raw)
To: Xingyu Wu, linux-watchdog, Wim Van Sebroeck; +Cc: Samin Guo, linux-kernel
On 4/25/23 18:49, Xingyu Wu wrote:
> On 2023/4/25 22:06, Guenter Roeck wrote:
>> On 4/25/23 03:04, Xingyu Wu wrote:
>>> When the starfive watchdog driver uses 'pm_runtime_put_sync()' as probe
>>> return value at last and 'early_enable' is disabled, it could return the
>>> error '-ENOSYS' if the CONFIG_PM is disabled, but the driver should works
>>> normally.
>>>
>>> Add a check to make sure the PM is enabled and then use
>>> 'pm_runtime_put_sync()' as return value when 'early_enable' is disabled.
>>>
>>> Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver")
>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>> ---
>>>
>>> Hi, Guenter and Wim,
>>>
>>> This patch fixes the issue of StarFive watchdog driver and rebases on
>>> the master branch of linux-next.
>>>
>>> Thanks.
>>> ---
>>> drivers/watchdog/starfive-wdt.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
>>> index 1995cceca51e..51e487e09960 100644
>>> --- a/drivers/watchdog/starfive-wdt.c
>>> +++ b/drivers/watchdog/starfive-wdt.c
>>> @@ -492,7 +492,8 @@ static int starfive_wdt_probe(struct platform_device *pdev)
>>> goto err_exit;
>>> if (!early_enable)
>>> - return pm_runtime_put_sync(&pdev->dev);
>>> + if (pm_runtime_enabled(&pdev->dev))
>>> + return pm_runtime_put_sync(&pdev->dev);
>>>
>>
>> Why not just
>>
>> if (!early_enable)
>> pm_runtime_put_sync(&pdev->dev)
>>
>> like almost every other caller of pm_runtime_put_sync() ?
>>
>
> The function of pm_runtime_put_sync() is that:
>
> static inline int pm_runtime_put_sync(struct device *dev)
> {
> return __pm_runtime_idle(dev, RPM_GET_PUT);
> }
>
> and when do not enable CONFIG_PM, the __pm_runtime_idle() is that:
>
> static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
> {
> return -ENOSYS;
> }
>
> If I do not open PM, it will return error saying probe failed
> but it works fine without PM. I had tested that and probe really
> was failed. So I should add this check before using pm_runtime_put_sync().
>
You did not answer my question.
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled
2023-04-26 2:01 ` Guenter Roeck
@ 2023-04-26 2:44 ` Xingyu Wu
0 siblings, 0 replies; 5+ messages in thread
From: Xingyu Wu @ 2023-04-26 2:44 UTC (permalink / raw)
To: Guenter Roeck, linux-watchdog, Wim Van Sebroeck; +Cc: Samin Guo, linux-kernel
On 2023/4/26 10:01, Guenter Roeck wrote:
> On 4/25/23 18:49, Xingyu Wu wrote:
>> On 2023/4/25 22:06, Guenter Roeck wrote:
>>> On 4/25/23 03:04, Xingyu Wu wrote:
>>>> When the starfive watchdog driver uses 'pm_runtime_put_sync()' as probe
>>>> return value at last and 'early_enable' is disabled, it could return the
>>>> error '-ENOSYS' if the CONFIG_PM is disabled, but the driver should works
>>>> normally.
>>>>
>>>> Add a check to make sure the PM is enabled and then use
>>>> 'pm_runtime_put_sync()' as return value when 'early_enable' is disabled.
>>>>
>>>> Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver")
>>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>>> ---
>>>>
>>>> Hi, Guenter and Wim,
>>>>
>>>> This patch fixes the issue of StarFive watchdog driver and rebases on
>>>> the master branch of linux-next.
>>>>
>>>> Thanks.
>>>> ---
>>>> drivers/watchdog/starfive-wdt.c | 3 ++-
>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
>>>> index 1995cceca51e..51e487e09960 100644
>>>> --- a/drivers/watchdog/starfive-wdt.c
>>>> +++ b/drivers/watchdog/starfive-wdt.c
>>>> @@ -492,7 +492,8 @@ static int starfive_wdt_probe(struct platform_device *pdev)
>>>> goto err_exit;
>>>> if (!early_enable)
>>>> - return pm_runtime_put_sync(&pdev->dev);
>>>> + if (pm_runtime_enabled(&pdev->dev))
>>>> + return pm_runtime_put_sync(&pdev->dev);
>>>>
>>>
>>> Why not just
>>>
>>> if (!early_enable)
>>> pm_runtime_put_sync(&pdev->dev)
>>>
>>> like almost every other caller of pm_runtime_put_sync() ?
>>>
>>
>> The function of pm_runtime_put_sync() is that:
>>
>> static inline int pm_runtime_put_sync(struct device *dev)
>> {
>> return __pm_runtime_idle(dev, RPM_GET_PUT);
>> }
>>
>> and when do not enable CONFIG_PM, the __pm_runtime_idle() is that:
>>
>> static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
>> {
>> return -ENOSYS;
>> }
>>
>> If I do not open PM, it will return error saying probe failed
>> but it works fine without PM. I had tested that and probe really
>> was failed. So I should add this check before using pm_runtime_put_sync().
>>
>
> You did not answer my question.
>
Oh sorry, I did not notice that you dropped the 'return'. It looks simpler.
Best regards,
Xingyu Wu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-26 2:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 10:04 [PATCH v1] watchdog: starfive: Fix the probe return error if PM and early_enable are both disabled Xingyu Wu
2023-04-25 14:06 ` Guenter Roeck
2023-04-26 1:49 ` Xingyu Wu
2023-04-26 2:01 ` Guenter Roeck
2023-04-26 2:44 ` Xingyu Wu
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).