Skip to contentSkip to conversation

hw/timer/hpet: Trivial format string fix

PATCH Applied Philippe Mathieu-Daudé 3 participants 7 messages Sep 3, 2020 – Sep 9, 2020

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover hw/timer/hpet: Trivial format string fix

Fix a format string and remove dead code.

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

 hw/timer/hpet.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/2 hw/timer/hpet: Remove dead code

This code was never compiled/used, remove it.

---
 hw/timer/hpet.c | 14 --------------
 1 file changed, 14 deletions(-)
hw/timer/hpet.c +0 -14
index 380acfa7c8a..b683f64f1d3 100644
@@ -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)
 {
Signature · 1 line
2.26.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] hw/timer/hpet: Remove dead code

Quoted 23 lines · Philippe Mathieu-Daudé

This code was never compiled/used, remove it.

---
 hw/timer/hpet.c | 14 --------------
 1 file changed, 14 deletions(-)
hw/timer/hpet.c +0 -7
index 380acfa7c8a..b683f64f1d3 100644
@@ -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;
-}
-

hw/timer/hpet.c static void hpet_del_timer(HPETTimer *t) · line 421

Quoted 10 lines
hw/timer/hpet.c +0 -7
-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)
 {
#3 lore raw

Re: [PATCH 1/2] hw/timer/hpet: Remove dead code

In reply to Philippe Mathieu-Daudé

Le 03/09/2020 à 15:45, Philippe Mathieu-Daudé a écrit :

Quoted 23 lines

This code was never compiled/used, remove it.

---
 hw/timer/hpet.c | 14 --------------
 1 file changed, 14 deletions(-)
hw/timer/hpet.c +0 -7
index 380acfa7c8a..b683f64f1d3 100644
@@ -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;
-}
-

hw/timer/hpet.c static void hpet_del_timer(HPETTimer *t) · line 421

Quoted 10 lines
hw/timer/hpet.c +0 -7
-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)
 {

Applied to my trivial-patches branch.

Thanks,
Laurent

#4 lore raw

PATCH 2/2 hw/timer/hpet: Fix DPRINTF format string

In reply to 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);
                      ^~~~~

---
Keep trace-events conversion as ByteSizeTask.

---
 hw/timer/hpet.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/timer/hpet.c +3 -3
index b683f64f1d3..8115e42cff3 100644
@@ -495,7 +495,7 @@ 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 0x%" HWADDR_PRIx " = 0x%#"PRIx64"\n", addr, value);
     index = addr;
     old_val = hpet_ram_read(opaque, addr, 4);
     new_val = value;
@@ -637,7 +637,7 @@ 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 +646,7 @@ 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:
Signature · 1 line
2.26.2
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] hw/timer/hpet: Fix DPRINTF format string

Quoted 41 lines · 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);
                      ^~~~~

---
Keep trace-events conversion as ByteSizeTask.

---
 hw/timer/hpet.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/timer/hpet.c +2 -2
index b683f64f1d3..8115e42cff3 100644
@@ -495,7 +495,7 @@ 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 0x%" HWADDR_PRIx " = 0x%#"PRIx64"\n", addr, value);
     index = addr;
     old_val = hpet_ram_read(opaque, addr, 4);
     new_val = value;
@@ -637,7 +637,7 @@ 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:

hw/timer/hpet.c static void hpet_ram_write(void *opaque, hwaddr addr, · line 652

Quoted 8 lines
hw/timer/hpet.c +1 -1
@@ -646,7 +646,7 @@ 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:
#6 lore raw

Re: [PATCH 2/2] hw/timer/hpet: Fix DPRINTF format string

In reply to Philippe Mathieu-Daudé

Le 03/09/2020 à 15:45, Philippe Mathieu-Daudé a écrit :

Quoted 41 lines

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);
                      ^~~~~

---
Keep trace-events conversion as ByteSizeTask.

---
 hw/timer/hpet.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/timer/hpet.c +2 -2
index b683f64f1d3..8115e42cff3 100644
@@ -495,7 +495,7 @@ 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 0x%" HWADDR_PRIx " = 0x%#"PRIx64"\n", addr, value);
     index = addr;
     old_val = hpet_ram_read(opaque, addr, 4);
     new_val = value;
@@ -637,7 +637,7 @@ 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:

hw/timer/hpet.c static void hpet_ram_write(void *opaque, hwaddr addr, · line 652

Quoted 8 lines
hw/timer/hpet.c +1 -1
@@ -646,7 +646,7 @@ 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:

Applied to my trivial-patches branch.

Thanks,
Laurent