From patchwork Thu Nov 22 06:32:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10693547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F6CB18F0 for ; Thu, 22 Nov 2018 06:34:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84C892C21E for ; Thu, 22 Nov 2018 06:34:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78EC32C513; Thu, 22 Nov 2018 06:34:12 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,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 8D0DA2C21E for ; Thu, 22 Nov 2018 06:34:08 +0000 (UTC) Received: from localhost ([::1]:44233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPiYx-0003Va-43 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Nov 2018 01:34:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPiY0-0002xR-8l for qemu-devel@nongnu.org; Thu, 22 Nov 2018 01:33:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPiXy-0001i8-Uc for qemu-devel@nongnu.org; Thu, 22 Nov 2018 01:33:08 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:44251) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPiXy-0001fh-MO for qemu-devel@nongnu.org; Thu, 22 Nov 2018 01:33:06 -0500 Received: by mail-pl1-x641.google.com with SMTP id s5-v6so8764435plq.11 for ; Wed, 21 Nov 2018 22:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JvO8/BFf+ezg16GmX6D78iWXNVKt/R8Ua+Gd3+r2IzM=; b=CUMorEp5yVqkIEy/T6FDPeFDqPxum0vO7J1NmpTcvPkJ/84D7GYzHSHri02/1bpXox QuPI4bbCYLsLrbv2gtaSnecHdArR6ogcr+eXOTCIZL5+yZYntj0Ld4RWt05k+OpBQMyL Iaxzmj5W3/x6wxq9i1UsHiiG7HhmjDMSso0T3p5B0NgqmisBnS+Af8W+Zip3D8uOVzD2 j0YsdPlnVuz3FHGBUPtKkM26QElaKLRG1k4lkBYWM9MW4ujRepD5gEFZMXeIaugCOT2R +SbvPwMGWUJboIIno2lWp9ds4Pe0c5Wzc2LsYI9lWsaq0v6yzKZC3XRMZE//HPO34G2i mowg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JvO8/BFf+ezg16GmX6D78iWXNVKt/R8Ua+Gd3+r2IzM=; b=P12wuK3+bNoTzuZY/8wSeJlbd5dAIDMrBAIZruA4ndkZsWeL3zZP+4KJbTnzMzHxMn haO/+iSreCQDcwT7MT7vAyxQgE8iyVfWaspTTz8mbYsd4rE5srf4b6qXqRenp/mmAZTB eNVmUHp6REOL3bx0YPW7tPsB0Sj+7unfFMzt4kyaYlkrOK3X6OAv1hU76wZCxBJkhJlF DKwRLl/W+0kJPVMo8SFh/oHC4TxeAiI7P/FNqwgaYOVSe7yWxSAIxj0kTHgmMETSDJUV GJoteRAVuIjoyLC6ToKX/rKL/RzkTY5nJSNQpFA1XH1c/VEYrbYs+ZO3fIhpKPdbk9s+ HB/A== X-Gm-Message-State: AA+aEWZVZIIXRqh2yqXBCP2nK5V9yofG/5pZ7b7k18eL4ejt+7FSg0hb Dlo8bZ3davot/iAWoyFIJK0= X-Google-Smtp-Source: AFSGD/VUoVV7BjJuh/QrjQ6+waiiZ+QFPI99N7eo4OjZxXDpM2ZrRhQ/EtPFTNz9qkKNHqhoWOhEkw== X-Received: by 2002:a17:902:f091:: with SMTP id go17mr10259473plb.235.1542868385811; Wed, 21 Nov 2018 22:33:05 -0800 (PST) Received: from localhost.localdomain.localdomain ([103.129.255.252]) by smtp.gmail.com with ESMTPSA id e9sm36038875pff.5.2018.11.21.22.33.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 22:33:05 -0800 (PST) From: Li Qiang To: pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mst@redhat.com, marcel.apfelbaum@gmail.com, mark.cave-ayland@ilande.co.uk Date: Wed, 21 Nov 2018 22:32:51 -0800 Message-Id: <1542868372-2602-2-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1542868372-2602-1-git-send-email-liq3ea@gmail.com> References: <1542868372-2602-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH 1/2] hw: pc: use TYPE_XXX instead of constant strings 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: Li Qiang , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Li Qiang --- hw/i386/pc.c | 9 +++------ hw/sparc64/sun4u.c | 2 +- include/hw/i386/pc.h | 7 +++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f095725dba..5d3fd86b83 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -502,9 +502,6 @@ void pc_cmos_init(PCMachineState *pcms, qemu_register_reset(pc_cmos_init_late, &arg); } -#define TYPE_PORT92 "port92" -#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92) - /* port 92 stuff: could be split off */ typedef struct Port92State { ISADevice parent_obj; @@ -1543,10 +1540,10 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) fdctrl_init_isa(isa_bus, fd); } - i8042 = isa_create_simple(isa_bus, "i8042"); + i8042 = isa_create_simple(isa_bus, TYPE_I8042); if (!no_vmport) { vmport_init(isa_bus); - vmmouse = isa_try_create(isa_bus, "vmmouse"); + vmmouse = isa_try_create(isa_bus, TYPE_VMMOUSE); } else { vmmouse = NULL; } @@ -1555,7 +1552,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) qdev_prop_set_ptr(dev, "ps2_mouse", i8042); qdev_init_nofail(dev); } - port92 = isa_create_simple(isa_bus, "port92"); + port92 = isa_create_simple(isa_bus, TYPE_PORT92); a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); i8042_setup_a20_line(i8042, a20_line[0]); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index f76b19e4e9..c49a416b95 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -305,7 +305,7 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp) parallel_hds_isa_init(s->isa_bus, MAX_PARALLEL_PORTS); /* Keyboard */ - isa_create_simple(s->isa_bus, "i8042"); + isa_create_simple(s->isa_bus, TYPE_I8042); /* Floppy */ for (i = 0; i < MAX_FD; i++) { diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 136fe497b6..29db770d86 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -169,6 +169,13 @@ void gsi_handler(void *opaque, int n, int level); #define TYPE_VMPORT "vmport" typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address); +#define TYPE_PORT92 "port92" +#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92) + +/* vmmouse.c */ +#define TYPE_VMMOUSE "vmmouse" +#define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE) + static inline void vmport_init(ISABus *bus) { isa_create_simple(bus, TYPE_VMPORT);