From nobody Thu May 2 19:24:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574093945; cv=none; d=zoho.com; s=zohoarc; b=OOqB3Wi/lrhFeznYdOZJg9/zCc0bDX10FuRVuR4LKnKz53Xd51qqv+LYqbZD4NLMXJCormY5ujgdwNlH7PWLrSu7Ro1efWI1uZNsIqKAgXltx7hnIyju8Ij+qHVpD8j6Wz+VIN8xa4OCXSQo2anlc7FE3oqrmnk8yGh/ysgwmag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574093945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fYjbvFrvwDJ+jAyMdCEqOMLqUimeUQIroJHcjPN7qHQ=; b=W+YSQD//m1mkxj40XZppRnwQ7HdVwfUreQzAepKIekgSxBsHTyvoXPlkJ2/zSMIYk5ul/6+BHGCa6w1CszFfqfx3cYpQ0aCIZlmbMmEtQZx1cUihe035/bNC0zBF5hXrjcqriP5qly0lmt5C/94vyYhs7RRxfoitsWphD8ymndw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574093945381239.14862475857456; Mon, 18 Nov 2019 08:19:05 -0800 (PST) Received: from localhost ([::1]:36436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWjjx-0002cA-Hw for importer@patchew.org; Mon, 18 Nov 2019 11:19:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWjia-00014M-Nb for qemu-devel@nongnu.org; Mon, 18 Nov 2019 11:17:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWjiZ-00067s-06 for qemu-devel@nongnu.org; Mon, 18 Nov 2019 11:17:36 -0500 Received: from 8.mo173.mail-out.ovh.net ([46.105.46.122]:59655) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iWjiY-00067e-LA for qemu-devel@nongnu.org; Mon, 18 Nov 2019 11:17:34 -0500 Received: from player796.ha.ovh.net (unknown [10.108.57.245]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id A996311B6FA for ; Mon, 18 Nov 2019 17:17:32 +0100 (CET) Received: from kaod.org (lfbn-1-2229-223.w90-76.abo.wanadoo.fr [90.76.50.223]) (Authenticated sender: clg@kaod.org) by player796.ha.ovh.net (Postfix) with ESMTPSA id D58D9C1CB381; Mon, 18 Nov 2019 16:17:24 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Subject: [PATCH for-5.0 1/2] aspeed: change the "scu" property definition Date: Mon, 18 Nov 2019 17:17:11 +0100 Message-Id: <20191118161712.6712-2-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191118161712.6712-1-clg@kaod.org> References: <20191118161712.6712-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14131169733724179217 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudegiedgieegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpledtrdejiedrhedtrddvvdefnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejleeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.46.122 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-devel@nongnu.org, Greg Kurz , qemu-arm@nongnu.org, Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The Aspeed Watchdog and Timer models have a link pointing to the SCU controller model of the machine. Change the "scu" property definition so that it explicitly sets the pointer. The property isn't optional : not being able to set the link is a bug and QEMU should rather abort than exit in this case. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Joel Stanley --- hw/arm/aspeed_ast2600.c | 8 ++++---- hw/arm/aspeed_soc.c | 8 ++++---- hw/timer/aspeed_timer.c | 17 +++++++++-------- hw/watchdog/wdt_aspeed.c | 17 ++++++++--------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 0881eb25983e..810fd7de0c06 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -146,8 +146,6 @@ static void aspeed_soc_ast2600_init(Object *obj) snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname); sysbus_init_child_obj(obj, "timerctrl", OBJECT(&s->timerctrl), sizeof(s->timerctrl), typename); - object_property_add_const_link(OBJECT(&s->timerctrl), "scu", - OBJECT(&s->scu), &error_abort); =20 snprintf(typename, sizeof(typename), "aspeed.i2c-%s", socname); sysbus_init_child_obj(obj, "i2c", OBJECT(&s->i2c), sizeof(s->i2c), @@ -177,8 +175,6 @@ static void aspeed_soc_ast2600_init(Object *obj) snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname); sysbus_init_child_obj(obj, "wdt[*]", OBJECT(&s->wdt[i]), sizeof(s->wdt[i]), typename); - object_property_add_const_link(OBJECT(&s->wdt[i]), "scu", - OBJECT(&s->scu), &error_abort); } =20 for (i =3D 0; i < sc->macs_num; i++) { @@ -323,6 +319,8 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev= , Error **errp) aspeed_soc_get_irq(s, ASPEED_RTC)); =20 /* Timer */ + object_property_set_link(OBJECT(&s->timerctrl), + OBJECT(&s->scu), "scu", &error_abort); object_property_set_bool(OBJECT(&s->timerctrl), true, "realized", &err= ); if (err) { error_propagate(errp, err); @@ -415,6 +413,8 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev= , Error **errp) for (i =3D 0; i < sc->wdts_num; i++) { AspeedWDTClass *awc =3D ASPEED_WDT_GET_CLASS(&s->wdt[i]); =20 + object_property_set_link(OBJECT(&s->wdt[i]), + OBJECT(&s->scu), "scu", &error_abort); object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized", &er= r); if (err) { error_propagate(errp, err); diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index b01c97744196..a6237e594017 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -163,8 +163,6 @@ static void aspeed_soc_init(Object *obj) snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname); sysbus_init_child_obj(obj, "timerctrl", OBJECT(&s->timerctrl), sizeof(s->timerctrl), typename); - object_property_add_const_link(OBJECT(&s->timerctrl), "scu", - OBJECT(&s->scu), &error_abort); =20 snprintf(typename, sizeof(typename), "aspeed.i2c-%s", socname); sysbus_init_child_obj(obj, "i2c", OBJECT(&s->i2c), sizeof(s->i2c), @@ -194,8 +192,6 @@ static void aspeed_soc_init(Object *obj) snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname); sysbus_init_child_obj(obj, "wdt[*]", OBJECT(&s->wdt[i]), sizeof(s->wdt[i]), typename); - object_property_add_const_link(OBJECT(&s->wdt[i]), "scu", - OBJECT(&s->scu), &error_abort); } =20 for (i =3D 0; i < sc->macs_num; i++) { @@ -291,6 +287,8 @@ static void aspeed_soc_realize(DeviceState *dev, Error = **errp) aspeed_soc_get_irq(s, ASPEED_RTC)); =20 /* Timer */ + object_property_set_link(OBJECT(&s->timerctrl), + OBJECT(&s->scu), "scu", &error_abort); object_property_set_bool(OBJECT(&s->timerctrl), true, "realized", &err= ); if (err) { error_propagate(errp, err); @@ -376,6 +374,8 @@ static void aspeed_soc_realize(DeviceState *dev, Error = **errp) for (i =3D 0; i < sc->wdts_num; i++) { AspeedWDTClass *awc =3D ASPEED_WDT_GET_CLASS(&s->wdt[i]); =20 + object_property_set_link(OBJECT(&s->wdt[i]), + OBJECT(&s->scu), "scu", &error_abort); object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized", &er= r); if (err) { error_propagate(errp, err); diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c index bcce2192a92a..a8c38cc1189b 100644 --- a/hw/timer/aspeed_timer.c +++ b/hw/timer/aspeed_timer.c @@ -19,6 +19,7 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "qemu/module.h" +#include "hw/qdev-properties.h" #include "trace.h" =20 #define TIMER_NR_REGS 4 @@ -603,15 +604,8 @@ static void aspeed_timer_realize(DeviceState *dev, Err= or **errp) int i; SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); AspeedTimerCtrlState *s =3D ASPEED_TIMER(dev); - Object *obj; - Error *err =3D NULL; =20 - obj =3D object_property_get_link(OBJECT(dev), "scu", &err); - if (!obj) { - error_propagate_prepend(errp, err, "required link 'scu' not found:= "); - return; - } - s->scu =3D ASPEED_SCU(obj); + assert(s->scu); =20 for (i =3D 0; i < ASPEED_TIMER_NR_TIMERS; i++) { aspeed_init_one_timer(s, i); @@ -677,6 +671,12 @@ static const VMStateDescription vmstate_aspeed_timer_s= tate =3D { } }; =20 +static Property aspeed_timer_properties[] =3D { + DEFINE_PROP_LINK("scu", AspeedTimerCtrlState, scu, TYPE_ASPEED_SCU, + AspeedSCUState *), + DEFINE_PROP_END_OF_LIST(), +}; + static void timer_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -685,6 +685,7 @@ static void timer_class_init(ObjectClass *klass, void *= data) dc->reset =3D aspeed_timer_reset; dc->desc =3D "ASPEED Timer"; dc->vmsd =3D &vmstate_aspeed_timer_state; + dc->props =3D aspeed_timer_properties; } =20 static const TypeInfo aspeed_timer_info =3D { diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index 122aa8daaadf..f50dab922e0f 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -241,16 +241,8 @@ static void aspeed_wdt_realize(DeviceState *dev, Error= **errp) { SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); AspeedWDTState *s =3D ASPEED_WDT(dev); - Error *err =3D NULL; - Object *obj; =20 - obj =3D object_property_get_link(OBJECT(dev), "scu", &err); - if (!obj) { - error_propagate(errp, err); - error_prepend(errp, "required link 'scu' not found: "); - return; - } - s->scu =3D ASPEED_SCU(obj); + assert(s->scu); =20 s->timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, aspeed_wdt_timer_expired= , dev); =20 @@ -264,6 +256,12 @@ static void aspeed_wdt_realize(DeviceState *dev, Error= **errp) sysbus_init_mmio(sbd, &s->iomem); } =20 +static Property aspeed_wdt_properties[] =3D { + DEFINE_PROP_LINK("scu", AspeedWDTState, scu, TYPE_ASPEED_SCU, + AspeedSCUState *), + DEFINE_PROP_END_OF_LIST(), +}; + static void aspeed_wdt_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -273,6 +271,7 @@ static void aspeed_wdt_class_init(ObjectClass *klass, v= oid *data) dc->reset =3D aspeed_wdt_reset; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->vmsd =3D &vmstate_aspeed_wdt; + dc->props =3D aspeed_wdt_properties; } =20 static const TypeInfo aspeed_wdt_info =3D { --=20 2.21.0 From nobody Thu May 2 19:24:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1574094040; cv=none; d=zoho.com; s=zohoarc; b=J3pB4B+Vv1mPeLeQCyQqnbpEetqFZnzDLbjvmG61l7cLklhd1usrHBTVKT7vd52GCY2QGGrs+JuG5HX/8oZdV0ZpbU5ejXaBXZXk/nxooAAO60rJVvdt/4Blp6LVYMJrqE6pznOv++M7sSkjIIJb/3xgJmC3w0ZeVeHykyJKlfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574094040; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aPzx1fgxd1xStHLSQ/aOQxQCX8+WTZiXV7xFnQ4aU0Y=; b=PXzMB7Kx5Lp78vnPNMyokmg5HAMNhFBm34l6p77L+PcWKGlkg3ZOYhVNypS+i6ijmDFpiO0eCF3WSDKjW4uKlR9J8Lv18urhn5AJU1ce5Qs6xjPvlZZc8R/2yalAamWe8ags30Khw05vCzYEdt32qItuxLG28X6rkpckYFX44NY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1574094040100186.94962728906296; Mon, 18 Nov 2019 08:20:40 -0800 (PST) Received: from localhost ([::1]:36468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWjlX-0005Jf-1O for importer@patchew.org; Mon, 18 Nov 2019 11:20:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45929) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWjii-0001EZ-Hz for qemu-devel@nongnu.org; Mon, 18 Nov 2019 11:17:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWjih-00069f-09 for qemu-devel@nongnu.org; Mon, 18 Nov 2019 11:17:44 -0500 Received: from 4.mo178.mail-out.ovh.net ([46.105.49.171]:34591) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iWjig-000698-QP for qemu-devel@nongnu.org; Mon, 18 Nov 2019 11:17:42 -0500 Received: from player796.ha.ovh.net (unknown [10.109.146.240]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 0C92480FDB for ; Mon, 18 Nov 2019 17:17:40 +0100 (CET) Received: from kaod.org (lfbn-1-2229-223.w90-76.abo.wanadoo.fr [90.76.50.223]) (Authenticated sender: clg@kaod.org) by player796.ha.ovh.net (Postfix) with ESMTPSA id 701CBC1CB3EA; Mon, 18 Nov 2019 16:17:32 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: Peter Maydell Subject: [PATCH for-5.0 2/2] aspeed: change the "nic" property definition Date: Mon, 18 Nov 2019 17:17:12 +0100 Message-Id: <20191118161712.6712-3-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191118161712.6712-1-clg@kaod.org> References: <20191118161712.6712-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14133421532880866065 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudegiedgieegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpledtrdejiedrhedtrddvvdefnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejleeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.49.171 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-devel@nongnu.org, Greg Kurz , qemu-arm@nongnu.org, Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The Aspeed MII model has a link pointing to its associated FTGMAC100 NIC in the machine. Change the "nic" property definition so that it explicitly sets the pointer. The property isn't optional : not being able to set the link is a bug and QEMU should rather abort than exit in this case. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Joel Stanley --- hw/arm/aspeed_ast2600.c | 5 ++--- hw/net/ftgmac100.c | 19 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 810fd7de0c06..be88005dab8f 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -183,9 +183,6 @@ static void aspeed_soc_ast2600_init(Object *obj) =20 sysbus_init_child_obj(obj, "mii[*]", &s->mii[i], sizeof(s->mii[i]), TYPE_ASPEED_MII); - object_property_add_const_link(OBJECT(&s->mii[i]), "nic", - OBJECT(&s->ftgmac100[i]), - &error_abort); } =20 sysbus_init_child_obj(obj, "xdma", OBJECT(&s->xdma), sizeof(s->xdma), @@ -441,6 +438,8 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev= , Error **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, aspeed_soc_get_irq(s, ASPEED_ETH1 + i)); =20 + object_property_set_link(OBJECT(&s->mii[i]), OBJECT(&s->ftgmac100[= i]), + "nic", &error_abort); object_property_set_bool(OBJECT(&s->mii[i]), true, "realized", &err); if (err) { diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index eb8b441461a1..86ac25894a89 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -1204,17 +1204,8 @@ static void aspeed_mii_realize(DeviceState *dev, Err= or **errp) { AspeedMiiState *s =3D ASPEED_MII(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); - Object *obj; - Error *local_err =3D NULL; =20 - obj =3D object_property_get_link(OBJECT(dev), "nic", &local_err); - if (!obj) { - error_propagate(errp, local_err); - error_prepend(errp, "required link 'nic' not found: "); - return; - } - - s->nic =3D FTGMAC100(obj); + assert(s->nic); =20 memory_region_init_io(&s->iomem, OBJECT(dev), &aspeed_mii_ops, s, TYPE_ASPEED_MII, 0x8); @@ -1231,6 +1222,13 @@ static const VMStateDescription vmstate_aspeed_mii = =3D { VMSTATE_END_OF_LIST() } }; + +static Property aspeed_mii_properties[] =3D { + DEFINE_PROP_LINK("nic", AspeedMiiState, nic, TYPE_FTGMAC100, + FTGMAC100State *), + DEFINE_PROP_END_OF_LIST(), +}; + static void aspeed_mii_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1239,6 +1237,7 @@ static void aspeed_mii_class_init(ObjectClass *klass,= void *data) dc->reset =3D aspeed_mii_reset; dc->realize =3D aspeed_mii_realize; dc->desc =3D "Aspeed MII controller"; + dc->props =3D aspeed_mii_properties; } =20 static const TypeInfo aspeed_mii_info =3D { --=20 2.21.0