[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] memory: Make memory_region_to_absolute_addr() take a const M
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 3/3] memory: Make memory_region_to_absolute_addr() take a const MemoryRegion |
Date: |
Sat, 6 Mar 2021 00:54:14 +0100 |
There is no reason to not have memory_region_to_absolute_addr()
work with a const MemoryRegion. Else we get:
softmmu/memory.c: error: passing argument 1 of ‘memory_region_to_absolute_addr’
discards ‘const’ qualifier from pointer target type
[-Werror=discarded-qualifiers]
6666 | myaddr = memory_region_to_absolute_addr(constmr, addr);
| ^~
softmmu/memory.c:410:60: note: expected ‘MemoryRegion *’ but argument is of
type ‘const MemoryRegion *’
410 | static hwaddr memory_region_to_absolute_addr(MemoryRegion *mr, hwaddr
offset)
| ~~~~~~~~~~~~~~^~
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
softmmu/memory.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 991d9227a88..6d1e96ba37d 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -407,9 +407,10 @@ static inline uint64_t
memory_region_shift_write_access(uint64_t *value,
return tmp;
}
-static hwaddr memory_region_to_absolute_addr(MemoryRegion *mr, hwaddr offset)
+static hwaddr memory_region_to_absolute_addr(const MemoryRegion *mr,
+ hwaddr offset)
{
- MemoryRegion *root;
+ const MemoryRegion *root;
hwaddr abs_addr = offset;
abs_addr += mr->addr;
--
2.26.2
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), (continued)
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Philippe Mathieu-Daudé, 2021/03/11
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Philippe Mathieu-Daudé, 2021/03/11
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Peter Xu, 2021/03/11
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Philippe Mathieu-Daudé, 2021/03/11
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Cédric Le Goater, 2021/03/12
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Peter Xu, 2021/03/11
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Philippe Mathieu-Daudé, 2021/03/11
- Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io(), Jiaxun Yang, 2021/03/10
- Re: [PATCH 2/3] memory: Provide 'base address' argument to mtree_print_mr(), Peter Xu, 2021/03/10
- Re: [PATCH 2/3] memory: Provide 'base address' argument to mtree_print_mr(), Mark Cave-Ayland, 2021/03/10
[PATCH 3/3] memory: Make memory_region_to_absolute_addr() take a const MemoryRegion,
Philippe Mathieu-Daudé <=