From patchwork Thu Nov 22 06:32:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10693545 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 130215A4 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 07E8F2C293 for ; Thu, 22 Nov 2018 06:34:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F02AD2C555; Thu, 22 Nov 2018 06:34: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=-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 910F22C293 for ; Thu, 22 Nov 2018 06:34:11 +0000 (UTC) Received: from localhost ([::1]:44234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPiZ0-0003YH-Jk for patchwork-qemu-devel@patchwork.kernel.org; Thu, 22 Nov 2018 01:34:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPiY3-0002yO-Ba for qemu-devel@nongnu.org; Thu, 22 Nov 2018 01:33:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPiY2-0001py-Cq for qemu-devel@nongnu.org; Thu, 22 Nov 2018 01:33:11 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:41362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPiY2-0001oW-6d for qemu-devel@nongnu.org; Thu, 22 Nov 2018 01:33:10 -0500 Received: by mail-pf1-x442.google.com with SMTP id b7so1435558pfi.8 for ; Wed, 21 Nov 2018 22:33:10 -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=k2nDw5nsw4lIiFs4GqSNV3SIgd7y07wjTHQGMUHBOEI=; b=g37iyQ++fjjDsF/g0N5exu5olSrl5KDekARjWVfLrs4PXQKukOrdZC69zh4Wn6UHS+ Lq6GRbPORCkWRCgyapVVIm2ctddxTingbeK14t240H25cBoBnxfiVJfHT3LJW4r1u+Iw x3eKl/BPZrk2vxp6/Xzw81kwFx56RIiZGtA4HHMbOC71jbo9jQ3e1JaHN2Lj8MxdnDRM XIv0xaLtyjI5cso5eE5BSQ2RTsrHUmPTlVcxWDAddjKk/PkYaygi5R9gSsnr/kqTJdI5 pHOz5mubTrYr4GTcX0VkExGC5DRyx+n3PDJ3wKMHcr4NKcy9zQ+QrJxynUYK9mXIWXO4 o79g== 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=k2nDw5nsw4lIiFs4GqSNV3SIgd7y07wjTHQGMUHBOEI=; b=VB10JlfleM8yNmqwyYaVn9C6u8mByPbzm3A+MgtqX1MG3zsWFzYYw0zPpLFUg23GBP Y7Z9yFCgUFjamMydBVrDfgSrsQB2LjizbfwHPOySAnBO0l91cg8+4IBYMz7CVejcopC+ u3xSY5GjZKdtCm/bj8ad5Upo1Vb2u5eQGxDqJRBLA+4jO1SIe3Ja/Hd+EiUiMzQqooc0 Ptlk3Ufr2Oygiy5/VywZWEQfUa/rQFcJlAtYhIrpvI0OQ6o740CML+MWHdOIaPNToL1/ uFSejJWaNEk3uOic2LbJS7sAAY8JJJZ7tpttMiLBumYQt6F2GseqIhAsB2KRI30kYzqn J9Ew== X-Gm-Message-State: AGRZ1gJA1cZh2WlCPzQPzW82sOvLf4lzgzMIjIYxAPqterybtsdK0TZ6 mO5FOSOw8EbIT/WHAU4scaY= X-Google-Smtp-Source: AJdET5el4RI/n43mi+YVVMW1F3kAj3UNiTp311kJXB6cABn6CJoSX5Cr3iKCZ4xr6QlURkhayN/LHw== X-Received: by 2002:aa7:8497:: with SMTP id u23mr10120607pfn.220.1542868389303; Wed, 21 Nov 2018 22:33:09 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 22:33:08 -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:52 -0800 Message-Id: <1542868372-2602-3-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::442 Subject: [Qemu-devel] [PATCH 2/2] hw: vmmouse: drop DEFINE_PROP_PTR() 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 Use link property instead. Signed-off-by: Li Qiang --- hw/i386/pc.c | 2 +- hw/i386/vmmouse.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5d3fd86b83..9b343b4fd1 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1549,7 +1549,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) } if (vmmouse) { DeviceState *dev = DEVICE(vmmouse); - qdev_prop_set_ptr(dev, "ps2_mouse", i8042); + object_property_set_link(OBJECT(dev), OBJECT(i8042), "ps2_mouse", NULL); qdev_init_nofail(dev); } port92 = isa_create_simple(isa_bus, TYPE_PORT92); diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index 5d2d278be4..612675d651 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -27,6 +27,7 @@ #include "hw/i386/pc.h" #include "hw/input/i8042.h" #include "hw/qdev.h" +#include "qapi/error.h" /* debug only vmmouse */ //#define DEBUG_VMMOUSE @@ -272,10 +273,15 @@ static void vmmouse_realizefn(DeviceState *dev, Error **errp) vmport_register(VMMOUSE_DATA, vmmouse_ioport_read, s); } -static Property vmmouse_properties[] = { - DEFINE_PROP_PTR("ps2_mouse", VMMouseState, ps2_mouse), - DEFINE_PROP_END_OF_LIST(), -}; +static void vmmouse_instance_initfn(Object *obj) +{ + VMMouseState *s = VMMOUSE(obj); + + object_property_add_link(obj, "ps2_mouse", TYPE_I8042, + (Object **)&s->ps2_mouse, + qdev_prop_allow_set_link_before_realize, + 0, &error_abort); +} static void vmmouse_class_initfn(ObjectClass *klass, void *data) { @@ -284,8 +290,6 @@ static void vmmouse_class_initfn(ObjectClass *klass, void *data) dc->realize = vmmouse_realizefn; dc->reset = vmmouse_reset; dc->vmsd = &vmstate_vmmouse; - dc->props = vmmouse_properties; - /* Reason: pointer property "ps2_mouse" */ dc->user_creatable = false; } @@ -293,6 +297,7 @@ static const TypeInfo vmmouse_info = { .name = TYPE_VMMOUSE, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof(VMMouseState), + .instance_init = vmmouse_instance_initfn, .class_init = vmmouse_class_initfn, };