U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] watchdog: mtk_wdt: Cosmetic cleanup of latest changes
@ 2019-07-03  5:22 Stefan Roese
  2019-07-03 11:49 ` Matthias Brugger
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Roese @ 2019-07-03  5:22 UTC (permalink / raw)
  To: u-boot

This patch cleans up some coding style related issues in the mtk_wtd
driver to make this driver comply again with the U-Boot coding style
standards.

The only minimal functional change is that the timeout parameter is now
passed in (u64) instead of (unsigned int) from mtk_wdt_start() to
mtk_wdt_set_timeout(), preserving the original value.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Shannon Barber <sbarber@dataspeedinc.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/watchdog/mtk_wdt.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index a7d4c7a3b8..dafd2b56a8 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -70,9 +70,12 @@ static int mtk_wdt_expire_now(struct udevice *dev, ulong flags)
 	return 0;
 }
 
-static void mtk_wdt_set_timeout(struct udevice *dev, unsigned int timeout_ms)
+static void mtk_wdt_set_timeout(struct udevice *dev, u64 timeout_ms)
 {
 	struct mtk_wdt_priv *priv = dev_get_priv(dev);
+	u64 timeout_us;
+	u32 timeout_cc;
+	u32 length;
 
 	/*
 	 * One WDT_LENGTH count is 512 ticks of the wdt clock
@@ -88,21 +91,25 @@ static void mtk_wdt_set_timeout(struct udevice *dev, unsigned int timeout_ms)
 	 *  The MediaTek docs lack details to know if this is the case here.
 	 *  So we enforce a minimum of 1 to guarantee operation.
 	 */
-	if(timeout_ms > 15984) timeout_ms = 15984;
-	u64 timeout_us = timeout_ms * 1000;
-	u32 timeout_cc = (u32) ( (15624 + timeout_us) / 15625 );
-	if(timeout_cc == 0) timeout_cc = 1;
-	u32 length = WDT_LENGTH_TIMEOUT(timeout_cc) | WDT_LENGTH_KEY;
+	if (timeout_ms > 15984)
+		timeout_ms = 15984;
+
+	timeout_us = timeout_ms * 1000;
+	timeout_cc = (15624 + timeout_us) / 15625;
+	if (timeout_cc == 0)
+		timeout_cc = 1;
+
+	length = WDT_LENGTH_TIMEOUT(timeout_cc) | WDT_LENGTH_KEY;
 	writel(length, priv->base + MTK_WDT_LENGTH);
 }
 
-static int mtk_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+static int mtk_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
 {
 	struct mtk_wdt_priv *priv = dev_get_priv(dev);
 
-	mtk_wdt_set_timeout(dev, timeout);
+	mtk_wdt_set_timeout(dev, timeout_ms);
 
-        mtk_wdt_reset(dev);
+	mtk_wdt_reset(dev);
 
 	/* Enable watchdog reset signal */
 	setbits_le32(priv->base + MTK_WDT_MODE,
-- 
2.22.0

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

* [U-Boot] [PATCH] watchdog: mtk_wdt: Cosmetic cleanup of latest changes
  2019-07-03  5:22 [U-Boot] [PATCH] watchdog: mtk_wdt: Cosmetic cleanup of latest changes Stefan Roese
@ 2019-07-03 11:49 ` Matthias Brugger
  0 siblings, 0 replies; 2+ messages in thread
From: Matthias Brugger @ 2019-07-03 11:49 UTC (permalink / raw)
  To: u-boot



On 03/07/2019 07:22, Stefan Roese wrote:
> This patch cleans up some coding style related issues in the mtk_wtd
> driver to make this driver comply again with the U-Boot coding style
> standards.
> 
> The only minimal functional change is that the timeout parameter is now
> passed in (u64) instead of (unsigned int) from mtk_wdt_start() to
> mtk_wdt_set_timeout(), preserving the original value.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Shannon Barber <sbarber@dataspeedinc.com>
> Cc: Ryder Lee <ryder.lee@mediatek.com>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Frank Wunderlich <frank-w@public-files.de>
> ---

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

>  drivers/watchdog/mtk_wdt.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index a7d4c7a3b8..dafd2b56a8 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -70,9 +70,12 @@ static int mtk_wdt_expire_now(struct udevice *dev, ulong flags)
>  	return 0;
>  }
>  
> -static void mtk_wdt_set_timeout(struct udevice *dev, unsigned int timeout_ms)
> +static void mtk_wdt_set_timeout(struct udevice *dev, u64 timeout_ms)
>  {
>  	struct mtk_wdt_priv *priv = dev_get_priv(dev);
> +	u64 timeout_us;
> +	u32 timeout_cc;
> +	u32 length;
>  
>  	/*
>  	 * One WDT_LENGTH count is 512 ticks of the wdt clock
> @@ -88,21 +91,25 @@ static void mtk_wdt_set_timeout(struct udevice *dev, unsigned int timeout_ms)
>  	 *  The MediaTek docs lack details to know if this is the case here.
>  	 *  So we enforce a minimum of 1 to guarantee operation.
>  	 */
> -	if(timeout_ms > 15984) timeout_ms = 15984;
> -	u64 timeout_us = timeout_ms * 1000;
> -	u32 timeout_cc = (u32) ( (15624 + timeout_us) / 15625 );
> -	if(timeout_cc == 0) timeout_cc = 1;
> -	u32 length = WDT_LENGTH_TIMEOUT(timeout_cc) | WDT_LENGTH_KEY;
> +	if (timeout_ms > 15984)
> +		timeout_ms = 15984;
> +
> +	timeout_us = timeout_ms * 1000;
> +	timeout_cc = (15624 + timeout_us) / 15625;
> +	if (timeout_cc == 0)
> +		timeout_cc = 1;
> +
> +	length = WDT_LENGTH_TIMEOUT(timeout_cc) | WDT_LENGTH_KEY;
>  	writel(length, priv->base + MTK_WDT_LENGTH);
>  }
>  
> -static int mtk_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
> +static int mtk_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
>  {
>  	struct mtk_wdt_priv *priv = dev_get_priv(dev);
>  
> -	mtk_wdt_set_timeout(dev, timeout);
> +	mtk_wdt_set_timeout(dev, timeout_ms);
>  
> -        mtk_wdt_reset(dev);
> +	mtk_wdt_reset(dev);
>  
>  	/* Enable watchdog reset signal */
>  	setbits_le32(priv->base + MTK_WDT_MODE,
> 

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

end of thread, other threads:[~2019-07-03 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-03  5:22 [U-Boot] [PATCH] watchdog: mtk_wdt: Cosmetic cleanup of latest changes Stefan Roese
2019-07-03 11:49 ` Matthias Brugger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox