qemu/scripts/coccinelle/memory-region-init-ram.cocci
<<
>>
Prefs
   1// Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram
   2// code sequences with use of the new memory_region_init_ram function.
   3// Similarly for the _rom and _rom_device functions.
   4// We don't try to replace sequences with a non-NULL owner, because
   5// there are none in the tree that can be automatically converted
   6// (and only a handful that can be manually converted).
   7@@
   8expression MR;
   9expression NAME;
  10expression SIZE;
  11expression ERRP;
  12@@
  13-memory_region_init_ram_nomigrate(MR, NULL, NAME, SIZE, ERRP);
  14+memory_region_init_ram(MR, NULL, NAME, SIZE, ERRP);
  15 ...
  16-vmstate_register_ram_global(MR);
  17@@
  18expression MR;
  19expression NAME;
  20expression SIZE;
  21expression ERRP;
  22@@
  23-memory_region_init_rom_nomigrate(MR, NULL, NAME, SIZE, ERRP);
  24+memory_region_init_rom(MR, NULL, NAME, SIZE, ERRP);
  25 ...
  26-vmstate_register_ram_global(MR);
  27@@
  28expression MR;
  29expression OPS;
  30expression OPAQUE;
  31expression NAME;
  32expression SIZE;
  33expression ERRP;
  34@@
  35-memory_region_init_rom_device_nomigrate(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP);
  36+memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP);
  37 ...
  38-vmstate_register_ram_global(MR);
  39