[v3,40/41] hw/loader: Use the BYTE-based definitions

Message ID 20180415234307.28132-41-f4bug@amsat.org
State New
Headers show
Series
  • hw: Use the BYTE-based definitions when useful
Related show

Commit Message

Philippe Mathieu-Daudé April 15, 2018, 11:43 p.m.
It eases code review, unit is explicit.

Patch generated using:

  $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/

and modified manually.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/loader.h  | 5 +++--
 hw/core/loader-fit.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/include/hw/loader.h b/include/hw/loader.h
index 5ed3fd8ae6..2222ca4184 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -1,5 +1,6 @@ 
 #ifndef LOADER_H
 #define LOADER_H
+#include "qemu/units.h"
 #include "hw/nvram/fw_cfg.h"
 
 /* loader.c */
@@ -52,7 +53,7 @@  int load_image_mr(const char *filename, MemoryRegion *mr);
  * load_image_gzipped_buffer() and load_image_gzipped() will read. It prevents
  * g_malloc() in those functions from allocating a huge amount of memory.
  */
-#define LOAD_IMAGE_MAX_GUNZIP_BYTES (256 << 20)
+#define LOAD_IMAGE_MAX_GUNZIP_BYTES (256 * M_BYTE)
 
 int load_image_gzipped_buffer(const char *filename, uint64_t max_sz,
                               uint8_t **buffer);
@@ -253,6 +254,6 @@  int rom_add_option(const char *file, int32_t bootindex);
 
 /* This is the usual maximum in uboot, so if a uImage overflows this, it would
  * overflow on real hardware too. */
-#define UBOOT_MAX_GUNZIP_BYTES (64 << 20)
+#define UBOOT_MAX_GUNZIP_BYTES (64 * M_BYTE)
 
 #endif
diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
index 0c4a7207f4..0117104d69 100644
--- a/hw/core/loader-fit.c
+++ b/hw/core/loader-fit.c
@@ -22,7 +22,7 @@ 
 #include "exec/memory.h"
 #include "hw/loader.h"
 #include "hw/loader-fit.h"
-#include "qemu/cutils.h"
+#include "qemu/units.h"
 #include "qemu/error-report.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"