qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 12/15] hw/timer: Replace fprintf(stderr, "*\n


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH v7 12/15] hw/timer: Replace fprintf(stderr, "*\n" with error_report()
Date: Fri, 2 Feb 2018 17:24:03 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2


On 02/02/2018 03:37 PM, Markus Armbruster wrote:
> From: Alistair Francis <address@hidden>
> 
> Replace a large number of the fprintf(stderr, "*\n" calls with
> error_report(). The functions were renamed with these commands and then
> compiler issues where manually fixed.
> 
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N; {s|fprintf(stderr, 
> "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' 
> \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> 
> Some lines where then manually tweaked to pass checkpatch.
> 
> Signed-off-by: Alistair Francis <address@hidden>
> 
> Conversions that aren't followed by exit() dropped, because they might
> be inappropriate.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  hw/timer/xilinx_timer.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
> index 59439c05be..2d658b5791 100644
> --- a/hw/timer/xilinx_timer.c
> +++ b/hw/timer/xilinx_timer.c
> @@ -127,7 +127,7 @@ timer_read(void *opaque, hwaddr addr, unsigned int size)
>              break;
>  
>      }
> -    D(fprintf(stderr, "%s timer=%d %x=%x\n", __func__, timer, addr * 4, r));
> +    D(error_report("%s timer=%d %x=%x", __func__, timer, addr * 4, r));

Not sure what we gain here, since those aren't error messages but trace
event.
Can you drop this patch from your series? I'll convert to tracepoints
and send a patch for this file.

>      return r;
>  }
>  
> @@ -135,8 +135,8 @@ static void timer_enable(struct xlx_timer *xt)
>  {
>      uint64_t count;
>  
> -    D(fprintf(stderr, "%s timer=%d down=%d\n", __func__,
> -              xt->nr, xt->regs[R_TCSR] & TCSR_UDT));
> +    D(error_report("%s timer=%d down=%d", __func__,
> +                   xt->nr, xt->regs[R_TCSR] & TCSR_UDT));
>  
>      ptimer_stop(xt->ptimer);
>  
> @@ -160,7 +160,7 @@ timer_write(void *opaque, hwaddr addr,
>      addr >>= 2;
>      timer = timer_from_addr(addr);
>      xt = &t->timers[timer];
> -    D(fprintf(stderr, "%s addr=%x val=%x (timer=%d off=%d)\n",
> +    D(error_report("%s addr=%x val=%x (timer=%d off=%d)",
>               __func__, addr * 4, value, timer, addr & 3));
>      /* Further decoding to address a specific timers reg.  */
>      addr &= 3;
> @@ -197,7 +197,7 @@ static void timer_hit(void *opaque)
>  {
>      struct xlx_timer *xt = opaque;
>      struct timerblock *t = xt->parent;
> -    D(fprintf(stderr, "%s %d\n", __func__, xt->nr));
> +    D(error_report("%s %d", __func__, xt->nr));
>      xt->regs[R_TCSR] |= TCSR_TINT;
>  
>      if (xt->regs[R_TCSR] & TCSR_ARHT)
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]