Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: Tero Kristo <t-kristo@kernel.org>,
	<linux-watchdog@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <afd@ti.com>,
	<n-francis@ti.com>
Subject: Re: [PATCH 1/2] watchdog: rti_wdt: Use managed APIs to handle runtime PM
Date: Tue, 21 Nov 2023 09:30:34 +0530	[thread overview]
Message-ID: <0f3277cc-0e4a-42c9-920c-87e1e6d6c0ca@ti.com> (raw)
In-Reply-To: <40590367-0a38-4c4c-a608-1174a5ecd5ae@roeck-us.net>

Hi,

On 10/11/23 20:33, Guenter Roeck wrote:
> On 11/10/23 02:07, Vignesh Raghavendra wrote:
>> Switch to devm_pm_runtime_enable() to simplify error handling in driver
>> probe.
>>
> 
> This also replaces the call to pm_runtime_resume_and_get() without
> explanation.
> Worse, the next patch conditionally re-introduces pm_runtime_put_sync()
> on the probe function.
> 
>> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
>> ---
>>   drivers/watchdog/rti_wdt.c | 30 ++++++++----------------------
>>   1 file changed, 8 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
>> index 8e1be7ba0103..163bdeb6929a 100644
>> --- a/drivers/watchdog/rti_wdt.c
>> +++ b/drivers/watchdog/rti_wdt.c
>> @@ -236,12 +236,8 @@ static int rti_wdt_probe(struct platform_device
>> *pdev)
>>       if (wdt->freq < 32768)
>>           wdt->freq = wdt->freq * 9 / 10;
>>   -    pm_runtime_enable(dev);
>> -    ret = pm_runtime_resume_and_get(dev);
>> -    if (ret < 0) {
>> -        pm_runtime_disable(&pdev->dev);
>> -        return dev_err_probe(dev, ret, "runtime pm failed\n");
>> -    }
>> +    devm_pm_runtime_enable(dev);
> 
> devm_pm_runtime_enable() returns an error code. I don't think ignoring it
> is a good idea.
> 


Oops, yes...

>> +    pm_runtime_get_noresume(dev);
> 
> Is this functionally identical to pm_runtime_resume_and_get() ?
> That would require further explanation. Why is it not necessary
> to resume here ?

include/linux/pm_runtime.h ::
 pm_runtime_resume_and_get - Bump up usage counter of a device and
resume it.

vs

pm_runtime_get_noresume - Bump up runtime PM usage counter of a device.

During probe, device is already active. Hence, there is really no need
to call driver level runtime_resume() callback as there is really no
context to resume from. Driver currently doesnt have runtime_pm calls
which I intend to add as a later patch. I guess, its probably better to
move this patch to same series.

Also, missed a call to pm_runtime_put_noidle() in the error path.


So for now I will respin 2/2 as standalone fix and repost along with
runtime_pm support.

Apologies, for the delayed response!

-- 
Regards
Vignesh

  reply	other threads:[~2023-11-21  4:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 10:07 [PATCH 0/2] watchdog: rti_wdt: Disable module when unused Vignesh Raghavendra
2023-11-10 10:07 ` [PATCH 1/2] watchdog: rti_wdt: Use managed APIs to handle runtime PM Vignesh Raghavendra
2023-11-10 15:03   ` Guenter Roeck
2023-11-21  4:00     ` Vignesh Raghavendra [this message]
2023-11-10 10:07 ` [PATCH 2/2] watchdog: rti_wdt: Drop RPM watchdog when unused Vignesh Raghavendra
2023-11-10 15:05   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f3277cc-0e4a-42c9-920c-87e1e6d6c0ca@ti.com \
    --to=vigneshr@ti.com \
    --cc=afd@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=n-francis@ti.com \
    --cc=t-kristo@kernel.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).