diff mbox series

[v2,01/14] hw/input/pckbd: Use qemu_log_mask(GUEST_ERROR) instead of fprintf

Message ID 20180622134036.23182-2-f4bug@amsat.org
State New
Headers show
Series hw/arm: use qemu_log_mask instead of fprintf | expand

Commit Message

Philippe Mathieu-Daudé June 22, 2018, 1:40 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/input/pckbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Huth June 22, 2018, 7:24 p.m. UTC | #1
On 22.06.2018 15:40, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/input/pckbd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
> index f33e3fc63d..26aeac2326 100644
> --- a/hw/input/pckbd.c
> +++ b/hw/input/pckbd.c
> @@ -22,6 +22,7 @@
>   * THE SOFTWARE.
>   */
>  #include "qemu/osdep.h"
> +#include "qemu/log.h"
>  #include "hw/hw.h"
>  #include "hw/isa/isa.h"
>  #include "hw/i386/pc.h"
> @@ -308,7 +309,8 @@ static void kbd_write_command(void *opaque, hwaddr addr,
>          /* ignore that */
>          break;
>      default:
> -        fprintf(stderr, "qemu: unsupported keyboard cmd=0x%02x\n", (int)val);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "unsupported keyboard cmd=0x%02lx\n", val);

Sorry for not spotting it in v1 already, but val is a uint64_t value, so
you need PRIx64 as format string here, otherwise you'll get an error
with 32-bit compilers.

 Thomas
Philippe Mathieu-Daudé June 24, 2018, 3:48 a.m. UTC | #2
On 06/22/2018 04:24 PM, Thomas Huth wrote:
> On 22.06.2018 15:40, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  hw/input/pckbd.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
>> index f33e3fc63d..26aeac2326 100644
>> --- a/hw/input/pckbd.c
>> +++ b/hw/input/pckbd.c
>> @@ -22,6 +22,7 @@
>>   * THE SOFTWARE.
>>   */
>>  #include "qemu/osdep.h"
>> +#include "qemu/log.h"
>>  #include "hw/hw.h"
>>  #include "hw/isa/isa.h"
>>  #include "hw/i386/pc.h"
>> @@ -308,7 +309,8 @@ static void kbd_write_command(void *opaque, hwaddr addr,
>>          /* ignore that */
>>          break;
>>      default:
>> -        fprintf(stderr, "qemu: unsupported keyboard cmd=0x%02x\n", (int)val);
>> +        qemu_log_mask(LOG_GUEST_ERROR,
>> +                      "unsupported keyboard cmd=0x%02lx\n", val);
> 
> Sorry for not spotting it in v1 already, but val is a uint64_t value, so
> you need PRIx64 as format string here, otherwise you'll get an error
> with 32-bit compilers.

Good catch.

Our last CI tested 32-bit arch is MXE Win32.
diff mbox series

Patch

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index f33e3fc63d..26aeac2326 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -22,6 +22,7 @@ 
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu/log.h"
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
 #include "hw/i386/pc.h"
@@ -308,7 +309,8 @@  static void kbd_write_command(void *opaque, hwaddr addr,
         /* ignore that */
         break;
     default:
-        fprintf(stderr, "qemu: unsupported keyboard cmd=0x%02x\n", (int)val);
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "unsupported keyboard cmd=0x%02lx\n", val);
         break;
     }
 }