linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework
@ 2015-10-08 21:34 Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 1/6] watchdog: at91sam9: use devm_request_irq instead of request_irq Sylvain Rochet
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

A little bit of trivial rework for both sama5d4 and at91sam9 drivers.

Sylvain Rochet (6):
  watchdog: at91sam9: use devm_request_irq instead of request_irq
  watchdog: at91sam9: use watchdog_get_drvdata instead of container_of
  watchdog: at91sam9: rename heartbeats into timeout where necessary
  watchdog: at91sam9: remove nowayout useless copy
  watchdog: at91sam9: remove unused pdata support
  watchdog: sama5d4: try to set timeout from device tree first

 drivers/watchdog/at91sam9_wdt.c | 48 +++++++++++++----------------------------
 drivers/watchdog/sama5d4_wdt.c  |  7 ++++--
 2 files changed, 20 insertions(+), 35 deletions(-)

-- 
2.5.1

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

* [PATCH 1/6] watchdog: at91sam9: use devm_request_irq instead of request_irq
  2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
@ 2015-10-08 21:34 ` Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of Sylvain Rochet
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

free_irq was missing in the module remove function, fix it by using
devm_request_irq instead of request_irq.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/at91sam9_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 434353a..88f56b5 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -209,7 +209,7 @@ static int at91_wdt_init(struct platform_device *pdev, struct at91wdt *wdt)
 			 "min heartbeat and max heartbeat might be too close for the system to handle it correctly\n");
 
 	if ((tmp & AT91_WDT_WDFIEN) && wdt->irq) {
-		err = request_irq(wdt->irq, wdt_interrupt,
+		err = devm_request_irq(&pdev->dev, wdt->irq, wdt_interrupt,
 				  IRQF_SHARED | IRQF_IRQPOLL |
 				  IRQF_NO_SUSPEND,
 				  pdev->name, wdt);
-- 
2.5.1

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

* [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of
  2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 1/6] watchdog: at91sam9: use devm_request_irq instead of request_irq Sylvain Rochet
@ 2015-10-08 21:34 ` Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 3/6] watchdog: at91sam9: rename heartbeats into timeout where necessary Sylvain Rochet
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

Use watchdog_get_drvdata instead of container_of.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/at91sam9_wdt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 88f56b5..8c1c9de 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -80,7 +80,6 @@ module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
 	"(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
-#define to_wdt(wdd) container_of(wdd, struct at91wdt, wdd)
 struct at91wdt {
 	struct watchdog_device wdd;
 	void __iomem *base;
@@ -134,7 +133,7 @@ static void at91_ping(unsigned long data)
 
 static int at91_wdt_start(struct watchdog_device *wdd)
 {
-	struct at91wdt *wdt = to_wdt(wdd);
+	struct at91wdt *wdt = watchdog_get_drvdata(wdd);
 	/* calculate when the next userspace timeout will be */
 	wdt->next_heartbeat = jiffies + wdd->timeout * HZ;
 	return 0;
@@ -349,6 +348,8 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	wdt->wdd.min_timeout = 1;
 	wdt->wdd.max_timeout = 0xFFFF;
 
+	watchdog_set_drvdata(&wdt->wdd, wdt);
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	wdt->base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(wdt->base))
-- 
2.5.1

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

* [PATCH 3/6] watchdog: at91sam9: rename heartbeats into timeout where necessary
  2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 1/6] watchdog: at91sam9: use devm_request_irq instead of request_irq Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of Sylvain Rochet
@ 2015-10-08 21:34 ` Sylvain Rochet
  2015-10-12 10:07   ` Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 4/6] watchdog: at91sam9: remove nowayout useless copy Sylvain Rochet
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

There is a confusing naming here, heartbeats is used instead of timeout
where the real meaning is timeout in various places.

Remove the unused WDT_TIMEOUT variable, which used to be a heartbeat
value. Rename WDT_HEARTBEAT into WDT_DEFAULT_TIMEOUT and rename
"heartbeats" into "timeout" in pr_ strings where necessary.

Rename the "enabled" in the watchdog welcome message ("enabled (timeout
= %d sec, nowayout = %d)\n") to "initialized", the watchdog user land
timeout and nowayout values are not used before userland starts to pat
the watchdog, reduce confusion by not telling those values are used
right now while there are not.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/at91sam9_wdt.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 8c1c9de..2c506e0 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -65,15 +65,13 @@
 /* Hardware timeout in seconds */
 #define WDT_HW_TIMEOUT 16
 
-/* Timer heartbeat (500ms) */
-#define WDT_TIMEOUT	(HZ/2)
+/* User land default timeout */
+#define WDT_DEFAULT_TIMEOUT 15
 
-/* User land timeout */
-#define WDT_HEARTBEAT 15
-static int heartbeat;
-module_param(heartbeat, int, 0);
-MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. "
-	"(default = " __MODULE_STRING(WDT_HEARTBEAT) ")");
+static int wdt_timeout = WDT_DEFAULT_TIMEOUT;
+module_param(wdt_timeout, int, 0);
+MODULE_PARM_DESC(wdt_timeout, "Watchdog timeout in seconds. "
+	"(default = " __MODULE_STRING(WDT_DEFAULT_TIMEOUT) ")");
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
@@ -234,7 +232,7 @@ static int at91_wdt_init(struct platform_device *pdev, struct at91wdt *wdt)
 
 	/* Try to set timeout from device tree first */
 	if (watchdog_init_timeout(&wdt->wdd, 0, dev))
-		watchdog_init_timeout(&wdt->wdd, heartbeat, dev);
+		watchdog_init_timeout(&wdt->wdd, wdt_timeout, dev);
 	watchdog_set_nowayout(&wdt->wdd, wdt->nowayout);
 	err = watchdog_register_device(&wdt->wdd);
 	if (err)
@@ -344,7 +342,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	wdt->wdd.parent = &pdev->dev;
 	wdt->wdd.info = &at91_wdt_info;
 	wdt->wdd.ops = &at91_wdt_ops;
-	wdt->wdd.timeout = WDT_HEARTBEAT;
+	wdt->wdd.timeout = wdt_timeout;
 	wdt->wdd.min_timeout = 1;
 	wdt->wdd.max_timeout = 0xFFFF;
 
@@ -377,7 +375,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, wdt);
 
-	pr_info("enabled (heartbeat=%d sec, nowayout=%d)\n",
+	pr_info("initialized (timeout=%d sec, nowayout=%d)\n",
 		wdt->wdd.timeout, wdt->nowayout);
 
 	return 0;
-- 
2.5.1

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

* [PATCH 4/6] watchdog: at91sam9: remove nowayout useless copy
  2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
                   ` (2 preceding siblings ...)
  2015-10-08 21:34 ` [PATCH 3/6] watchdog: at91sam9: rename heartbeats into timeout where necessary Sylvain Rochet
@ 2015-10-08 21:34 ` Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 5/6] watchdog: at91sam9: remove unused pdata support Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first Sylvain Rochet
  5 siblings, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

nowayout is a global variable set by module parameter, remove the
nowayout useless copy.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/at91sam9_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 2c506e0..8629f48 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -86,7 +86,6 @@ struct at91wdt {
 	u32 mr;
 	u32 mr_mask;
 	unsigned long heartbeat;	/* WDT heartbeat in jiffies */
-	bool nowayout;
 	unsigned int irq;
 	struct clk *sclk;
 };
@@ -233,7 +232,7 @@ static int at91_wdt_init(struct platform_device *pdev, struct at91wdt *wdt)
 	/* Try to set timeout from device tree first */
 	if (watchdog_init_timeout(&wdt->wdd, 0, dev))
 		watchdog_init_timeout(&wdt->wdd, wdt_timeout, dev);
-	watchdog_set_nowayout(&wdt->wdd, wdt->nowayout);
+	watchdog_set_nowayout(&wdt->wdd, nowayout);
 	err = watchdog_register_device(&wdt->wdd);
 	if (err)
 		goto out_stop_timer;
@@ -338,7 +337,6 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	wdt->mr = (WDT_HW_TIMEOUT * 256) | AT91_WDT_WDRSTEN | AT91_WDT_WDD |
 		  AT91_WDT_WDDBGHLT;
 	wdt->mr_mask = 0x3FFFFFFF;
-	wdt->nowayout = nowayout;
 	wdt->wdd.parent = &pdev->dev;
 	wdt->wdd.info = &at91_wdt_info;
 	wdt->wdd.ops = &at91_wdt_ops;
@@ -376,7 +374,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, wdt);
 
 	pr_info("initialized (timeout=%d sec, nowayout=%d)\n",
-		wdt->wdd.timeout, wdt->nowayout);
+		wdt->wdd.timeout, nowayout);
 
 	return 0;
 
-- 
2.5.1

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

* [PATCH 5/6] watchdog: at91sam9: remove unused pdata support
  2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
                   ` (3 preceding siblings ...)
  2015-10-08 21:34 ` [PATCH 4/6] watchdog: at91sam9: remove nowayout useless copy Sylvain Rochet
@ 2015-10-08 21:34 ` Sylvain Rochet
  2015-10-08 21:34 ` [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first Sylvain Rochet
  5 siblings, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

All SoC using this driver were converted to device tree. Remove pdata
support and initialization steps which are only used for pdata.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/at91sam9_wdt.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 8629f48..5d3e8c0 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -62,9 +62,6 @@
 /* Watchdog max delta/value in secs */
 #define WDT_COUNTER_MAX_SECS	ticks_to_secs(WDT_COUNTER_MAX_TICKS)
 
-/* Hardware timeout in seconds */
-#define WDT_HW_TIMEOUT 16
-
 /* User land default timeout */
 #define WDT_DEFAULT_TIMEOUT 15
 
@@ -261,7 +258,6 @@ static const struct watchdog_ops at91_wdt_ops = {
 	.set_timeout =	at91_wdt_set_timeout,
 };
 
-#if defined(CONFIG_OF)
 static int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)
 {
 	u32 min = 0;
@@ -317,12 +313,6 @@ static int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)
 
 	return 0;
 }
-#else
-static inline int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)
-{
-	return 0;
-}
-#endif
 
 static int __init at91wdt_probe(struct platform_device *pdev)
 {
@@ -334,9 +324,6 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	if (!wdt)
 		return -ENOMEM;
 
-	wdt->mr = (WDT_HW_TIMEOUT * 256) | AT91_WDT_WDRSTEN | AT91_WDT_WDD |
-		  AT91_WDT_WDDBGHLT;
-	wdt->mr_mask = 0x3FFFFFFF;
 	wdt->wdd.parent = &pdev->dev;
 	wdt->wdd.info = &at91_wdt_info;
 	wdt->wdd.ops = &at91_wdt_ops;
@@ -396,14 +383,12 @@ static int __exit at91wdt_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#if defined(CONFIG_OF)
 static const struct of_device_id at91_wdt_dt_ids[] = {
 	{ .compatible = "atmel,at91sam9260-wdt" },
 	{ /* sentinel */ }
 };
 
 MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
-#endif
 
 static struct platform_driver at91wdt_driver = {
 	.remove		= __exit_p(at91wdt_remove),
-- 
2.5.1

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

* [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first
  2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
                   ` (4 preceding siblings ...)
  2015-10-08 21:34 ` [PATCH 5/6] watchdog: at91sam9: remove unused pdata support Sylvain Rochet
@ 2015-10-08 21:34 ` Sylvain Rochet
  2015-10-12  7:50   ` Alexandre Belloni
  5 siblings, 1 reply; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-08 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

watchdog_init_timeout function doesn't try to get the "timeout-sec" DT
property if timeout_parm is not zero. This change makes this DT property
working for the sama5d4 watchdog driver.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/watchdog/sama5d4_wdt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
index a49634c..2e2049b 100644
--- a/drivers/watchdog/sama5d4_wdt.c
+++ b/drivers/watchdog/sama5d4_wdt.c
@@ -222,7 +222,10 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 		}
 	}
 
-	ret = watchdog_init_timeout(wdd, wdt_timeout, &pdev->dev);
+	/* Try to set timeout from device tree first */
+	ret = watchdog_init_timeout(wdd, 0, &pdev->dev);
+	if (ret)
+		ret = watchdog_init_timeout(wdd, wdt_timeout, &pdev->dev);
 	if (ret) {
 		dev_err(&pdev->dev, "unable to set timeout value\n");
 		return ret;
@@ -243,7 +246,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, wdt);
 
 	dev_info(&pdev->dev, "initialized (timeout = %d sec, nowayout = %d)\n",
-		 wdt_timeout, nowayout);
+		 wdd->timeout, nowayout);
 
 	return 0;
 }
-- 
2.5.1

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

* [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first
  2015-10-08 21:34 ` [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first Sylvain Rochet
@ 2015-10-12  7:50   ` Alexandre Belloni
  2015-10-12  8:12     ` Yang, Wenyou
  2015-10-12  9:09     ` Sylvain Rochet
  0 siblings, 2 replies; 12+ messages in thread
From: Alexandre Belloni @ 2015-10-12  7:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sylvain,

The rest of the series looks good to me, one comment below:

On 08/10/2015 at 23:34:34 +0200, Sylvain Rochet wrote :
> watchdog_init_timeout function doesn't try to get the "timeout-sec" DT
> property if timeout_parm is not zero. This change makes this DT property
> working for the sama5d4 watchdog driver.
> 

While I'm not sure of the feasibility, I think that the module parameter
should override the DT property.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first
  2015-10-12  7:50   ` Alexandre Belloni
@ 2015-10-12  8:12     ` Yang, Wenyou
  2015-10-12 13:56       ` Sylvain Rochet
  2015-10-12  9:09     ` Sylvain Rochet
  1 sibling, 1 reply; 12+ messages in thread
From: Yang, Wenyou @ 2015-10-12  8:12 UTC (permalink / raw)
  To: linux-arm-kernel



> -----Original Message-----
> From: Alexandre Belloni [mailto:alexandre.belloni at free-electrons.com]
> Sent: 2015?10?12? 15:50
> To: Sylvain Rochet
> Cc: Guenter Roeck; Boris BREZILLON; linux-kernel at vger.kernel.org; Ferre,
> Nicolas; Desroches, Ludovic; linux-arm-kernel at lists.infradead.org; Yang,
> Wenyou; Wim Van Sebroeck
> Subject: Re: [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree
> first
> 
> Hi Sylvain,
> 
> The rest of the series looks good to me, one comment below:
> 
> On 08/10/2015 at 23:34:34 +0200, Sylvain Rochet wrote :
> > watchdog_init_timeout function doesn't try to get the "timeout-sec" DT
> > property if timeout_parm is not zero. This change makes this DT
> > property working for the sama5d4 watchdog driver.
> >
> 
> While I'm not sure of the feasibility, I think that the module parameter should
> override the DT property.

The patch should be right, the DT property overrides the module parameter.

If the DT property is not a valid value, it uses the default value,  initialized with the module parameter at the beginning of probe.

> 
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering http://free-electrons.com

Best Regards,
Wenyou Yang

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

* [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first
  2015-10-12  7:50   ` Alexandre Belloni
  2015-10-12  8:12     ` Yang, Wenyou
@ 2015-10-12  9:09     ` Sylvain Rochet
  1 sibling, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-12  9:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alexandre,

On Mon, Oct 12, 2015 at 09:50:01AM +0200, Alexandre Belloni wrote:
> Hi Sylvain,
> 
> The rest of the series looks good to me, one comment below:
> 
> On 08/10/2015 at 23:34:34 +0200, Sylvain Rochet wrote :
> > watchdog_init_timeout function doesn't try to get the "timeout-sec" DT
> > property if timeout_parm is not zero. This change makes this DT property
> > working for the sama5d4 watchdog driver.
> 
> While I'm not sure of the feasibility, I think that the module parameter
> should override the DT property.

That's not that hard, we can remove the initialisation of wdt_timeout to 
WDT_DEFAULT_TIMEOUT and use the 0 magic value, which is not an 
acceptable timeout value, to tell whether the variable was set with a 
module parameter or not.

I followed what was done in the at91sam9_wdt driver but I agree the 
module parameter should override the DT property, if we all agree on 
that, I will also change this behavior in at91sam9_wdt in v2, at least 
for the sake of coherency between drivers.

Sylvain

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

* [PATCH 3/6] watchdog: at91sam9: rename heartbeats into timeout where necessary
  2015-10-08 21:34 ` [PATCH 3/6] watchdog: at91sam9: rename heartbeats into timeout where necessary Sylvain Rochet
@ 2015-10-12 10:07   ` Sylvain Rochet
  0 siblings, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-12 10:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 08, 2015 at 11:34:31PM +0200, Sylvain Rochet wrote:
> 
> @@ -344,7 +342,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
>  	wdt->wdd.parent = &pdev->dev;
>  	wdt->wdd.info = &at91_wdt_info;
>  	wdt->wdd.ops = &at91_wdt_ops;
> -	wdt->wdd.timeout = WDT_HEARTBEAT;
> +	wdt->wdd.timeout = wdt_timeout;

This wasn't a good idea, if wdt_timeout is set using a module parameter 
to a wrong value we end up using this wrong value. Setting the default 
to a valid hardwired value and checking if the proposed value is valid 
using watchdog_init_timeout is obviously the way to go. I will rework 
that in v2.

Sylvain

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

* [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first
  2015-10-12  8:12     ` Yang, Wenyou
@ 2015-10-12 13:56       ` Sylvain Rochet
  0 siblings, 0 replies; 12+ messages in thread
From: Sylvain Rochet @ 2015-10-12 13:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Wenyou,

On Mon, Oct 12, 2015 at 08:12:42AM +0000, Yang, Wenyou wrote:
> > -----Original Message-----
> > From: Alexandre Belloni [mailto:alexandre.belloni at free-electrons.com]
> > Sent: 2015?10?12? 15:50
> > To: Sylvain Rochet
> > Cc: Guenter Roeck; Boris BREZILLON; linux-kernel at vger.kernel.org; Ferre,
> > Nicolas; Desroches, Ludovic; linux-arm-kernel at lists.infradead.org; Yang,
> > Wenyou; Wim Van Sebroeck
> > Subject: Re: [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree
> > first
> > 
> > Hi Sylvain,
> > 
> > The rest of the series looks good to me, one comment below:
> > 
> > On 08/10/2015 at 23:34:34 +0200, Sylvain Rochet wrote :
> > > watchdog_init_timeout function doesn't try to get the "timeout-sec" DT
> > > property if timeout_parm is not zero. This change makes this DT
> > > property working for the sama5d4 watchdog driver.
> > >
> > 
> > While I'm not sure of the feasibility, I think that the module parameter should
> > override the DT property.
> 
> The patch should be right, the DT property overrides the module 
> parameter.
> 
> If the DT property is not a valid value, it uses the default value, 
> initialized with the module parameter at the beginning of probe.

Well, the principle of least surprise applied here means if you load the 
module with a timeout argument, you expect the timeout argument to be 
used and not the dt one. As such, it makes more sense to have the 
parameter value takes precedence over the dt value.

Sylvain

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

end of thread, other threads:[~2015-10-12 13:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 21:34 [PATCH 0/6] watchdog: sama5d4 and at91sam9: trivial rework Sylvain Rochet
2015-10-08 21:34 ` [PATCH 1/6] watchdog: at91sam9: use devm_request_irq instead of request_irq Sylvain Rochet
2015-10-08 21:34 ` [PATCH 2/6] watchdog: at91sam9: use watchdog_get_drvdata instead of container_of Sylvain Rochet
2015-10-08 21:34 ` [PATCH 3/6] watchdog: at91sam9: rename heartbeats into timeout where necessary Sylvain Rochet
2015-10-12 10:07   ` Sylvain Rochet
2015-10-08 21:34 ` [PATCH 4/6] watchdog: at91sam9: remove nowayout useless copy Sylvain Rochet
2015-10-08 21:34 ` [PATCH 5/6] watchdog: at91sam9: remove unused pdata support Sylvain Rochet
2015-10-08 21:34 ` [PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first Sylvain Rochet
2015-10-12  7:50   ` Alexandre Belloni
2015-10-12  8:12     ` Yang, Wenyou
2015-10-12 13:56       ` Sylvain Rochet
2015-10-12  9:09     ` Sylvain Rochet

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).