linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver
@ 2021-03-29 16:19 Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 1/5] watchdog: of_xilinx_wdt: Add comment to spinlock Srinivas Neeli
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Srinivas Neeli @ 2021-03-29 16:19 UTC (permalink / raw)
  To: linux, shubhraj, sgoud, michal.simek
  Cc: wim, linux-watchdog, linux-kernel, git, Srinivas Neeli

This patch series does the following:
- Add comment to spinlock
- Used BIT macro
- Used dev_dbg()
- Remove passing null pointer
- Skip printing pointer value
---
Changes in V2:
-Updated minor review comments.
-Plan to create a separate driver for Window watchdog mode.
-So dropping window watchdog related patches.
---

Srinivas Goud (3):
  watchdog: of_xilinx_wdt: Add comment to spinlock
  watchdog: of_xilinx_wdt: Used BIT macro
  watchdog: of_xilinx_wdt: Used dev_dbg()

Srinivas Neeli (2):
  watchdog: of_xilinx_wdt: Remove passing null pointer
  watchdog: of_xilinx_wdt: Skip printing pointer value

 drivers/watchdog/of_xilinx_wdt.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

-- 
2.9.1


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

* [PATCH V2 1/5] watchdog: of_xilinx_wdt: Add comment to spinlock
  2021-03-29 16:19 [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver Srinivas Neeli
@ 2021-03-29 16:19 ` Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro Srinivas Neeli
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Srinivas Neeli @ 2021-03-29 16:19 UTC (permalink / raw)
  To: linux, shubhraj, sgoud, michal.simek
  Cc: wim, linux-watchdog, linux-kernel, git, Srinivas Goud, Srinivas Neeli

From: Srinivas Goud <srinivas.goud@xilinx.com>

Based on checkpatch every spinlock should be documented.
The patch is fixing this issue:
./scripts/checkpatch.pl --strict -f drivers/watchdog/of_xilinx_wdt.c
CHECK: spinlock_t definition without comment
+	spinlock_t spinlock;

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/of_xilinx_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index 7fe4f7c3f7ce..00549164b3d7 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -40,7 +40,7 @@
 struct xwdt_device {
 	void __iomem *base;
 	u32 wdt_interval;
-	spinlock_t spinlock;
+	spinlock_t spinlock; /* spinlock for register handling */
 	struct watchdog_device xilinx_wdt_wdd;
 	struct clk		*clk;
 };
-- 
2.9.1


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

* [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro
  2021-03-29 16:19 [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 1/5] watchdog: of_xilinx_wdt: Add comment to spinlock Srinivas Neeli
@ 2021-03-29 16:19 ` Srinivas Neeli
  2021-03-29 21:54   ` Guenter Roeck
  2021-03-29 16:19 ` [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg() Srinivas Neeli
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Srinivas Neeli @ 2021-03-29 16:19 UTC (permalink / raw)
  To: linux, shubhraj, sgoud, michal.simek
  Cc: wim, linux-watchdog, linux-kernel, git, Srinivas Goud, Srinivas Neeli

From: Srinivas Goud <srinivas.goud@xilinx.com>

Used BIT macro instead of mask value.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
Changes in V2:
-Included bits.h header file.
---
 drivers/watchdog/of_xilinx_wdt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index 00549164b3d7..f76ec56859a4 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -6,6 +6,7 @@
  * (C) Copyright 2011 (Alejandro Cabrera <aldaya@gmail.com>)
  */
 
+#include <linux/bits.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/module.h>
@@ -24,12 +25,12 @@
 #define XWT_TBR_OFFSET      0x8 /* Timebase Register Offset */
 
 /* Control/Status Register Masks  */
-#define XWT_CSR0_WRS_MASK   0x00000008 /* Reset status */
-#define XWT_CSR0_WDS_MASK   0x00000004 /* Timer state  */
-#define XWT_CSR0_EWDT1_MASK 0x00000002 /* Enable bit 1 */
+#define XWT_CSR0_WRS_MASK	BIT(3) /* Reset status */
+#define XWT_CSR0_WDS_MASK	BIT(2) /* Timer state  */
+#define XWT_CSR0_EWDT1_MASK	BIT(1) /* Enable bit 1 */
 
 /* Control/Status Register 0/1 bits  */
-#define XWT_CSRX_EWDT2_MASK 0x00000001 /* Enable bit 2 */
+#define XWT_CSRX_EWDT2_MASK	BIT(0) /* Enable bit 2 */
 
 /* SelfTest constants */
 #define XWT_MAX_SELFTEST_LOOP_COUNT 0x00010000
-- 
2.9.1


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

* [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg()
  2021-03-29 16:19 [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 1/5] watchdog: of_xilinx_wdt: Add comment to spinlock Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro Srinivas Neeli
@ 2021-03-29 16:19 ` Srinivas Neeli
  2021-03-29 21:54   ` Guenter Roeck
  2021-03-29 16:19 ` [PATCH V2 4/5] watchdog: of_xilinx_wdt: Remove passing null pointer Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 5/5] watchdog: of_xilinx_wdt: Skip printing pointer value Srinivas Neeli
  4 siblings, 1 reply; 8+ messages in thread
From: Srinivas Neeli @ 2021-03-29 16:19 UTC (permalink / raw)
  To: linux, shubhraj, sgoud, michal.simek
  Cc: wim, linux-watchdog, linux-kernel, git, Srinivas Goud, Srinivas Neeli

From: Srinivas Goud <srinivas.goud@xilinx.com>

This patch removes pr_info in stop function and adds dev_dbg()
in start/stop function to display device specific debug info.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
Changes in V2:
-Updated minor review comments.
---
 drivers/watchdog/of_xilinx_wdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index f76ec56859a4..5f31fdea517a 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -71,6 +71,8 @@ static int xilinx_wdt_start(struct watchdog_device *wdd)
 
 	spin_unlock(&xdev->spinlock);
 
+	dev_dbg(wdd->parent, "Watchdog Started!\n");
+
 	return 0;
 }
 
@@ -92,7 +94,7 @@ static int xilinx_wdt_stop(struct watchdog_device *wdd)
 
 	clk_disable(xdev->clk);
 
-	pr_info("Stopped!\n");
+	dev_dbg(wdd->parent, "Watchdog Stopped!\n");
 
 	return 0;
 }
-- 
2.9.1


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

* [PATCH V2 4/5] watchdog: of_xilinx_wdt: Remove passing null pointer
  2021-03-29 16:19 [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver Srinivas Neeli
                   ` (2 preceding siblings ...)
  2021-03-29 16:19 ` [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg() Srinivas Neeli
@ 2021-03-29 16:19 ` Srinivas Neeli
  2021-03-29 16:19 ` [PATCH V2 5/5] watchdog: of_xilinx_wdt: Skip printing pointer value Srinivas Neeli
  4 siblings, 0 replies; 8+ messages in thread
From: Srinivas Neeli @ 2021-03-29 16:19 UTC (permalink / raw)
  To: linux, shubhraj, sgoud, michal.simek
  Cc: wim, linux-watchdog, linux-kernel, git, Srinivas Neeli

clk is an optional property, if clock not defined,
calling clk_prepare_enable() and devm_add_action_or_reset()
are not useful.
so calling these two apis only when clock is present.

Addresses-Coverity:"FORWARD_NULL"

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/of_xilinx_wdt.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index 5f31fdea517a..afbff79cce42 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -211,6 +211,15 @@ static int xwdt_probe(struct platform_device *pdev)
 				 "The watchdog clock freq cannot be obtained\n");
 	} else {
 		pfreq = clk_get_rate(xdev->clk);
+		rc = clk_prepare_enable(xdev->clk);
+		if (rc) {
+			dev_err(dev, "unable to enable clock\n");
+			return rc;
+		}
+		rc = devm_add_action_or_reset(dev, xwdt_clk_disable_unprepare,
+					      xdev->clk);
+		if (rc)
+			return rc;
 	}
 
 	/*
@@ -224,16 +233,6 @@ static int xwdt_probe(struct platform_device *pdev)
 	spin_lock_init(&xdev->spinlock);
 	watchdog_set_drvdata(xilinx_wdt_wdd, xdev);
 
-	rc = clk_prepare_enable(xdev->clk);
-	if (rc) {
-		dev_err(dev, "unable to enable clock\n");
-		return rc;
-	}
-	rc = devm_add_action_or_reset(dev, xwdt_clk_disable_unprepare,
-				      xdev->clk);
-	if (rc)
-		return rc;
-
 	rc = xwdt_selftest(xdev);
 	if (rc == XWT_TIMER_FAILED) {
 		dev_err(dev, "SelfTest routine error\n");
-- 
2.9.1


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

* [PATCH V2 5/5] watchdog: of_xilinx_wdt: Skip printing pointer value
  2021-03-29 16:19 [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver Srinivas Neeli
                   ` (3 preceding siblings ...)
  2021-03-29 16:19 ` [PATCH V2 4/5] watchdog: of_xilinx_wdt: Remove passing null pointer Srinivas Neeli
@ 2021-03-29 16:19 ` Srinivas Neeli
  4 siblings, 0 replies; 8+ messages in thread
From: Srinivas Neeli @ 2021-03-29 16:19 UTC (permalink / raw)
  To: linux, shubhraj, sgoud, michal.simek
  Cc: wim, linux-watchdog, linux-kernel, git, Srinivas Neeli

"%p" is not printing the pointer value.
In driver, printing pointer value is not useful so avoiding print.

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/of_xilinx_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
index afbff79cce42..3318544366b8 100644
--- a/drivers/watchdog/of_xilinx_wdt.c
+++ b/drivers/watchdog/of_xilinx_wdt.c
@@ -245,8 +245,8 @@ static int xwdt_probe(struct platform_device *pdev)
 
 	clk_disable(xdev->clk);
 
-	dev_info(dev, "Xilinx Watchdog Timer at %p with timeout %ds\n",
-		 xdev->base, xilinx_wdt_wdd->timeout);
+	dev_info(dev, "Xilinx Watchdog Timer with timeout %ds\n",
+		 xilinx_wdt_wdd->timeout);
 
 	platform_set_drvdata(pdev, xdev);
 
-- 
2.9.1


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

* Re: [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro
  2021-03-29 16:19 ` [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro Srinivas Neeli
@ 2021-03-29 21:54   ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2021-03-29 21:54 UTC (permalink / raw)
  To: Srinivas Neeli
  Cc: shubhraj, sgoud, michal.simek, wim, linux-watchdog, linux-kernel,
	git, Srinivas Goud

On Mon, Mar 29, 2021 at 09:49:36PM +0530, Srinivas Neeli wrote:
> From: Srinivas Goud <srinivas.goud@xilinx.com>
> 
> Used BIT macro instead of mask value.
> 
> Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>

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

> ---
> Changes in V2:
> -Included bits.h header file.
> ---
>  drivers/watchdog/of_xilinx_wdt.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
> index 00549164b3d7..f76ec56859a4 100644
> --- a/drivers/watchdog/of_xilinx_wdt.c
> +++ b/drivers/watchdog/of_xilinx_wdt.c
> @@ -6,6 +6,7 @@
>   * (C) Copyright 2011 (Alejandro Cabrera <aldaya@gmail.com>)
>   */
>  
> +#include <linux/bits.h>
>  #include <linux/clk.h>
>  #include <linux/err.h>
>  #include <linux/module.h>
> @@ -24,12 +25,12 @@
>  #define XWT_TBR_OFFSET      0x8 /* Timebase Register Offset */
>  
>  /* Control/Status Register Masks  */
> -#define XWT_CSR0_WRS_MASK   0x00000008 /* Reset status */
> -#define XWT_CSR0_WDS_MASK   0x00000004 /* Timer state  */
> -#define XWT_CSR0_EWDT1_MASK 0x00000002 /* Enable bit 1 */
> +#define XWT_CSR0_WRS_MASK	BIT(3) /* Reset status */
> +#define XWT_CSR0_WDS_MASK	BIT(2) /* Timer state  */
> +#define XWT_CSR0_EWDT1_MASK	BIT(1) /* Enable bit 1 */
>  
>  /* Control/Status Register 0/1 bits  */
> -#define XWT_CSRX_EWDT2_MASK 0x00000001 /* Enable bit 2 */
> +#define XWT_CSRX_EWDT2_MASK	BIT(0) /* Enable bit 2 */
>  
>  /* SelfTest constants */
>  #define XWT_MAX_SELFTEST_LOOP_COUNT 0x00010000
> -- 
> 2.9.1
> 

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

* Re: [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg()
  2021-03-29 16:19 ` [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg() Srinivas Neeli
@ 2021-03-29 21:54   ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2021-03-29 21:54 UTC (permalink / raw)
  To: Srinivas Neeli
  Cc: shubhraj, sgoud, michal.simek, wim, linux-watchdog, linux-kernel,
	git, Srinivas Goud

On Mon, Mar 29, 2021 at 09:49:37PM +0530, Srinivas Neeli wrote:
> From: Srinivas Goud <srinivas.goud@xilinx.com>
> 
> This patch removes pr_info in stop function and adds dev_dbg()
> in start/stop function to display device specific debug info.
> 
> Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>

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

> ---
> Changes in V2:
> -Updated minor review comments.
> ---
>  drivers/watchdog/of_xilinx_wdt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
> index f76ec56859a4..5f31fdea517a 100644
> --- a/drivers/watchdog/of_xilinx_wdt.c
> +++ b/drivers/watchdog/of_xilinx_wdt.c
> @@ -71,6 +71,8 @@ static int xilinx_wdt_start(struct watchdog_device *wdd)
>  
>  	spin_unlock(&xdev->spinlock);
>  
> +	dev_dbg(wdd->parent, "Watchdog Started!\n");
> +
>  	return 0;
>  }
>  
> @@ -92,7 +94,7 @@ static int xilinx_wdt_stop(struct watchdog_device *wdd)
>  
>  	clk_disable(xdev->clk);
>  
> -	pr_info("Stopped!\n");
> +	dev_dbg(wdd->parent, "Watchdog Stopped!\n");
>  
>  	return 0;
>  }
> -- 
> 2.9.1
> 

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

end of thread, other threads:[~2021-03-29 21:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 16:19 [PATCH V2 0/5] watchdog: of_xilinx_wdt: Update on xilinx watchdog driver Srinivas Neeli
2021-03-29 16:19 ` [PATCH V2 1/5] watchdog: of_xilinx_wdt: Add comment to spinlock Srinivas Neeli
2021-03-29 16:19 ` [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro Srinivas Neeli
2021-03-29 21:54   ` Guenter Roeck
2021-03-29 16:19 ` [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg() Srinivas Neeli
2021-03-29 21:54   ` Guenter Roeck
2021-03-29 16:19 ` [PATCH V2 4/5] watchdog: of_xilinx_wdt: Remove passing null pointer Srinivas Neeli
2021-03-29 16:19 ` [PATCH V2 5/5] watchdog: of_xilinx_wdt: Skip printing pointer value Srinivas Neeli

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