diff mbox series

[U-Boot,v2,19/41] common: Move wait_ticks functions out of common.h

Message ID 20191108125120.v2.19.Iaa061cc6a0a856a9300b6b03c2f5bb21d81565ff@changeid
State Changes Requested
Delegated to: Tom Rini
Headers show
Series common: Further reduce common.h | expand

Commit Message

Simon Glass Nov. 8, 2019, 7:53 p.m. UTC
This function belongs in time.h so move it over and add a comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/arm/cpu/pxa/pxa2xx.c     | 1 +
 drivers/timer/mpc83xx_timer.c | 1 +
 include/common.h              | 1 -
 include/time.h                | 9 +++++++++
 4 files changed, 11 insertions(+), 1 deletion(-)

Comments

Tom Rini Nov. 11, 2019, 2:34 p.m. UTC | #1
On Fri, Nov 08, 2019 at 12:53:26PM -0700, Simon Glass wrote:

> This function belongs in time.h so move it over and add a comment.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2: None
> 
>  arch/arm/cpu/pxa/pxa2xx.c     | 1 +
>  drivers/timer/mpc83xx_timer.c | 1 +
>  include/common.h              | 1 -
>  include/time.h                | 9 +++++++++
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c
> index 0b28f0a3ef..43c206b245 100644
> --- a/arch/arm/cpu/pxa/pxa2xx.c
> +++ b/arch/arm/cpu/pxa/pxa2xx.c
> @@ -10,6 +10,7 @@
>   */
>  
>  #include <common.h>
> +#include <time.h>
>  #include <asm/arch/pxa-regs.h>
>  #include <asm/io.h>
>  #include <asm/system.h>
> diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
> index dfbc8672b2..69949d5333 100644
> --- a/drivers/timer/mpc83xx_timer.c
> +++ b/drivers/timer/mpc83xx_timer.c
> @@ -9,6 +9,7 @@
>  #include <clk.h>
>  #include <dm.h>
>  #include <status_led.h>
> +#include <time.h>
>  #include <timer.h>
>  #include <watchdog.h>
>  
> diff --git a/include/common.h b/include/common.h
> index 20d143deb8..091b54787f 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -286,7 +286,6 @@ int cleanup_before_linux_select(int flags);
>  
>  /* arch/$(ARCH)/lib/ticks.S */
>  uint64_t get_ticks(void);
> -void	wait_ticks    (unsigned long);
>  
>  /* lib/uuid.c */
>  #include <uuid.h>
> diff --git a/include/time.h b/include/time.h
> index a1bdefc164..0b3835f053 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -86,4 +86,13 @@ ulong usec2ticks(unsigned long usec);
>   */
>  ulong ticks2usec(unsigned long ticks);
>  
> +/**
> + * wait_ticks() - waits a given number of ticks
> + *
> + * This is an internal funciton. Normally you should use udelay() or mdelay()
> + *
> + * @ticks: Number of ticks to wait
> + */
> +void wait_ticks(unsigned long ticks);
> +
>  #endif /* _TIME_H */

OK, so pxa has "pxa_wait_ticks" not "wait_ticks", so maybe you need to
check your scripts and re-run the series to catch any other similar
cases?  As an aside, pxa_wait_ticks should be static inline'd and since
it's a one-time-use function perhaps just moved in to the caller.

Next, wait_ticks exists on m68k but is unused and could be dropped.  But
in this case I see it's guarded on CONFIG_MCFPIT which is unset, so I'll
follow up and clean that all out.

Which brings us to PowerPC, where we have the asm version (as implied by
the common.h comment) and then mpc83xx has a specific timer driver that
provides it, and then wait_ticks is used to implement udelay on PowerPC
so perhaps the comment should read more like:
"This is an internal function typically used to implement udelay() and
similar".

Thanks!
diff mbox series

Patch

diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c
index 0b28f0a3ef..43c206b245 100644
--- a/arch/arm/cpu/pxa/pxa2xx.c
+++ b/arch/arm/cpu/pxa/pxa2xx.c
@@ -10,6 +10,7 @@ 
  */
 
 #include <common.h>
+#include <time.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/io.h>
 #include <asm/system.h>
diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
index dfbc8672b2..69949d5333 100644
--- a/drivers/timer/mpc83xx_timer.c
+++ b/drivers/timer/mpc83xx_timer.c
@@ -9,6 +9,7 @@ 
 #include <clk.h>
 #include <dm.h>
 #include <status_led.h>
+#include <time.h>
 #include <timer.h>
 #include <watchdog.h>
 
diff --git a/include/common.h b/include/common.h
index 20d143deb8..091b54787f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -286,7 +286,6 @@  int cleanup_before_linux_select(int flags);
 
 /* arch/$(ARCH)/lib/ticks.S */
 uint64_t get_ticks(void);
-void	wait_ticks    (unsigned long);
 
 /* lib/uuid.c */
 #include <uuid.h>
diff --git a/include/time.h b/include/time.h
index a1bdefc164..0b3835f053 100644
--- a/include/time.h
+++ b/include/time.h
@@ -86,4 +86,13 @@  ulong usec2ticks(unsigned long usec);
  */
 ulong ticks2usec(unsigned long ticks);
 
+/**
+ * wait_ticks() - waits a given number of ticks
+ *
+ * This is an internal funciton. Normally you should use udelay() or mdelay()
+ *
+ * @ticks: Number of ticks to wait
+ */
+void wait_ticks(unsigned long ticks);
+
 #endif /* _TIME_H */