scripts/cocci: Patch to replace memory_region_init_{ram,readonly -> rom}

Add a semantic patch to replace memory_region_init_ram(readonly)
by memory_region_init_rom().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2020-02-24 19:23:40 +01:00 committed by Paolo Bonzini
parent 044e2af9f5
commit d3ec684d70

View File

@ -11,6 +11,24 @@
*/ */
// Replace memory_region_init_ram(readonly) by memory_region_init_rom()
@@
expression E1, E2, E3, E4, E5;
symbol true;
@@
(
- memory_region_init_ram(E1, E2, E3, E4, E5);
+ memory_region_init_rom(E1, E2, E3, E4, E5);
... WHEN != E1
- memory_region_set_readonly(E1, true);
|
- memory_region_init_ram_nomigrate(E1, E2, E3, E4, E5);
+ memory_region_init_rom_nomigrate(E1, E2, E3, E4, E5);
... WHEN != E1
- memory_region_set_readonly(E1, true);
)
// Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram
// code sequences with use of the new memory_region_init_ram function. // code sequences with use of the new memory_region_init_ram function.
// Similarly for the _rom and _rom_device functions. // Similarly for the _rom and _rom_device functions.