watchdog: of_xilinx_wdt: Update on xilinx watchdog driver
v2 cover watchdog: of_xilinx_wdt: Update on xilinx watchdog driver
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(-)
Signature · 1 line
2.9.1
PATCH v2 1/5 watchdog: of_xilinx_wdt: Add comment to spinlock
From: Srinivas Goud <[email protected]>
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;
--- drivers/watchdog/of_xilinx_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/of_xilinx_wdt.c +1 -1
@@ -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; };
Signature · 1 line
2.9.1
PATCH v2 2/5 watchdog: of_xilinx_wdt: Used BIT macro
In reply to Srinivas NeeliFrom: Srinivas Goud <[email protected]>
Used BIT macro instead of mask value.
---
Changes in V2:
-Included bits.h header file.
--- drivers/watchdog/of_xilinx_wdt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/watchdog/of_xilinx_wdt.c +5 -4
@@ -6,6 +6,7 @@* (C) Copyright 2011 (Alejandro Cabrera <[email protected]>) */ +#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
Signature · 1 line
2.9.1
Re: [PATCH V2 2/5] watchdog: of_xilinx_wdt: Used BIT macro
Quoted 7 lines · Srinivas Neeli
From: Srinivas Goud <[email protected]>
Used BIT macro instead of mask value.
Signed-off-by Srinivas Goud <[email protected]>Signed-off-by Michal Simek <[email protected]>Signed-off-by Srinivas Neeli <[email protected]>
Quoted 39 lines
---
Changes in V2:(quoted diff) +0
-2-Included bits.h header file. --- drivers/watchdog/of_xilinx_wdt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/watchdog/of_xilinx_wdt.c +5
-4@@ -6,6 +6,7 @@* (C) Copyright 2011 (Alejandro Cabrera <[email protected]>) */ +#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 0x00010000Signature · 1 line
2.9.1
PATCH v2 3/5 watchdog: of_xilinx_wdt: Used dev_dbg()
In reply to Srinivas NeeliFrom: Srinivas Goud <[email protected]>
This patch removes pr_info in stop function and adds dev_dbg() in start/stop function to display device specific debug info.
---
Changes in V2:
-Updated minor review comments.
--- drivers/watchdog/of_xilinx_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/of_xilinx_wdt.c +3 -1
@@ -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 ; }
Signature · 1 line
2.9.1
Re: [PATCH V2 3/5] watchdog: of_xilinx_wdt: Used dev_dbg()
Quoted 8 lines · Srinivas Neeli
From: Srinivas Goud <[email protected]>
This patch removes
pr_infoin stop function and addsdev_dbg()in start/stop function to display device specific debug info.Signed-off-by Srinivas Goud <[email protected]>Signed-off-by Michal Simek <[email protected]>Signed-off-by Srinivas Neeli <[email protected]>
Quoted 32 lines
---
Changes in V2:(quoted diff) +0
-2-Updated minor review comments. --- drivers/watchdog/of_xilinx_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/watchdog/of_xilinx_wdt.c +3
-1@@ -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 ; }Signature · 1 line
2.9.1
PATCH v2 4/5 watchdog: of_xilinx_wdt: Remove passing null pointer
In reply to Srinivas Neeliclk 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"
--- drivers/watchdog/of_xilinx_wdt.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/watchdog/of_xilinx_wdt.c +9 -10
@@ -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" );
Signature · 1 line
2.9.1
PATCH v2 5/5 watchdog: of_xilinx_wdt: Skip printing pointer value
In reply to Srinivas Neeli"%p" is not printing the pointer value.
In driver, printing pointer value is not useful so avoiding print.
--- drivers/watchdog/of_xilinx_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/of_xilinx_wdt.c +2 -2
@@ -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);
Signature · 1 line
2.9.1