[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/12] hw/block/pflash_cfi02: Open-code pflash_register_memory
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 05/12] hw/block/pflash_cfi02: Open-code pflash_register_memory(rom=false) |
Date: |
Wed, 10 Mar 2021 18:05:21 +0100 |
There is only one call to pflash_register_memory() with
rom_mode == false. As we want to modify pflash_register_memory()
in the next patch, open-code this trivial function in place for
the 'rom_mode == false' case.
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/block/pflash_cfi02.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 0eb868ecd3d..897b7333222 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -467,8 +467,10 @@ static void pflash_write(void *opaque, hwaddr offset,
uint64_t value,
switch (pfl->wcycle) {
case 0:
/* Set the device in I/O access mode if required */
- if (pfl->rom_mode)
- pflash_register_memory(pfl, 0);
+ if (pfl->rom_mode) {
+ pfl->rom_mode = false;
+ memory_region_rom_device_set_romd(&pfl->orig_mem, false);
+ }
pfl->read_counter = 0;
/* We're in read mode */
check_unlock0:
--
2.26.2
- [PATCH v2 00/12] hw/block/pflash: Refactors around setting the device in read-array mode, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 01/12] hw/block/pflash_cfi: Fix code style for checkpatch.pl, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 02/12] hw/block/pflash_cfi01: Extract pflash_cfi01_fill_cfi_table(), Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 03/12] hw/block/pflash_cfi02: Extract pflash_cfi02_fill_cfi_table(), Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 04/12] hw/block/pflash_cfi02: Set rom_mode to true in pflash_setup_mappings(), Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 05/12] hw/block/pflash_cfi02: Open-code pflash_register_memory(rom=false),
Philippe Mathieu-Daudé <=
- [PATCH v2 06/12] hw/block/pflash_cfi02: Rename register_memory(true) as mode_read_array, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 07/12] hw/block/pflash_cfi02: Factor out pflash_reset_state_machine(), Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 08/12] hw/block/pflash_cfi02: Add DeviceReset method, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 09/12] hw/block/pflash_cfi01: Clarify trace events, Philippe Mathieu-Daudé, 2021/03/10
- [PATCH v2 10/12] hw/block/pflash_cfi01: Extract pflash_mode_read_array(), Philippe Mathieu-Daudé, 2021/03/10