From patchwork Tue Jun 14 14:13:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9175947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4E85560772 for ; Tue, 14 Jun 2016 14:29:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FAC6265B9 for ; Tue, 14 Jun 2016 14:29:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3455D2824A; Tue, 14 Jun 2016 14:29:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C4889265B9 for ; Tue, 14 Jun 2016 14:29:10 +0000 (UTC) Received: from localhost ([::1]:35678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCpL3-0001Kn-50 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Jun 2016 10:29:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCp6Z-0003JH-QM for qemu-devel@nongnu.org; Tue, 14 Jun 2016 10:14:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCp6X-0007zz-Of for qemu-devel@nongnu.org; Tue, 14 Jun 2016 10:14:10 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCp6X-0007yr-H6 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 10:14:09 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1bCp6X-0006Dr-AX for qemu-devel@nongnu.org; Tue, 14 Jun 2016 15:14:09 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 14 Jun 2016 15:13:42 +0100 Message-Id: <1465913645-19346-8-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465913645-19346-1-git-send-email-peter.maydell@linaro.org> References: <1465913645-19346-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] [PULL 07/30] hw/arm/virt: introduce DEFINE_VIRT_MACHINE_AS_LATEST 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Andrew Jones Create two variants of DEFINE_VIRT_MACHINE. One, just called DEFINE_VIRT_MACHINE, that does not set properties that only the latest machine type should have, and another that does. This will hopefully reduce potential for errors when adding new versions. Signed-off-by: Andrew Jones Message-id: 1465746713-30414-4-git-send-email-drjones@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/virt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 86a1a51..fb032e8 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -99,13 +99,16 @@ typedef struct { OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) -#define DEFINE_VIRT_MACHINE(major, minor) \ +#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ void *data) \ { \ MachineClass *mc = MACHINE_CLASS(oc); \ virt_machine_##major##_##minor##_options(mc); \ mc->desc = "QEMU " # major "." # minor " ARM Virtual Machine"; \ + if (latest) { \ + mc->alias = "virt"; \ + } \ } \ static const TypeInfo machvirt_##major##_##minor##_info = { \ .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \ @@ -119,6 +122,11 @@ typedef struct { } \ type_init(machvirt_machine_##major##_##minor##_init); +#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \ + DEFINE_VIRT_MACHINE_LATEST(major, minor, true) +#define DEFINE_VIRT_MACHINE(major, minor) \ + DEFINE_VIRT_MACHINE_LATEST(major, minor, false) + /* RAM limit in GB. Since VIRT_MEM starts at the 1GB mark, this means * RAM can go up to the 256GB mark, leaving 256GB of the physical @@ -1483,6 +1491,5 @@ static void virt_2_6_instance_init(Object *obj) static void virt_machine_2_6_options(MachineClass *mc) { - mc->alias = "virt"; } -DEFINE_VIRT_MACHINE(2, 6) +DEFINE_VIRT_MACHINE_AS_LATEST(2, 6)