Patchwork serial: Fix debug format strings

login
register
mail settings
Submitter Kevin Wolf
Date March 19, 2013, 11:25 a.m.
Message ID <1363692343-22299-1-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/229014/
State New
Headers show

Comments

Kevin Wolf - March 19, 2013, 11:25 a.m.
This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Markus Armbruster - March 19, 2013, 12:51 p.m.
Cc'ing qemu-trivial

Kevin Wolf <kwolf@redhat.com> writes:

> This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  hw/serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/serial.c b/hw/serial.c
> index 48a5eb6..0ccc499 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
> @@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
>      SerialState *s = opaque;
>  
>      addr &= 7;
> -    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
> +    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);
>      switch(addr) {
>      default:
>      case 0:
> @@ -527,7 +527,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
>          ret = s->scr;
>          break;
>      }
> -    DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
> +    DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret);
>      return ret;
>  }
Andreas Färber - March 19, 2013, 1:29 p.m.
Am 19.03.2013 12:25, schrieb Kevin Wolf:
> This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  hw/serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/serial.c b/hw/serial.c
> index 48a5eb6..0ccc499 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
> @@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
>      SerialState *s = opaque;
>  
>      addr &= 7;
> -    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
> +    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);

Are you intentionally dropping 02 in both places? That changes output FWIW.

Andreas

>      switch(addr) {
>      default:
>      case 0:
> @@ -527,7 +527,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
>          ret = s->scr;
>          break;
>      }
> -    DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
> +    DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret);
>      return ret;
>  }
>  
>
Kevin Wolf - March 19, 2013, 1:42 p.m.
Am 19.03.2013 um 14:29 hat Andreas Färber geschrieben:
> Am 19.03.2013 12:25, schrieb Kevin Wolf:
> > This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  hw/serial.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/serial.c b/hw/serial.c
> > index 48a5eb6..0ccc499 100644
> > --- a/hw/serial.c
> > +++ b/hw/serial.c
> > @@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
> >      SerialState *s = opaque;
> >  
> >      addr &= 7;
> > -    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
> > +    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);
> 
> Are you intentionally dropping 02 in both places? That changes output FWIW.

%02 for 64 bit values felt odd, but I think they might be guaranteed to
be small enough in practice. If you really prefer, I can send a v2 which
adds it back. But it's only debug code, so... *shrug*

Kevin
Stefan Hajnoczi - March 22, 2013, 12:31 p.m.
On Tue, Mar 19, 2013 at 12:25:43PM +0100, Kevin Wolf wrote:
> This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  hw/serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

Patch

diff --git a/hw/serial.c b/hw/serial.c
index 48a5eb6..0ccc499 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -306,7 +306,7 @@  static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     SerialState *s = opaque;
 
     addr &= 7;
-    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
+    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);
     switch(addr) {
     default:
     case 0:
@@ -527,7 +527,7 @@  static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
         ret = s->scr;
         break;
     }
-    DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
+    DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret);
     return ret;
 }