Skip to contentSkip to conversation

watchdog: rzn1: Minor improvements

PATCH Superseded Herve Codina (Schneider Electric) 2 participants 5 messages Mar 24 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

v3 cover watchdog: rzn1: Minor improvements

Hi,

Patches present in this series are minor improvements of the RZ/N1 watchdog driver.

They were originally part of the series adding support for direct hardware reset [0] but due to recent modification in this original series, it no longer needs to have them part of it.

Extract them from the original series and leave them alone in this current minor improvement series.

Consider this series a v3 iteration to keep consistency with the original series where, in v2 iteration, some changes have been requested on patch 2 and tags have been received. Those changes are handled here.

[0] https://lore.kernel.org/all/[email protected]/

Best regards,
Hervé

Changes v2 -> v3:
v2: https://lore.kernel.org/all/[email protected]/

- Patch 1
Add 'Reviewed-by: Wolfram Sang'
Add 'Tested-by: Wolfram Sang'

- Patch 2
Fix dev_err_probe() message.
Add 'Reviewed-by: Wolfram Sang'
Add 'Tested-by: Wolfram Sang'

Herve Codina (Schneider Electric) (2):
watchdog: rzn1: Fix reverse xmas tree declaration
watchdog: rzn1: Use dev_err_probe()

 drivers/watchdog/rzn1_wdt.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v3 1/2 watchdog: rzn1: Fix reverse xmas tree declaration

Variables declared in probe() don't follow the reverse xmas tree convention.

Fix the declaration in order to follow the convention.

---
 drivers/watchdog/rzn1_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/rzn1_wdt.c +2 -2
index 96fd04fbc2a2..b7034eac91d0 100644
@@ -101,10 +101,10 @@ static const struct watchdog_ops rzn1_wdt_ops = {
 static int rzn1_wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct rzn1_watchdog *wdt;
 	struct device_node *np = dev->of_node;
-	struct clk *clk;
+	struct rzn1_watchdog *wdt;
 	unsigned long clk_rate;
+	struct clk *clk;
 	int ret;
 	int irq;
 
Signature · 1 line
2.53.0
maintainer Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] watchdog: rzn1: Fix reverse xmas tree declaration

Quoted 8 lines · Herve Codina (Schneider Electric)

Variables declared in probe() don't follow the reverse xmas tree convention.

Fix the declaration in order to follow the convention.

Quoted 21 lines
---
  drivers/watchdog/rzn1_wdt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/rzn1_wdt.c +2 -2
index 96fd04fbc2a2..b7034eac91d0 100644
@@ -101,10 +101,10 @@ static const struct watchdog_ops rzn1_wdt_ops = {
  static int rzn1_wdt_probe(struct platform_device *pdev)
  {
  	struct device *dev = &pdev->dev;
-	struct rzn1_watchdog *wdt;
  	struct device_node *np = dev->of_node;
-	struct clk *clk;
+	struct rzn1_watchdog *wdt;
  	unsigned long clk_rate;
+	struct clk *clk;
  	int ret;
  	int irq;
 
#3 lore raw

PATCH v3 2/2 watchdog: rzn1: Use dev_err_probe()

In reply to Herve Codina (Schneider Electric)

In the probe() function the following pattern is present several times:

	if (err) {
		dev_err(dev, ...);
		return err;
	}

Replace them by dev_err_probe() calls.

---
 drivers/watchdog/rzn1_wdt.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/watchdog/rzn1_wdt.c +6 -12
index b7034eac91d0..48d5afef62a5 100644
@@ -122,22 +122,16 @@ static int rzn1_wdt_probe(struct platform_device *pdev)
 
 	ret = devm_request_irq(dev, irq, rzn1_wdt_irq, 0,
 			       np->name, wdt);
-	if (ret) {
-		dev_err(dev, "failed to request irq %d\n", irq);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to request irq %d\n", irq);
 
 	clk = devm_clk_get_enabled(dev, NULL);
-	if (IS_ERR(clk)) {
-		dev_err(dev, "failed to get the clock\n");
-		return PTR_ERR(clk);
-	}
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk), "failed to get the clock\n");
 
 	clk_rate = clk_get_rate(clk);
-	if (!clk_rate) {
-		dev_err(dev, "failed to get the clock rate\n");
-		return -EINVAL;
-	}
+	if (!clk_rate)
+		return dev_err_probe(dev, -EINVAL, "failed to get the clock rate\n");
 
 	wdt->clk_rate_khz = clk_rate / 1000;
 	wdt->wdtdev.info = &rzn1_wdt_info;
Signature · 1 line
2.53.0
maintainer Reviewed-by on v3 2/2
#4 lore raw

Re: [PATCH v3 2/2] watchdog: rzn1: Use dev_err_probe()

Quoted 11 lines · Herve Codina (Schneider Electric)

In the probe() function the following pattern is present several times:

	if (err) {
		dev_err(dev, ...);
		return err;
	}

Replace them by dev_err_probe() calls.

Quoted 37 lines
---
  drivers/watchdog/rzn1_wdt.c | 18 ++++++------------
  1 file changed, 6 insertions(+), 12 deletions(-)
drivers/watchdog/rzn1_wdt.c +6 -12
index b7034eac91d0..48d5afef62a5 100644
@@ -122,22 +122,16 @@ static int rzn1_wdt_probe(struct platform_device *pdev)
 
  	ret = devm_request_irq(dev, irq, rzn1_wdt_irq, 0,
  			       np->name, wdt);
-	if (ret) {
-		dev_err(dev, "failed to request irq %d\n", irq);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to request irq %d\n", irq);
 
  	clk = devm_clk_get_enabled(dev, NULL);
-	if (IS_ERR(clk)) {
-		dev_err(dev, "failed to get the clock\n");
-		return PTR_ERR(clk);
-	}
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk), "failed to get the clock\n");
 
  	clk_rate = clk_get_rate(clk);
-	if (!clk_rate) {
-		dev_err(dev, "failed to get the clock rate\n");
-		return -EINVAL;
-	}
+	if (!clk_rate)
+		return dev_err_probe(dev, -EINVAL, "failed to get the clock rate\n");
 
  	wdt->clk_rate_khz = clk_rate / 1000;
  	wdt->wdtdev.info = &rzn1_wdt_info;