Patchwork [U-Boot,v2,06/23] Update time command to avoid using get_timer_masked()

login
register
mail settings
Submitter Simon Glass
Date Nov. 22, 2012, 7:12 p.m.
Message ID <1353611587-18186-7-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/201144/
State Superseded, archived
Headers show

Comments

Simon Glass - Nov. 22, 2012, 7:12 p.m.
It is better to use get_timer() by itself now, according to the new
timer API.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None

 common/cmd_time.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Simon Glass - Dec. 6, 2012, 12:48 a.m.
Hi,

On Thu, Nov 22, 2012 at 11:12 AM, Simon Glass <sjg@chromium.org> wrote:
> It is better to use get_timer() by itself now, according to the new
> timer API.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> Changes in v2: None

I am going to drop this patch as Richard Genoud has refactored the
code in a pending patch, so I don't think this is needed.

Regards,
Simon

>
>  common/cmd_time.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/common/cmd_time.c b/common/cmd_time.c
> index 6dbdbbf..f1891f9 100644
> --- a/common/cmd_time.c
> +++ b/common/cmd_time.c
> @@ -32,6 +32,7 @@ static int run_command_and_time_it(int flag, int argc, char * const argv[],
>  {
>         cmd_tbl_t *cmdtp = find_cmd(argv[0]);
>         int retval = 0;
> +       ulong start;
>
>         if (!cmdtp) {
>                 printf("%s: command not found\n", argv[0]);
> @@ -45,9 +46,9 @@ static int run_command_and_time_it(int flag, int argc, char * const argv[],
>          * boards.  We could use the new timer API that Graeme is proposing
>          * so that this piece of code would be arch-independent.
>          */
> -       *cycles = get_timer_masked();
> +       start = get_timer(0);
>         retval = cmdtp->cmd(cmdtp, flag, argc, argv);
> -       *cycles = get_timer_masked() - *cycles;
> +       *cycles = get_timer(start);
>
>         return retval;
>  }
> --
> 1.7.7.3
>

Patch

diff --git a/common/cmd_time.c b/common/cmd_time.c
index 6dbdbbf..f1891f9 100644
--- a/common/cmd_time.c
+++ b/common/cmd_time.c
@@ -32,6 +32,7 @@  static int run_command_and_time_it(int flag, int argc, char * const argv[],
 {
 	cmd_tbl_t *cmdtp = find_cmd(argv[0]);
 	int retval = 0;
+	ulong start;
 
 	if (!cmdtp) {
 		printf("%s: command not found\n", argv[0]);
@@ -45,9 +46,9 @@  static int run_command_and_time_it(int flag, int argc, char * const argv[],
 	 * boards.  We could use the new timer API that Graeme is proposing
 	 * so that this piece of code would be arch-independent.
 	 */
-	*cycles = get_timer_masked();
+	start = get_timer(0);
 	retval = cmdtp->cmd(cmdtp, flag, argc, argv);
-	*cycles = get_timer_masked() - *cycles;
+	*cycles = get_timer(start);
 
 	return retval;
 }