All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix
@ 2020-09-10 13:58 Philippe Mathieu-Daudé
  2020-09-10 13:58 ` [PATCH v2 1/2] hw/timer/hpet: Remove dead code Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-10 13:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Dov Murik, Paolo Bonzini,
	Philippe Mathieu-Daudé

Fix a format string and remove dead code.

Since v1:
- Addressed Dov comments (fix format string + style):
  https://www.mail-archive.com/qemu-devel@nongnu.org/msg739239.html

Philippe Mathieu-Daudé (2):
  hw/timer/hpet: Remove dead code
  hw/timer/hpet: Fix DPRINTF format string

 hw/timer/hpet.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

-- 
2.26.2



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

* [PATCH v2 1/2] hw/timer/hpet: Remove dead code
  2020-09-10 13:58 [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
@ 2020-09-10 13:58 ` Philippe Mathieu-Daudé
  2020-09-10 14:46   ` Li Qiang
  2020-09-10 13:58 ` [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string Philippe Mathieu-Daudé
  2020-09-10 14:08 ` [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
  2 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-10 13:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Dov Murik, Paolo Bonzini,
	Philippe Mathieu-Daudé

This code was never compiled/used, remove it.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/timer/hpet.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index 380acfa7c8a..b683f64f1d3 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -416,20 +416,6 @@ static void hpet_del_timer(HPETTimer *t)
     update_irq(t, 0);
 }
 
-#ifdef HPET_DEBUG
-static uint32_t hpet_ram_readb(void *opaque, hwaddr addr)
-{
-    printf("qemu: hpet_read b at %" PRIx64 "\n", addr);
-    return 0;
-}
-
-static uint32_t hpet_ram_readw(void *opaque, hwaddr addr)
-{
-    printf("qemu: hpet_read w at %" PRIx64 "\n", addr);
-    return 0;
-}
-#endif
-
 static uint64_t hpet_ram_read(void *opaque, hwaddr addr,
                               unsigned size)
 {
-- 
2.26.2



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

* [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string
  2020-09-10 13:58 [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
  2020-09-10 13:58 ` [PATCH v2 1/2] hw/timer/hpet: Remove dead code Philippe Mathieu-Daudé
@ 2020-09-10 13:58 ` Philippe Mathieu-Daudé
  2020-09-12 17:40   ` Dov Murik
  2020-09-10 14:08 ` [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
  2 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-10 13:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Dov Murik, Paolo Bonzini,
	Philippe Mathieu-Daudé

Fix building with HPET_DEBUG enabled:

  hw/timer/hpet.c:512:73: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
      DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value);
                                                            ~~~           ^~~~~
                                                            %#lx
  hw/timer/hpet.c:655:21: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
                      value, s->hpet_counter);
                      ^~~~~

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/timer/hpet.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index b683f64f1d3..20bd0388740 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -495,7 +495,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
     HPETState *s = opaque;
     uint64_t old_val, new_val, val, index;
 
-    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value);
+    DPRINTF("qemu: Enter hpet_ram_writel at %#" HWADDR_PRIx " = %#"PRIx64"\n",
+            addr, value);
     index = addr;
     old_val = hpet_ram_read(opaque, addr, 4);
     new_val = value;
@@ -637,7 +638,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
             }
             s->hpet_counter =
                 (s->hpet_counter & 0xffffffff00000000ULL) | value;
-            DPRINTF("qemu: HPET counter written. ctr = %#x -> %" PRIx64 "\n",
+            DPRINTF("qemu: HPET counter written. ctr = %#"
+                    PRIx64 " -> %#" PRIx64 "\n",
                     value, s->hpet_counter);
             break;
         case HPET_COUNTER + 4:
@@ -646,7 +648,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
             }
             s->hpet_counter =
                 (s->hpet_counter & 0xffffffffULL) | (((uint64_t)value) << 32);
-            DPRINTF("qemu: HPET counter + 4 written. ctr = %#x -> %" PRIx64 "\n",
+            DPRINTF("qemu: HPET counter + 4 written. ctr = %#"
+                    PRIx64 " -> %#" PRIx64 "\n",
                     value, s->hpet_counter);
             break;
         default:
-- 
2.26.2



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

* Re: [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix
  2020-09-10 13:58 [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
  2020-09-10 13:58 ` [PATCH v2 1/2] hw/timer/hpet: Remove dead code Philippe Mathieu-Daudé
  2020-09-10 13:58 ` [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string Philippe Mathieu-Daudé
@ 2020-09-10 14:08 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-10 14:08 UTC (permalink / raw)
  To: qemu-devel, Dov Murik
  Cc: qemu-trivial, Paolo Bonzini, Michael Tokarev, Laurent Vivier,
	Michael S. Tsirkin

On 9/10/20 3:58 PM, Philippe Mathieu-Daudé wrote:
> Fix a format string and remove dead code.
> 
> Since v1:
> - Addressed Dov comments (fix format string + style):
>   https://www.mail-archive.com/qemu-devel@nongnu.org/msg739239.html

Dov, since you sent the same patches/code and sign them with
your S-o-b, I added them here too, is that OK with you?

> 
> Philippe Mathieu-Daudé (2):
>   hw/timer/hpet: Remove dead code
>   hw/timer/hpet: Fix DPRINTF format string
> 
>  hw/timer/hpet.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)
> 



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

* Re: [PATCH v2 1/2] hw/timer/hpet: Remove dead code
  2020-09-10 13:58 ` [PATCH v2 1/2] hw/timer/hpet: Remove dead code Philippe Mathieu-Daudé
@ 2020-09-10 14:46   ` Li Qiang
  2020-09-10 14:50     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 9+ messages in thread
From: Li Qiang @ 2020-09-10 14:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Qemu Developers, Dov Murik, Paolo Bonzini

Philippe Mathieu-Daudé <philmd@redhat.com> 于2020年9月10日周四 下午10:01写道:
>
> This code was never compiled/used, remove it.
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/timer/hpet.c | 14 --------------
>  1 file changed, 14 deletions(-)
>
> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> index 380acfa7c8a..b683f64f1d3 100644
> --- a/hw/timer/hpet.c
> +++ b/hw/timer/hpet.c

Maybe we also remove the
"//#define HPET_DEBUG"
in the head of this file?

Thanks,
Li Qiang

> @@ -416,20 +416,6 @@ static void hpet_del_timer(HPETTimer *t)
>      update_irq(t, 0);
>  }
>
> -#ifdef HPET_DEBUG
> -static uint32_t hpet_ram_readb(void *opaque, hwaddr addr)
> -{
> -    printf("qemu: hpet_read b at %" PRIx64 "\n", addr);
> -    return 0;
> -}
> -
> -static uint32_t hpet_ram_readw(void *opaque, hwaddr addr)
> -{
> -    printf("qemu: hpet_read w at %" PRIx64 "\n", addr);
> -    return 0;
> -}
> -#endif
> -
>  static uint64_t hpet_ram_read(void *opaque, hwaddr addr,
>                                unsigned size)
>  {
> --
> 2.26.2
>
>


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

* Re: [PATCH v2 1/2] hw/timer/hpet: Remove dead code
  2020-09-10 14:46   ` Li Qiang
@ 2020-09-10 14:50     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-10 14:50 UTC (permalink / raw)
  To: Li Qiang
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Qemu Developers, Dov Murik, Paolo Bonzini

On 9/10/20 4:46 PM, Li Qiang wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> 于2020年9月10日周四 下午10:01写道:
>>
>> This code was never compiled/used, remove it.
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  hw/timer/hpet.c | 14 --------------
>>  1 file changed, 14 deletions(-)
>>
>> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
>> index 380acfa7c8a..b683f64f1d3 100644
>> --- a/hw/timer/hpet.c
>> +++ b/hw/timer/hpet.c
> 
> Maybe we also remove the
> "//#define HPET_DEBUG"
> in the head of this file?

We need to convert the debug calls to trace events first.

> 
> Thanks,
> Li Qiang
> 
>> @@ -416,20 +416,6 @@ static void hpet_del_timer(HPETTimer *t)
>>      update_irq(t, 0);
>>  }
>>
>> -#ifdef HPET_DEBUG
>> -static uint32_t hpet_ram_readb(void *opaque, hwaddr addr)
>> -{
>> -    printf("qemu: hpet_read b at %" PRIx64 "\n", addr);
>> -    return 0;
>> -}
>> -
>> -static uint32_t hpet_ram_readw(void *opaque, hwaddr addr)
>> -{
>> -    printf("qemu: hpet_read w at %" PRIx64 "\n", addr);
>> -    return 0;
>> -}
>> -#endif
>> -
>>  static uint64_t hpet_ram_read(void *opaque, hwaddr addr,
>>                                unsigned size)
>>  {
>> --
>> 2.26.2
>>
>>
> 



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

* Re: [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string
  2020-09-10 13:58 ` [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string Philippe Mathieu-Daudé
@ 2020-09-12 17:40   ` Dov Murik
  2020-09-13 11:40     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 9+ messages in thread
From: Dov Murik @ 2020-09-12 17:40 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Paolo Bonzini

Hi Phil,

On 10/09/2020 16:58, Philippe Mathieu-Daudé wrote:
> Fix building with HPET_DEBUG enabled:
> 
>    hw/timer/hpet.c:512:73: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
>        DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value);
>                                                              ~~~           ^~~~~
>                                                              %#lx
>    hw/timer/hpet.c:655:21: error: format specifies type 'unsigned int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Werror,-Wformat]
>                        value, s->hpet_counter);
>                        ^~~~~
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>   hw/timer/hpet.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
> index b683f64f1d3..20bd0388740 100644
> --- a/hw/timer/hpet.c
> +++ b/hw/timer/hpet.c
> @@ -495,7 +495,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>       HPETState *s = opaque;
>       uint64_t old_val, new_val, val, index;
> 
> -    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value);
> +    DPRINTF("qemu: Enter hpet_ram_writel at %#" HWADDR_PRIx " = %#"PRIx64"\n",
> +            addr, value);

You still use "#" in the format string; but qemu's CODING_STYLE.rst says:

//////////////

'#' printf flag
---------------

Do not use printf flag '#', like '%#x'.

Rationale: there are two ways to add a '0x' prefix to printed number: 
'0x%...'
and '%#...'. For consistency the only one way should be used. Arguments for
'0x%' are:

* it is more popular
* '%#' omits the 0x for the value 0 which makes output inconsistent

//////////////



According to that, I think the better solution would be:

DPRINTF("qemu: Enter hpet_ram_writel at 0x%" HWADDR_PRIx
         " = 0x%" PRIx64 "\n", addr, value);




>       index = addr;
>       old_val = hpet_ram_read(opaque, addr, 4);
>       new_val = value;
> @@ -637,7 +638,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>               }
>               s->hpet_counter =
>                   (s->hpet_counter & 0xffffffff00000000ULL) | value;
> -            DPRINTF("qemu: HPET counter written. ctr = %#x -> %" PRIx64 "\n",
> +            DPRINTF("qemu: HPET counter written. ctr = %#"
> +                    PRIx64 " -> %#" PRIx64 "\n",

ditto.

>                       value, s->hpet_counter);
>               break;
>           case HPET_COUNTER + 4:
> @@ -646,7 +648,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>               }
>               s->hpet_counter =
>                   (s->hpet_counter & 0xffffffffULL) | (((uint64_t)value) << 32);
> -            DPRINTF("qemu: HPET counter + 4 written. ctr = %#x -> %" PRIx64 "\n",
> +            DPRINTF("qemu: HPET counter + 4 written. ctr = %#"
> +                    PRIx64 " -> %#" PRIx64 "\n",

ditto.

>                       value, s->hpet_counter);
>               break;
>           default:
> 

-Dov


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

* Re: [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string
  2020-09-12 17:40   ` Dov Murik
@ 2020-09-13 11:40     ` Philippe Mathieu-Daudé
  2020-09-14  6:40       ` Dov Murik
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-13 11:40 UTC (permalink / raw)
  To: Dov Murik, qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Paolo Bonzini

On 9/12/20 7:40 PM, Dov Murik wrote:
> Hi Phil,
> 
> On 10/09/2020 16:58, Philippe Mathieu-Daudé wrote:
>> Fix building with HPET_DEBUG enabled:
>>
>>    hw/timer/hpet.c:512:73: error: format specifies type 'unsigned int'
>> but the argument has type 'uint64_t' (aka 'unsigned long')
>> [-Werror,-Wformat]
>>        DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n",
>> addr, value);
>>                                                             
>> ~~~           ^~~~~
>>                                                              %#lx
>>    hw/timer/hpet.c:655:21: error: format specifies type 'unsigned int'
>> but the argument has type 'uint64_t' (aka 'unsigned long')
>> [-Werror,-Wformat]
>>                        value, s->hpet_counter);
>>                        ^~~~~
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   hw/timer/hpet.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
>> index b683f64f1d3..20bd0388740 100644
>> --- a/hw/timer/hpet.c
>> +++ b/hw/timer/hpet.c
>> @@ -495,7 +495,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>>       HPETState *s = opaque;
>>       uint64_t old_val, new_val, val, index;
>>
>> -    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n",
>> addr, value);
>> +    DPRINTF("qemu: Enter hpet_ram_writel at %#" HWADDR_PRIx " =
>> %#"PRIx64"\n",
>> +            addr, value);
> 
> You still use "#" in the format string; but qemu's CODING_STYLE.rst says:
> 
> //////////////
> 
> '#' printf flag
> ---------------
> 
> Do not use printf flag '#', like '%#x'.
> 
> Rationale: there are two ways to add a '0x' prefix to printed number:
> '0x%...'
> and '%#...'. For consistency the only one way should be used. Arguments for
> '0x%' are:
> 
> * it is more popular
> * '%#' omits the 0x for the value 0 which makes output inconsistent

Yes you are right, I missed that.

Do you mind adding that check to ./checkpatch?

> 
> //////////////
> 
> 
> 
> According to that, I think the better solution would be:
> 
> DPRINTF("qemu: Enter hpet_ram_writel at 0x%" HWADDR_PRIx
>         " = 0x%" PRIx64 "\n", addr, value);
> 
> 
> 
> 
>>       index = addr;
>>       old_val = hpet_ram_read(opaque, addr, 4);
>>       new_val = value;
>> @@ -637,7 +638,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>>               }
>>               s->hpet_counter =
>>                   (s->hpet_counter & 0xffffffff00000000ULL) | value;
>> -            DPRINTF("qemu: HPET counter written. ctr = %#x -> %"
>> PRIx64 "\n",
>> +            DPRINTF("qemu: HPET counter written. ctr = %#"
>> +                    PRIx64 " -> %#" PRIx64 "\n",
> 
> ditto.
> 
>>                       value, s->hpet_counter);
>>               break;
>>           case HPET_COUNTER + 4:
>> @@ -646,7 +648,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>>               }
>>               s->hpet_counter =
>>                   (s->hpet_counter & 0xffffffffULL) |
>> (((uint64_t)value) << 32);
>> -            DPRINTF("qemu: HPET counter + 4 written. ctr = %#x -> %"
>> PRIx64 "\n",
>> +            DPRINTF("qemu: HPET counter + 4 written. ctr = %#"
>> +                    PRIx64 " -> %#" PRIx64 "\n",
> 
> ditto.
> 
>>                       value, s->hpet_counter);
>>               break;
>>           default:
>>
> 
> -Dov
> 



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

* Re: [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string
  2020-09-13 11:40     ` Philippe Mathieu-Daudé
@ 2020-09-14  6:40       ` Dov Murik
  0 siblings, 0 replies; 9+ messages in thread
From: Dov Murik @ 2020-09-14  6:40 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, qemu-trivial, Michael Tokarev,
	Laurent Vivier, Paolo Bonzini



On 13/09/2020 14:40, Philippe Mathieu-Daudé wrote:
> On 9/12/20 7:40 PM, Dov Murik wrote:
>> Hi Phil,
>>
>> On 10/09/2020 16:58, Philippe Mathieu-Daudé wrote:
>>> Fix building with HPET_DEBUG enabled:
>>>
>>>     hw/timer/hpet.c:512:73: error: format specifies type 'unsigned int'
>>> but the argument has type 'uint64_t' (aka 'unsigned long')
>>> [-Werror,-Wformat]
>>>         DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n",
>>> addr, value);
>>>                                                              
>>> ~~~           ^~~~~
>>>                                                               %#lx
>>>     hw/timer/hpet.c:655:21: error: format specifies type 'unsigned int'
>>> but the argument has type 'uint64_t' (aka 'unsigned long')
>>> [-Werror,-Wformat]
>>>                         value, s->hpet_counter);
>>>                         ^~~~~
>>>
>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>> Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>>    hw/timer/hpet.c | 9 ++++++---
>>>    1 file changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
>>> index b683f64f1d3..20bd0388740 100644
>>> --- a/hw/timer/hpet.c
>>> +++ b/hw/timer/hpet.c
>>> @@ -495,7 +495,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
>>>        HPETState *s = opaque;
>>>        uint64_t old_val, new_val, val, index;
>>>
>>> -    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n",
>>> addr, value);
>>> +    DPRINTF("qemu: Enter hpet_ram_writel at %#" HWADDR_PRIx " =
>>> %#"PRIx64"\n",
>>> +            addr, value);
>>
>> You still use "#" in the format string; but qemu's CODING_STYLE.rst says:
>>
>> //////////////
>>
>> '#' printf flag
>> ---------------
>>
>> Do not use printf flag '#', like '%#x'.
>>
>> Rationale: there are two ways to add a '0x' prefix to printed number:
>> '0x%...'
>> and '%#...'. For consistency the only one way should be used. Arguments for
>> '0x%' are:
>>
>> * it is more popular
>> * '%#' omits the 0x for the value 0 which makes output inconsistent
> 
> Yes you are right, I missed that.
> 
> Do you mind adding that check to ./checkpatch?

Fix to checkpatch sent in another patch:

https://www.mail-archive.com/qemu-devel@nongnu.org/msg740065.html

-Dov


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

end of thread, other threads:[~2020-09-14  6:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 13:58 [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé
2020-09-10 13:58 ` [PATCH v2 1/2] hw/timer/hpet: Remove dead code Philippe Mathieu-Daudé
2020-09-10 14:46   ` Li Qiang
2020-09-10 14:50     ` Philippe Mathieu-Daudé
2020-09-10 13:58 ` [PATCH v2 2/2] hw/timer/hpet: Fix DPRINTF format string Philippe Mathieu-Daudé
2020-09-12 17:40   ` Dov Murik
2020-09-13 11:40     ` Philippe Mathieu-Daudé
2020-09-14  6:40       ` Dov Murik
2020-09-10 14:08 ` [PATCH v2 0/2] hw/timer/hpet: Trivial format string fix Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.