From patchwork Fri Jul 7 14:42:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 107202 Delivered-To: patches@linaro.org Received: by 10.140.101.44 with SMTP id t41csp147262qge; Fri, 7 Jul 2017 07:43:02 -0700 (PDT) X-Received: by 10.28.220.133 with SMTP id t127mr2552148wmg.29.1499438582258; Fri, 07 Jul 2017 07:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499438582; cv=none; d=google.com; s=arc-20160816; b=GueVr11eZ89zRtBCHqHoNsL1SqHbXGCayaSURMbDD2xP1lX6KUi1vjdhuwBLpAjZgX ErhJyva35vTLPyK3Y5irvGwm3f5bhEL4y2vO5Sm/qhVLwM7It+WO9ZtYmJrzdtwUiuyJ a1EbRvbfvE5m2fwyIDauazjDPf63e82DULoWTsryLJwJSl55sItdKcU0Xq3pgHuxIb3r JxfwfbnPjYkT2NDV2eUvfPUZizDW4OoTrWGnSEteAo5LNa5oRHbW7Ud1zyl9gqKYwqJE dpUsSf7B641K57JliassffTanYehu1M6QVugWsOXt52QAszyw5DuUdYXmz7gbPxzUhLr VsQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VM33rmFbJgP1PiIc60BT7hf9cUUsjh6i0c9iOEs451A=; b=cNSri9Mnhg+zQbcW2Pk+3gInr+lQZ7f+iuRR4ebndpnGAIhFMLwIFE0ki9Nt4o+0eZ ALw4z8LP1PehX8C7xi8pQ6vt+UKqEL8Z/i5SZa33h/5HXDazUCqu5AzyNEa06pU077ee uTH4OKg91NsiJiH7AP1d6qWv3yTKaZDDjcEGn71DQrbnM7tlHh8cmzvInf4fiKpXt2c0 mdHIl6u2nNwBicvbok87pVxT3XdN67PTqJWtKeSpGMvP0Rwy8d7FYA6C674D0bnBN/vG 7iTJSvAV7d0zr3zLDEvwEsEXFZRIGGMe22P2r7I28W8d6qx5wji5E1wviBm4ZXZUEwvF fh1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id e3si3119656wmd.89.2017.07.07.07.43.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jul 2017 07:43:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 Cc: patches@linaro.org, Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , Igor Mammedov Subject: [PATCH 06/11] scripts/coccinelle/memory-region-init-ram.cocci: New script 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> 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 -- 2.7.4 diff --git a/scripts/coccinelle/memory-region-init-ram.cocci b/scripts/coccinelle/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);