diff mbox series

[08/11] hw/arm/omap: Use qemu_log_mask(GUEST_ERROR) instead of fprintf

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

Commit Message

Philippe Mathieu-Daudé June 21, 2018, 6:02 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/arm/omap.h | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

Comments

Thomas Huth June 22, 2018, 8:34 a.m. UTC | #1
On 21.06.2018 20:02, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/arm/omap.h | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
[...]
> @@ -997,14 +998,17 @@ enum {
>  
>  # ifdef TCMI_VERBOSE
>  #  define OMAP_8B_REG(paddr)		\
> -        fprintf(stderr, "%s: 8-bit register " OMAP_FMT_plx "\n",	\
> -                        __func__, paddr)
> +        qemu_log_mask(LOG_GUEST_ERROR, \
> +                      "%s: 8-bit register " OMAP_FMT_plx "\n", \
> +                      __func__, paddr)
>  #  define OMAP_16B_REG(paddr)		\
> -        fprintf(stderr, "%s: 16-bit register " OMAP_FMT_plx "\n",	\
> -                        __func__, paddr)
> +        qemu_log_mask(LOG_GUEST_ERROR, \
> +                      "%s: 16-bit register " OMAP_FMT_plx "\n", \
> +                      __func__, paddr)
>  #  define OMAP_32B_REG(paddr)		\
> -        fprintf(stderr, "%s: 32-bit register " OMAP_FMT_plx "\n",	\
> -                        __func__, paddr)
> +        qemu_log_mask(LOG_GUEST_ERROR, \
> +                      "%s: 32-bit register " OMAP_FMT_plx "\n", \
> +                      __func__, paddr)
>  # else
>  #  define OMAP_8B_REG(paddr)
>  #  define OMAP_16B_REG(paddr)
> 

Since the qemu_log_mask(LOG_GUEST_ERROR, ...) calls are not shown up by
default anymore, I think it would rather be better to get rid of this
#ifdef TCMI_VERBOSE ... #endif block now and put the qemu_log_mask()
statements directly into the omap_badwidth_* functions instead.

 Thomas
Philippe Mathieu-Daudé June 22, 2018, 1:23 p.m. UTC | #2
On 06/22/2018 05:34 AM, Thomas Huth wrote:
> On 21.06.2018 20:02, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  include/hw/arm/omap.h | 20 ++++++++++++--------
>>  1 file changed, 12 insertions(+), 8 deletions(-)
> [...]
>> @@ -997,14 +998,17 @@ enum {
>>  
>>  # ifdef TCMI_VERBOSE
>>  #  define OMAP_8B_REG(paddr)		\
>> -        fprintf(stderr, "%s: 8-bit register " OMAP_FMT_plx "\n",	\
>> -                        __func__, paddr)
>> +        qemu_log_mask(LOG_GUEST_ERROR, \
>> +                      "%s: 8-bit register " OMAP_FMT_plx "\n", \
>> +                      __func__, paddr)
>>  #  define OMAP_16B_REG(paddr)		\
>> -        fprintf(stderr, "%s: 16-bit register " OMAP_FMT_plx "\n",	\
>> -                        __func__, paddr)
>> +        qemu_log_mask(LOG_GUEST_ERROR, \
>> +                      "%s: 16-bit register " OMAP_FMT_plx "\n", \
>> +                      __func__, paddr)
>>  #  define OMAP_32B_REG(paddr)		\
>> -        fprintf(stderr, "%s: 32-bit register " OMAP_FMT_plx "\n",	\
>> -                        __func__, paddr)
>> +        qemu_log_mask(LOG_GUEST_ERROR, \
>> +                      "%s: 32-bit register " OMAP_FMT_plx "\n", \
>> +                      __func__, paddr)
>>  # else
>>  #  define OMAP_8B_REG(paddr)
>>  #  define OMAP_16B_REG(paddr)
>>
> 
> Since the qemu_log_mask(LOG_GUEST_ERROR, ...) calls are not shown up by
> default anymore, I think it would rather be better to get rid of this
> #ifdef TCMI_VERBOSE ... #endif block now and put the qemu_log_mask()
> statements directly into the omap_badwidth_* functions instead.

Good idea!
diff mbox series

Patch

diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index b398607b06..3d805b6174 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -21,6 +21,7 @@ 
 # define hw_omap_h		"omap.h"
 #include "hw/irq.h"
 #include "target/arm/cpu-qom.h"
+#include "qemu/log.h"
 
 # define OMAP_EMIFS_BASE	0x00000000
 # define OMAP2_Q0_BASE		0x00000000
@@ -962,8 +963,8 @@  void omap_mpu_wakeup(void *opaque, int irq, int req);
         fprintf(stderr, "%s: Bad register " OMAP_FMT_plx "\n",	\
                         __func__, paddr)
 # define OMAP_RO_REG(paddr)		\
-        fprintf(stderr, "%s: Read-only register " OMAP_FMT_plx "\n",	\
-                        __func__, paddr)
+        qemu_log_mask(LOG_GUEST_ERROR, "%s: Read-only register " OMAP_FMT_plx \
+                      "\n", __func__, paddr)
 
 /* OMAP-specific Linux bootloader tags for the ATAG_BOARD area
    (Board-specifc tags are not here)  */
@@ -997,14 +998,17 @@  enum {
 
 # ifdef TCMI_VERBOSE
 #  define OMAP_8B_REG(paddr)		\
-        fprintf(stderr, "%s: 8-bit register " OMAP_FMT_plx "\n",	\
-                        __func__, paddr)
+        qemu_log_mask(LOG_GUEST_ERROR, \
+                      "%s: 8-bit register " OMAP_FMT_plx "\n", \
+                      __func__, paddr)
 #  define OMAP_16B_REG(paddr)		\
-        fprintf(stderr, "%s: 16-bit register " OMAP_FMT_plx "\n",	\
-                        __func__, paddr)
+        qemu_log_mask(LOG_GUEST_ERROR, \
+                      "%s: 16-bit register " OMAP_FMT_plx "\n", \
+                      __func__, paddr)
 #  define OMAP_32B_REG(paddr)		\
-        fprintf(stderr, "%s: 32-bit register " OMAP_FMT_plx "\n",	\
-                        __func__, paddr)
+        qemu_log_mask(LOG_GUEST_ERROR, \
+                      "%s: 32-bit register " OMAP_FMT_plx "\n", \
+                      __func__, paddr)
 # else
 #  define OMAP_8B_REG(paddr)
 #  define OMAP_16B_REG(paddr)