public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/7] wdt: dw: Switch to if(CONFIG()) instead of using #if
Date: Fri,  7 Aug 2020 11:03:49 -0400	[thread overview]
Message-ID: <20200807150355.287181-2-seanga2@gmail.com> (raw)
In-Reply-To: <20200807150355.287181-1-seanga2@gmail.com>

This is preferred over #if because the compiler can check syntax even if
the feature is disabled. This cannot be used for CONFIG_CLK because
CONFIG_DW_WDT_CLOCK_KHZ is not defined on all platforms.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---

(no changes since v1)

 drivers/watchdog/designware_wdt.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
index f25c8d9ab3..49cf861d46 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -136,17 +136,17 @@ static int designware_wdt_probe(struct udevice *dev)
 	priv->clk_khz = CONFIG_DW_WDT_CLOCK_KHZ;
 #endif
 
-#if CONFIG_IS_ENABLED(DM_RESET)
-	struct reset_ctl_bulk resets;
+	if (CONFIG_IS_ENABLED(DM_RESET)) {
+		struct reset_ctl_bulk resets;
 
-	ret = reset_get_bulk(dev, &resets);
-	if (ret)
-		return ret;
+		ret = reset_get_bulk(dev, &resets);
+		if (ret)
+			return ret;
 
-	ret = reset_deassert_bulk(&resets);
-	if (ret)
-		return ret;
-#endif
+		ret = reset_deassert_bulk(&resets);
+		if (ret)
+			return ret;
+	}
 
 	/* reset to disable the watchdog */
 	return designware_wdt_stop(dev);
-- 
2.28.0

  reply	other threads:[~2020-08-07 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 15:03 [PATCH v2 1/7] wdt: dw: Switch to using fls for log2 Sean Anderson
2020-08-07 15:03 ` Sean Anderson [this message]
2020-08-07 15:03 ` [PATCH v2 3/7] wdt: dw: Fix clock rate being off by 1000 Sean Anderson
2020-08-07 15:03 ` [PATCH v2 4/7] wdt: dw: Enable the clock before using it Sean Anderson
2020-08-07 15:03 ` [PATCH v2 5/7] wdt: dw: Free the clock on error Sean Anderson
2020-08-07 15:03 ` [PATCH v2 6/7] riscv: Add watchdog bindings for the k210 Sean Anderson
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3FA4734090@ATCPCS16.andestech.com>
2020-08-12  3:30     ` Rick Chen
2020-08-07 15:03 ` [PATCH v2 7/7] riscv: Enable watchdog " Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200807150355.287181-2-seanga2@gmail.com \
    --to=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox