Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow
@ 2019-09-06 20:30 Jorge Ramirez-Ortiz
  2019-09-06 20:30 ` [PATCH 2/2] watchdog: pm8916_wdt: fix missing include Jorge Ramirez-Ortiz
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-09-06 20:30 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, wim, linux
  Cc: linux-watchdog, linux-kernel, bjorn.andersson

When an IRQ is present in the dts, the probe function shall fail if
the interrupt can not be registered.

The probe function shall also be retried if getting the irq is being
deferred.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/watchdog/pm8916_wdt.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c
index 2d3652004e39..cb5304c26ac3 100644
--- a/drivers/watchdog/pm8916_wdt.c
+++ b/drivers/watchdog/pm8916_wdt.c
@@ -163,9 +163,18 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq > 0) {
-		if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",
-				     wdt))
-			irq = 0;
+		err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
+				       "pm8916_wdt", wdt);
+		if (err)
+			return err;
+
+		wdt->wdev.info = &pm8916_wdt_pt_ident;
+
+	} else {
+		if (irq == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+
+		wdt->wdev.info = &pm8916_wdt_ident;
 	}
 
 	/* Configure watchdog to hard-reset mode */
@@ -177,7 +186,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
 	wdt->wdev.ops = &pm8916_wdt_ops,
 	wdt->wdev.parent = dev;
 	wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;
-- 
2.23.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] watchdog: pm8916_wdt: fix missing include
  2019-09-06 20:30 [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Jorge Ramirez-Ortiz
@ 2019-09-06 20:30 ` Jorge Ramirez-Ortiz
  2019-09-08 22:54   ` Guenter Roeck
  2019-09-08 22:50 ` [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Guenter Roeck
  2019-09-13 12:52 ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-09-06 20:30 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, wim, linux
  Cc: linux-watchdog, linux-kernel, bjorn.andersson

As per Documentation/process/submit-checklist.rst, when using  a
facility #include the file that defines/declares  that facility.

Don't depend on other header files pulling in ones that you use.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/watchdog/pm8916_wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c
index cb5304c26ac3..b8d9df0f96f7 100644
--- a/drivers/watchdog/pm8916_wdt.c
+++ b/drivers/watchdog/pm8916_wdt.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/bitops.h>
+#include <linux/bits.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-- 
2.23.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow
  2019-09-06 20:30 [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Jorge Ramirez-Ortiz
  2019-09-06 20:30 ` [PATCH 2/2] watchdog: pm8916_wdt: fix missing include Jorge Ramirez-Ortiz
@ 2019-09-08 22:50 ` Guenter Roeck
       [not found]   ` <CAMZdPi-P_AopbbyJEWDbnm7X8MtxTzs=MN13+UFndL2OK5VReg@mail.gmail.com>
  2019-09-13 12:52 ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2019-09-08 22:50 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, wim
  Cc: linux-watchdog, linux-kernel, bjorn.andersson, Loic Poulain

On 9/6/19 1:30 PM, Jorge Ramirez-Ortiz wrote:
> When an IRQ is present in the dts, the probe function shall fail if
> the interrupt can not be registered.
> 

The author intended differently, and did not want registration to fail
in this situation, following the logic that it is better to have a
standard watchdog without pretimeout than no watchdog at all.

Copying the author; I am not inclined to accept such a change without
input from the driver author.

Similar, for the deferred probe, we'll need to know from the driver author
if this is a concern. In general it is, but there are cases where
-EPROBE_DEFFER is never returned in practice (eg for some SoC watchdog
drivers).

Guenter

> The probe function shall also be retried if getting the irq is being
> deferred.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>   drivers/watchdog/pm8916_wdt.c | 16 ++++++++++++----
>   1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c
> index 2d3652004e39..cb5304c26ac3 100644
> --- a/drivers/watchdog/pm8916_wdt.c
> +++ b/drivers/watchdog/pm8916_wdt.c
> @@ -163,9 +163,18 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
>   
>   	irq = platform_get_irq(pdev, 0);
>   	if (irq > 0) {
> -		if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",
> -				     wdt))
> -			irq = 0;
> +		err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
> +				       "pm8916_wdt", wdt);
> +		if (err)
> +			return err;
> +
> +		wdt->wdev.info = &pm8916_wdt_pt_ident;
> +
> +	} else {
> +		if (irq == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		wdt->wdev.info = &pm8916_wdt_ident;
>   	}
>   
>   	/* Configure watchdog to hard-reset mode */
> @@ -177,7 +186,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
>   		return err;
>   	}
>   
> -	wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
>   	wdt->wdev.ops = &pm8916_wdt_ops,
>   	wdt->wdev.parent = dev;
>   	wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] watchdog: pm8916_wdt: fix missing include
  2019-09-06 20:30 ` [PATCH 2/2] watchdog: pm8916_wdt: fix missing include Jorge Ramirez-Ortiz
@ 2019-09-08 22:54   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2019-09-08 22:54 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz, wim; +Cc: linux-watchdog, linux-kernel, bjorn.andersson

On 9/6/19 1:30 PM, Jorge Ramirez-Ortiz wrote:
> As per Documentation/process/submit-checklist.rst, when using  a
> facility #include the file that defines/declares  that facility.
> 
> Don't depend on other header files pulling in ones that you use.
> 

Correct, but then also don't include header files you don't use.
In this case, the include of linux/bitops.h is no longer necessary
if linux/bits.h is included since the driver doesn't really use bit
operations, only bit masks.

Guenter

> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>   drivers/watchdog/pm8916_wdt.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c
> index cb5304c26ac3..b8d9df0f96f7 100644
> --- a/drivers/watchdog/pm8916_wdt.c
> +++ b/drivers/watchdog/pm8916_wdt.c
> @@ -1,5 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   #include <linux/bitops.h>
> +#include <linux/bits.h>
>   #include <linux/interrupt.h>
>   #include <linux/kernel.h>
>   #include <linux/module.h>
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow
       [not found]   ` <CAMZdPi-P_AopbbyJEWDbnm7X8MtxTzs=MN13+UFndL2OK5VReg@mail.gmail.com>
@ 2019-09-11 17:54     ` Guenter Roeck
  2019-09-13 10:36       ` Loic Poulain
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2019-09-11 17:54 UTC (permalink / raw)
  To: Loic Poulain
  Cc: Jorge Ramirez-Ortiz, wim, linux-watchdog, linux-kernel, Bjorn Andersson

On Wed, Sep 11, 2019 at 10:04:12AM +0200, Loic Poulain wrote:
> Hi Guenter, Jorge,
> 
> On Mon, 9 Sep 2019 at 00:50, Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > On 9/6/19 1:30 PM, Jorge Ramirez-Ortiz wrote:
> > > When an IRQ is present in the dts, the probe function shall fail if
> > > the interrupt can not be registered.
> > >
> >
> > The author intended differently, and did not want registration to fail
> > in this situation, following the logic that it is better to have a
> > standard watchdog without pretimeout than no watchdog at all.
> >
> 
> Indeed, but I tend to agree with this change since it aligns behavior with
> other
> watchdog drivers and I assume there is a serious issue if request_irq fails.
> I suggest adding a dev_err message in such case.
> 
> Copying the author; I am not inclined to accept such a change without
> > input from the driver author.
> >
> > Similar, for the deferred probe, we'll need to know from the driver author
> > if this is a concern. In general it is, but there are cases where
> > -EPROBE_DEFFER is never returned in practice (eg for some SoC watchdog
> > drivers).
> >
> 
> The IRQ controller is the SPMI bus parent node whose driver (MFD_SPMI_PMIC)
> is a direct dependency of pm8916_wdt. I'm not sure in which scenario this
> could
> happen.
> 
Not sure what the action item is. Accept the patch as-is (Reviewed-by
appreciated), or resubmit without the -EPROBE_DEFER check ?

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow
  2019-09-11 17:54     ` Guenter Roeck
@ 2019-09-13 10:36       ` Loic Poulain
  0 siblings, 0 replies; 7+ messages in thread
From: Loic Poulain @ 2019-09-13 10:36 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Jorge Ramirez-Ortiz, wim, linux-watchdog, linux-kernel, Bjorn Andersson

On Wed, 11 Sep 2019 at 19:54, Guenter Roeck <linux@roeck-us.net> wrote:
>
> On Wed, Sep 11, 2019 at 10:04:12AM +0200, Loic Poulain wrote:
> > Hi Guenter, Jorge,
> >
> > On Mon, 9 Sep 2019 at 00:50, Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > > On 9/6/19 1:30 PM, Jorge Ramirez-Ortiz wrote:
> > > > When an IRQ is present in the dts, the probe function shall fail if
> > > > the interrupt can not be registered.
> > > >
> > >
> > > The author intended differently, and did not want registration to fail
> > > in this situation, following the logic that it is better to have a
> > > standard watchdog without pretimeout than no watchdog at all.
> > >
> >
> > Indeed, but I tend to agree with this change since it aligns behavior with
> > other
> > watchdog drivers and I assume there is a serious issue if request_irq fails.
> > I suggest adding a dev_err message in such case.
> >
> > Copying the author; I am not inclined to accept such a change without
> > > input from the driver author.
> > >
> > > Similar, for the deferred probe, we'll need to know from the driver author
> > > if this is a concern. In general it is, but there are cases where
> > > -EPROBE_DEFFER is never returned in practice (eg for some SoC watchdog
> > > drivers).
> > >
> >
> > The IRQ controller is the SPMI bus parent node whose driver (MFD_SPMI_PMIC)
> > is a direct dependency of pm8916_wdt. I'm not sure in which scenario this
> > could
> > happen.
> >
> Not sure what the action item is. Accept the patch as-is (Reviewed-by
> appreciated), or resubmit without the -EPROBE_DEFER check ?

Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow
  2019-09-06 20:30 [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Jorge Ramirez-Ortiz
  2019-09-06 20:30 ` [PATCH 2/2] watchdog: pm8916_wdt: fix missing include Jorge Ramirez-Ortiz
  2019-09-08 22:50 ` [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Guenter Roeck
@ 2019-09-13 12:52 ` Guenter Roeck
  2 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2019-09-13 12:52 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz; +Cc: wim, linux-watchdog, linux-kernel, bjorn.andersson

On Fri, Sep 06, 2019 at 10:30:53PM +0200, Jorge Ramirez-Ortiz wrote:
> When an IRQ is present in the dts, the probe function shall fail if
> the interrupt can not be registered.
> 
> The probe function shall also be retried if getting the irq is being
> deferred.
> 
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

with nitpick below.

> ---
>  drivers/watchdog/pm8916_wdt.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c
> index 2d3652004e39..cb5304c26ac3 100644
> --- a/drivers/watchdog/pm8916_wdt.c
> +++ b/drivers/watchdog/pm8916_wdt.c
> @@ -163,9 +163,18 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
>  
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq > 0) {
> -		if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",
> -				     wdt))
> -			irq = 0;
> +		err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
> +				       "pm8916_wdt", wdt);
> +		if (err)
> +			return err;
> +
> +		wdt->wdev.info = &pm8916_wdt_pt_ident;
> +

Unnecessary empty line.

> +	} else {
> +		if (irq == -EPROBE_DEFER)
> +			return -EPROBE_DEFER;
> +
> +		wdt->wdev.info = &pm8916_wdt_ident;
>  	}
>  
>  	/* Configure watchdog to hard-reset mode */
> @@ -177,7 +186,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
>  	wdt->wdev.ops = &pm8916_wdt_ops,
>  	wdt->wdev.parent = dev;
>  	wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 20:30 [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Jorge Ramirez-Ortiz
2019-09-06 20:30 ` [PATCH 2/2] watchdog: pm8916_wdt: fix missing include Jorge Ramirez-Ortiz
2019-09-08 22:54   ` Guenter Roeck
2019-09-08 22:50 ` [PATCH 1/2] watchdog: pm8916_wdt: fix pretimeout registration flow Guenter Roeck
     [not found]   ` <CAMZdPi-P_AopbbyJEWDbnm7X8MtxTzs=MN13+UFndL2OK5VReg@mail.gmail.com>
2019-09-11 17:54     ` Guenter Roeck
2019-09-13 10:36       ` Loic Poulain
2019-09-13 12:52 ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org linux-watchdog@archiver.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/ public-inbox