From nobody Wed Nov 5 09:02:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499438938957202.57983219604; Fri, 7 Jul 2017 07:48:58 -0700 (PDT) Received: from localhost ([::1]:56910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTUYy-0001sB-Ip for importer@patchew.org; Fri, 07 Jul 2017 10:48:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTUTU-0005tC-Pr for qemu-devel@nongnu.org; Fri, 07 Jul 2017 10:43:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTUTU-00044s-1w for qemu-devel@nongnu.org; Fri, 07 Jul 2017 10:43:16 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:37441) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTUTT-00040L-RF for qemu-devel@nongnu.org; Fri, 07 Jul 2017 10:43:15 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1dTUTF-0005tf-Ph; Fri, 07 Jul 2017 15:43:01 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 15:42:52 +0100 Message-Id: <1499438577-7674-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499438577-7674-1-git-send-email-peter.maydell@linaro.org> References: <1499438577-7674-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 06/11] scripts/coccinelle/memory-region-init-ram.cocci: New script X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Apfelbaum , Paolo Bonzini , Igor Mammedov , Eduardo Habkost , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a coccinelle script that can be used to automatically convert manual sequences of memory_region_init_ram_nomigrate() vmstate_register_ram{,_global}() to use the new memory_region_init_ram() Signed-off-by: Peter Maydell --- scripts/coccinelle/memory-region-init-ram.cocci | 38 +++++++++++++++++++++= ++++ 1 file changed, 38 insertions(+) create mode 100644 scripts/coccinelle/memory-region-init-ram.cocci diff --git a/scripts/coccinelle/memory-region-init-ram.cocci b/scripts/cocc= inelle/memory-region-init-ram.cocci new file mode 100644 index 0000000..d290150 --- /dev/null +++ b/scripts/coccinelle/memory-region-init-ram.cocci @@ -0,0 +1,38 @@ +// Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram +// code sequences with use of the new memory_region_init_ram function. +// Similarly for the _rom and _rom_device functions. +// We don't try to replace sequences with a non-NULL owner, because +// there are none in the tree that can be automatically converted +// (and only a handful that can be manually converted). +@@ +expression MR; +expression NAME; +expression SIZE; +expression ERRP; +@@ +-memory_region_init_ram_nomigrate(MR, NULL, NAME, SIZE, ERRP); ++memory_region_init_ram(MR, NULL, NAME, SIZE, ERRP); + ... +-vmstate_register_ram_global(MR); +@@ +expression MR; +expression NAME; +expression SIZE; +expression ERRP; +@@ +-memory_region_init_rom_nomigrate(MR, NULL, NAME, SIZE, ERRP); ++memory_region_init_rom(MR, NULL, NAME, SIZE, ERRP); + ... +-vmstate_register_ram_global(MR); +@@ +expression MR; +expression OPS; +expression OPAQUE; +expression NAME; +expression SIZE; +expression ERRP; +@@ +-memory_region_init_rom_device_nomigrate(MR, NULL, OPS, OPAQUE, NAME, SIZE= , ERRP); ++memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP); + ... +-vmstate_register_ram_global(MR); --=20 2.7.4