5 --macro-file scripts/cocci-macro-file.h \
6 --sp-file scripts/coccinelle/memory-region-housekeeping.cocci \
14 // Replace memory_region_init_ram(readonly) by memory_region_init_rom()
16 expression E1, E2, E3, E4, E5;
20 - memory_region_init_ram(E1, E2, E3, E4, E5);
21 + memory_region_init_rom(E1, E2, E3, E4, E5);
23 - memory_region_set_readonly(E1, true);
25 - memory_region_init_ram_nomigrate(E1, E2, E3, E4, E5);
26 + memory_region_init_rom_nomigrate(E1, E2, E3, E4, E5);
28 - memory_region_set_readonly(E1, true);
32 @possible_memory_region_init_rom@
33 expression E1, E2, E3, E4, E5;
37 memory_region_init_ram@p(E1, E2, E3, E4, E5);
39 memory_region_set_readonly(E1, true);
41 memory_region_init_ram_nomigrate@p(E1, E2, E3, E4, E5);
43 memory_region_set_readonly(E1, true);
46 p << possible_memory_region_init_rom.p;
48 cocci.print_main("potential use of memory_region_init_rom*() in ", p)
51 // Do not call memory_region_set_readonly() on ROM alias
53 expression ROM, E1, E2, E3, E4;
54 expression ALIAS, E5, E6, E7, E8;
57 memory_region_init_rom(ROM, E1, E2, E3, E4);
59 memory_region_init_rom_nomigrate(ROM, E1, E2, E3, E4);
62 memory_region_init_alias(ALIAS, E5, E6, ROM, E7, E8);
63 - memory_region_set_readonly(ALIAS, true);
66 // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram
67 // code sequences with use of the new memory_region_init_ram function.
68 // Similarly for the _rom and _rom_device functions.
69 // We don't try to replace sequences with a non-NULL owner, because
70 // there are none in the tree that can be automatically converted
71 // (and only a handful that can be manually converted).
78 -memory_region_init_ram_nomigrate(MR, NULL, NAME, SIZE, ERRP);
79 +memory_region_init_ram(MR, NULL, NAME, SIZE, ERRP);
81 -vmstate_register_ram_global(MR);
88 -memory_region_init_rom_nomigrate(MR, NULL, NAME, SIZE, ERRP);
89 +memory_region_init_rom(MR, NULL, NAME, SIZE, ERRP);
91 -vmstate_register_ram_global(MR);
100 -memory_region_init_rom_device_nomigrate(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP);
101 +memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP);
103 -vmstate_register_ram_global(MR);
109 identifier device_fn, dev, obj;
110 expression E1, E2, E3, E4, E5;
112 static void device_fn(DeviceState *dev, ...)
115 Object *obj = OBJECT(dev);
118 - memory_region_init(E1, NULL, E2, E3);
119 + memory_region_init(E1, obj, E2, E3);
121 - memory_region_init_io(E1, NULL, E2, E3, E4, E5);
122 + memory_region_init_io(E1, obj, E2, E3, E4, E5);
124 - memory_region_init_alias(E1, NULL, E2, E3, E4, E5);
125 + memory_region_init_alias(E1, obj, E2, E3, E4, E5);
127 - memory_region_init_rom(E1, NULL, E2, E3, E4);
128 + memory_region_init_rom(E1, obj, E2, E3, E4);
130 - memory_region_init_ram_shared_nomigrate(E1, NULL, E2, E3, E4, E5);
131 + memory_region_init_ram_shared_nomigrate(E1, obj, E2, E3, E4, E5);
136 identifier device_fn, dev;
137 expression E1, E2, E3, E4, E5;
139 static void device_fn(DeviceState *dev, ...)
143 - memory_region_init(E1, NULL, E2, E3);
144 + memory_region_init(E1, OBJECT(dev), E2, E3);
146 - memory_region_init_io(E1, NULL, E2, E3, E4, E5);
147 + memory_region_init_io(E1, OBJECT(dev), E2, E3, E4, E5);
149 - memory_region_init_alias(E1, NULL, E2, E3, E4, E5);
150 + memory_region_init_alias(E1, OBJECT(dev), E2, E3, E4, E5);
152 - memory_region_init_rom(E1, NULL, E2, E3, E4);
153 + memory_region_init_rom(E1, OBJECT(dev), E2, E3, E4);
155 - memory_region_init_ram_shared_nomigrate(E1, NULL, E2, E3, E4, E5);
156 + memory_region_init_ram_shared_nomigrate(E1, OBJECT(dev), E2, E3, E4, E5);