[5/9] exec: Replace enum device_endian with MemOp
diff mbox series

Message ID ede636b9438e0c6ddc16292fe776b6569fb87cbf.1566588034.git.tony.nguyen@bt.com
State New
Headers show
Series
  • [1/9] exec: Map device_endian onto MemOp
Related show

Commit Message

Tony Nguyen Aug. 23, 2019, 7:42 p.m. UTC
Simplify endianness comparisons with consistent use of the more
expressive MemOp.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Tony Nguyen <tony.nguyen@bt.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/char/serial.c         |  2 +-
 include/exec/memory.h    |  6 +++---
 include/hw/char/serial.h |  2 +-
 memory.c                 |  2 +-
 memory_ldst.inc.c        | 15 ++++++---------
 5 files changed, 12 insertions(+), 15 deletions(-)

Patch
diff mbox series

diff --git a/hw/char/serial.c b/hw/char/serial.c
index cf41203be6..c725688828 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -1036,7 +1036,7 @@  static const MemoryRegionOps serial_mm_ops[2] = {
 SerialState *serial_mm_init(MemoryRegion *address_space,
                             hwaddr base, int it_shift,
                             qemu_irq irq, int baudbase,
-                            Chardev *chr, enum device_endian end)
+                            Chardev *chr, MemOp end)
 {
     SerialState *s;
 
diff --git a/include/exec/memory.h b/include/exec/memory.h
index c4c86a6ff4..1fa7e03707 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -168,7 +168,7 @@  struct MemoryRegionOps {
                                     unsigned size,
                                     MemTxAttrs attrs);
 
-    enum device_endian endianness;
+    MemOp endianness;
     /* Guest-visible constraints: */
     struct {
         /* If nonzero, specify bounds on access sizes beyond which a machine
@@ -2211,8 +2211,8 @@  address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
     }
 }
 
-/* enum device_endian to MemOp.  */
-MemOp devend_memop(enum device_endian end);
+/* MemOp to MemOp.  */
+MemOp devend_memop(MemOp end);
 
 #endif
 
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 8be3d8a4f9..175b980249 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -90,7 +90,7 @@  SerialState *serial_init(int base, qemu_irq irq, int baudbase,
 SerialState *serial_mm_init(MemoryRegion *address_space,
                             hwaddr base, int it_shift,
                             qemu_irq irq, int baudbase,
-                            Chardev *chr, enum device_endian end);
+                            Chardev *chr, MemOp end);
 
 /* serial-isa.c */
 
diff --git a/memory.c b/memory.c
index 52090e18eb..ee2bef7b1e 100644
--- a/memory.c
+++ b/memory.c
@@ -3272,7 +3272,7 @@  static void memory_register_types(void)
 
 type_init(memory_register_types)
 
-MemOp devend_memop(enum device_endian end)
+MemOp devend_memop(MemOp end)
 {
     static MemOp conv[] = {
         [MO_LE] = MO_LE,
diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c
index 45bec83a94..dd1e02d685 100644
--- a/memory_ldst.inc.c
+++ b/memory_ldst.inc.c
@@ -21,8 +21,7 @@ 
 
 /* warning: addr must be aligned */
 static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL,
-    hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
-    enum device_endian endian)
+    hwaddr addr, MemTxAttrs attrs, MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     uint64_t val;
@@ -89,8 +88,7 @@  uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL,
 
 /* warning: addr must be aligned */
 static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL,
-    hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
-    enum device_endian endian)
+    hwaddr addr, MemTxAttrs attrs, MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     uint64_t val;
@@ -191,8 +189,7 @@  uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
 
 /* warning: addr must be aligned */
 static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
-    hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
-    enum device_endian endian)
+    hwaddr addr, MemTxAttrs attrs, MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     uint64_t val;
@@ -299,7 +296,7 @@  void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL,
 /* warning: addr must be aligned */
 static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL,
     hwaddr addr, uint32_t val, MemTxAttrs attrs,
-    MemTxResult *result, enum device_endian endian)
+    MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     MemoryRegion *mr;
@@ -395,7 +392,7 @@  void glue(address_space_stb, SUFFIX)(ARG1_DECL,
 /* warning: addr must be aligned */
 static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL,
     hwaddr addr, uint32_t val, MemTxAttrs attrs,
-    MemTxResult *result, enum device_endian endian)
+    MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     MemoryRegion *mr;
@@ -459,7 +456,7 @@  void glue(address_space_stw_be, SUFFIX)(ARG1_DECL,
 
 static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL,
     hwaddr addr, uint64_t val, MemTxAttrs attrs,
-    MemTxResult *result, enum device_endian endian)
+    MemTxResult *result, MemOp endian)
 {
     uint8_t *ptr;
     MemoryRegion *mr;