diff mbox

[U-Boot,v1,2/3] wdt: Timeout better to be in microseconds

Message ID 20170705174408.72891-2-andriy.shevchenko@linux.intel.com
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Andy Shevchenko July 5, 2017, 5:44 p.m. UTC
Timeout in some abstract ticks is not what we are applying to get
deterministic behaviour.

Convert name to show explicitly that we are using microseconds (for
watchdog it's more than precise).

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/watchdog/wdt-uclass.c | 4 ++--
 include/wdt.h                 | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Bin Meng July 6, 2017, 4:16 a.m. UTC | #1
On Thu, Jul 6, 2017 at 1:44 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Timeout in some abstract ticks is not what we are applying to get
> deterministic behaviour.
>
> Convert name to show explicitly that we are using microseconds (for
> watchdog it's more than precise).
>
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/watchdog/wdt-uclass.c | 4 ++--
>  include/wdt.h                 | 8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Heiko Schocher July 6, 2017, 4:34 a.m. UTC | #2
Hello Andy,

Am 05.07.2017 um 19:44 schrieb Andy Shevchenko:
> Timeout in some abstract ticks is not what we are applying to get
> deterministic behaviour.
>
> Convert name to show explicitly that we are using microseconds (for
> watchdog it's more than precise).
>
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/watchdog/wdt-uclass.c | 4 ++--
>   include/wdt.h                 | 8 ++++----
>   2 files changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
> index bb9ae80866..1715a98452 100644
> --- a/drivers/watchdog/wdt-uclass.c
> +++ b/drivers/watchdog/wdt-uclass.c
> @@ -13,14 +13,14 @@
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> -int wdt_start(struct udevice *dev, u64 timeout, ulong flags)
> +int wdt_start(struct udevice *dev, u64 timeout_us, ulong flags)
>   {
>   	const struct wdt_ops *ops = device_get_ops(dev);
>
>   	if (!ops->start)
>   		return -ENOSYS;
>
> -	return ops->start(dev, timeout, flags);
> +	return ops->start(dev, timeout_us, flags);
>   }
>
>   int wdt_stop(struct udevice *dev)
> diff --git a/include/wdt.h b/include/wdt.h
> index 0b5f05851a..115e8c6baf 100644
> --- a/include/wdt.h
> +++ b/include/wdt.h
> @@ -21,12 +21,12 @@
>    * Start the timer
>    *
>    * @dev: WDT Device
> - * @timeout: Number of ticks before timer expires
> + * @timeout_us: Number of microseconds before timer expires
>    * @flags: Driver specific flags. This might be used to specify
>    * which action needs to be executed when the timer expires
>    * @return: 0 if OK, -ve on error
>    */
> -int wdt_start(struct udevice *dev, u64 timeout, ulong flags);
> +int wdt_start(struct udevice *dev, u64 timeout_us, ulong flags);
>
>   /*
>    * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again.
> @@ -67,12 +67,12 @@ struct wdt_ops {
>   	 * Start the timer
>   	 *
>   	 * @dev: WDT Device
> -	 * @timeout: Number of ticks before the timer expires
> +	 * @timeout_us: Number of microseconds before the timer expires
>   	 * @flags: Driver specific flags. This might be used to specify
>   	 * which action needs to be executed when the timer expires
>   	 * @return: 0 if OK, -ve on error
>   	 */
> -	int (*start)(struct udevice *dev, u64 timeout, ulong flags);
> +	int (*start)(struct udevice *dev, u64 timeout_us, ulong flags);
>   	/*
>   	 * Stop the timer
>   	 *
>
Simon Glass July 7, 2017, 3:59 a.m. UTC | #3
Hi Andy,

On 5 July 2017 at 11:44, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Timeout in some abstract ticks is not what we are applying to get
> deterministic behaviour.

A tick is always milliseconds in U-Boot, as I understand it.

>
> Convert name to show explicitly that we are using microseconds (for
> watchdog it's more than precise).

Do you want microseconds, or is milliseconds enough accuracy? I have a
hard time imagining a case where a microsecond watchdog timeout is
useful.

>
> No functional change intended.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/watchdog/wdt-uclass.c | 4 ++--
>  include/wdt.h                 | 8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
>

Regards,
Simon
Andy Shevchenko July 7, 2017, 11:15 a.m. UTC | #4
On Thu, 2017-07-06 at 21:59 -0600, Simon Glass wrote:
> Hi Andy,
> 
> On 5 July 2017 at 11:44, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > Timeout in some abstract ticks is not what we are applying to get
> > deterministic behaviour.
> 
> A tick is always milliseconds in U-Boot, as I understand it.

You see, there is a confusion.
I would like to see units somewhere there, to make it clear.

> 
> > 
> > Convert name to show explicitly that we are using microseconds (for
> > watchdog it's more than precise).
> 
> Do you want microseconds, or is milliseconds enough accuracy? I have a
> hard time imagining a case where a microsecond watchdog timeout is
> useful.

For me ticks sounded like processor cycles (nanosecond-ish).
So, milliseconds are better.

Since I have not much time, feel free to drop, modify, etc.
Thanks for review.

> 
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/watchdog/wdt-uclass.c | 4 ++--
> >  include/wdt.h                 | 8 ++++----
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> > 
> 
> Regards,
> Simon
diff mbox

Patch

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index bb9ae80866..1715a98452 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -13,14 +13,14 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+int wdt_start(struct udevice *dev, u64 timeout_us, ulong flags)
 {
 	const struct wdt_ops *ops = device_get_ops(dev);
 
 	if (!ops->start)
 		return -ENOSYS;
 
-	return ops->start(dev, timeout, flags);
+	return ops->start(dev, timeout_us, flags);
 }
 
 int wdt_stop(struct udevice *dev)
diff --git a/include/wdt.h b/include/wdt.h
index 0b5f05851a..115e8c6baf 100644
--- a/include/wdt.h
+++ b/include/wdt.h
@@ -21,12 +21,12 @@ 
  * Start the timer
  *
  * @dev: WDT Device
- * @timeout: Number of ticks before timer expires
+ * @timeout_us: Number of microseconds before timer expires
  * @flags: Driver specific flags. This might be used to specify
  * which action needs to be executed when the timer expires
  * @return: 0 if OK, -ve on error
  */
-int wdt_start(struct udevice *dev, u64 timeout, ulong flags);
+int wdt_start(struct udevice *dev, u64 timeout_us, ulong flags);
 
 /*
  * Stop the timer, thus disabling the Watchdog. Use wdt_start to start it again.
@@ -67,12 +67,12 @@  struct wdt_ops {
 	 * Start the timer
 	 *
 	 * @dev: WDT Device
-	 * @timeout: Number of ticks before the timer expires
+	 * @timeout_us: Number of microseconds before the timer expires
 	 * @flags: Driver specific flags. This might be used to specify
 	 * which action needs to be executed when the timer expires
 	 * @return: 0 if OK, -ve on error
 	 */
-	int (*start)(struct udevice *dev, u64 timeout, ulong flags);
+	int (*start)(struct udevice *dev, u64 timeout_us, ulong flags);
 	/*
 	 * Stop the timer
 	 *