linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers
@ 2015-12-24 22:21 Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 1/5] watchdog: bcm2835_wdt: Drop log message if watchdog is stopped Guenter Roeck
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-24 22:21 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Damien Riegel, linux-kernel, Guenter Roeck

The 'dev' variable in watchdog drivers has a different lifetime than the
watchdog character device and should therefore not be used by watchdog
drivers.

Some of the drivers use the variable to print kernel messages. Those
messages are either dropped or changed to use the parent device.
One driver sets the variable during initialization to the watchdog
driver's parent device, which is wrong and was removed.

v2: Use parent device for dev_XXX messages instead of pr_XXX.

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

* [PATCH v2 1/5] watchdog: bcm2835_wdt: Drop log message if watchdog is stopped
  2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
@ 2015-12-24 22:22 ` Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 2/5] watchdog: tangox: Print info message using pointer to platform device Guenter Roeck
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-24 22:22 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Damien Riegel, linux-kernel, Guenter Roeck

Stopping a watchdog is a normal operation and does not warrant a log
message.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: No change

 drivers/watchdog/bcm2835_wdt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
index 8a5ce5b5a0b6..2e6164c4abc0 100644
--- a/drivers/watchdog/bcm2835_wdt.c
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -79,7 +79,6 @@ static int bcm2835_wdt_stop(struct watchdog_device *wdog)
 	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
 
 	writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
-	dev_info(wdog->dev, "Watchdog timer stopped");
 	return 0;
 }
 
-- 
2.1.4

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

* [PATCH v2 2/5] watchdog: tangox: Print info message using pointer to platform device
  2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 1/5] watchdog: bcm2835_wdt: Drop log message if watchdog is stopped Guenter Roeck
@ 2015-12-24 22:22 ` Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 3/5] watchdog: gpio: Do not use device pointer from struct watchdog_device Guenter Roeck
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-24 22:22 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Damien Riegel, linux-kernel, Guenter Roeck

The device pointer in struct watchdog_device should not be used by drivers
and may be removed in the near future. Use the platform device pointer for
info messages instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: No change

 drivers/watchdog/tangox_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/tangox_wdt.c b/drivers/watchdog/tangox_wdt.c
index b9ee6246e7c2..709c1ed6fd79 100644
--- a/drivers/watchdog/tangox_wdt.c
+++ b/drivers/watchdog/tangox_wdt.c
@@ -184,7 +184,7 @@ static int tangox_wdt_probe(struct platform_device *pdev)
 	if (err)
 		dev_warn(&pdev->dev, "failed to register restart handler\n");
 
-	dev_info(dev->wdt.dev, "SMP86xx/SMP87xx watchdog registered\n");
+	dev_info(&pdev->dev, "SMP86xx/SMP87xx watchdog registered\n");
 
 	return 0;
 }
-- 
2.1.4

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

* [PATCH v2 3/5] watchdog: gpio: Do not use device pointer from struct watchdog_device
  2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 1/5] watchdog: bcm2835_wdt: Drop log message if watchdog is stopped Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 2/5] watchdog: tangox: Print info message using pointer to platform device Guenter Roeck
@ 2015-12-24 22:22 ` Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 4/5] watchdog: mena21: " Guenter Roeck
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-24 22:22 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Damien Riegel, linux-kernel, Guenter Roeck

The device pointer in struct watchdog_device has a different lifetime
than the driver code and should not be used in drivers. Use the pointer
to the parent device instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Print messages using parent device

 drivers/watchdog/gpio_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index 035c2387b846..ba066e4a707b 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -54,7 +54,8 @@ static void gpio_wdt_hwping(unsigned long data)
 
 	if (priv->armed && time_after(jiffies, priv->last_jiffies +
 				      msecs_to_jiffies(wdd->timeout * 1000))) {
-		dev_crit(wdd->dev, "Timer expired. System will reboot soon!\n");
+		dev_crit(wdd->parent,
+			 "Timer expired. System will reboot soon!\n");
 		return;
 	}
 
-- 
2.1.4

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

* [PATCH v2 4/5] watchdog: mena21: Do not use device pointer from struct watchdog_device
  2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
                   ` (2 preceding siblings ...)
  2015-12-24 22:22 ` [PATCH v2 3/5] watchdog: gpio: Do not use device pointer from struct watchdog_device Guenter Roeck
@ 2015-12-24 22:22 ` Guenter Roeck
  2015-12-24 22:22 ` [PATCH v2 5/5] watchdog: qcom-wdt: Do not set 'dev' in " Guenter Roeck
  2015-12-28 22:15 ` [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Wim Van Sebroeck
  5 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-24 22:22 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Damien Riegel, linux-kernel, Guenter Roeck

The device pointer in struct watchdog_device has a different lifetime
than the driver code and should not be used in drivers. Use the pointer
to the parent device instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Print messages using parent device

 drivers/watchdog/mena21_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c
index 098fa9c34d6d..af6a7c489f08 100644
--- a/drivers/watchdog/mena21_wdt.c
+++ b/drivers/watchdog/mena21_wdt.c
@@ -100,12 +100,12 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
 	struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);
 
 	if (timeout != 1 && timeout != 30) {
-		dev_err(wdt->dev, "Only 1 and 30 allowed as timeout\n");
+		dev_err(wdt->parent, "Only 1 and 30 allowed as timeout\n");
 		return -EINVAL;
 	}
 
 	if (timeout == 30 && wdt->timeout == 1) {
-		dev_err(wdt->dev,
+		dev_err(wdt->parent,
 			"Transition from fast to slow mode not allowed\n");
 		return -EINVAL;
 	}
-- 
2.1.4

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

* [PATCH v2 5/5] watchdog: qcom-wdt: Do not set 'dev' in struct watchdog_device
  2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
                   ` (3 preceding siblings ...)
  2015-12-24 22:22 ` [PATCH v2 4/5] watchdog: mena21: " Guenter Roeck
@ 2015-12-24 22:22 ` Guenter Roeck
  2015-12-28 22:15 ` [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Wim Van Sebroeck
  5 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-24 22:22 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Damien Riegel, linux-kernel, Guenter Roeck

The 'dev' pointer in struct watchdog_device is set by the watchdog core
when registering the watchdog device and not by the driver. It points to
the watchdog device, not its parent.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: No change

 drivers/watchdog/qcom-wdt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
index aa7105d32c02..424f9a952fee 100644
--- a/drivers/watchdog/qcom-wdt.c
+++ b/drivers/watchdog/qcom-wdt.c
@@ -164,7 +164,6 @@ static int qcom_wdt_probe(struct platform_device *pdev)
 		goto err_clk_unprepare;
 	}
 
-	wdt->wdd.dev = &pdev->dev;
 	wdt->wdd.info = &qcom_wdt_info;
 	wdt->wdd.ops = &qcom_wdt_ops;
 	wdt->wdd.min_timeout = 1;
-- 
2.1.4

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

* Re: [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers
  2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
                   ` (4 preceding siblings ...)
  2015-12-24 22:22 ` [PATCH v2 5/5] watchdog: qcom-wdt: Do not set 'dev' in " Guenter Roeck
@ 2015-12-28 22:15 ` Wim Van Sebroeck
  2015-12-29  0:00   ` Guenter Roeck
  5 siblings, 1 reply; 8+ messages in thread
From: Wim Van Sebroeck @ 2015-12-28 22:15 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-watchdog, Damien Riegel, linux-kernel

Hi Guenter,

> The 'dev' variable in watchdog drivers has a different lifetime than the
> watchdog character device and should therefore not be used by watchdog
> drivers.
> 
> Some of the drivers use the variable to print kernel messages. Those
> messages are either dropped or changed to use the parent device.
> One driver sets the variable during initialization to the watchdog
> driver's parent device, which is wrong and was removed.
> 
> v2: Use parent device for dev_XXX messages instead of pr_XXX.

This patchset has been added to linux-watchdog-next.

Kind regards,
Wim.


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

* Re: [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers
  2015-12-28 22:15 ` [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Wim Van Sebroeck
@ 2015-12-29  0:00   ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2015-12-29  0:00 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: linux-watchdog, Damien Riegel, linux-kernel

On Mon, Dec 28, 2015 at 11:15:10PM +0100, Wim Van Sebroeck wrote:
> Hi Guenter,
> 
> > The 'dev' variable in watchdog drivers has a different lifetime than the
> > watchdog character device and should therefore not be used by watchdog
> > drivers.
> > 
> > Some of the drivers use the variable to print kernel messages. Those
> > messages are either dropped or changed to use the parent device.
> > One driver sets the variable during initialization to the watchdog
> > driver's parent device, which is wrong and was removed.
> > 
> > v2: Use parent device for dev_XXX messages instead of pr_XXX.
> 
> This patchset has been added to linux-watchdog-next.
> 

Thanks!

Guenter

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

end of thread, other threads:[~2015-12-29  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-24 22:21 [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Guenter Roeck
2015-12-24 22:22 ` [PATCH v2 1/5] watchdog: bcm2835_wdt: Drop log message if watchdog is stopped Guenter Roeck
2015-12-24 22:22 ` [PATCH v2 2/5] watchdog: tangox: Print info message using pointer to platform device Guenter Roeck
2015-12-24 22:22 ` [PATCH v2 3/5] watchdog: gpio: Do not use device pointer from struct watchdog_device Guenter Roeck
2015-12-24 22:22 ` [PATCH v2 4/5] watchdog: mena21: " Guenter Roeck
2015-12-24 22:22 ` [PATCH v2 5/5] watchdog: qcom-wdt: Do not set 'dev' in " Guenter Roeck
2015-12-28 22:15 ` [PATCH v2 0/5] watchdog: Do not use 'dev' from watchdog_device in watchdog drivers Wim Van Sebroeck
2015-12-29  0:00   ` Guenter Roeck

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