From nobody Thu May 2 03:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488127786724395.38313442700644; Sun, 26 Feb 2017 08:49:46 -0800 (PST) Received: from localhost ([::1]:47485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci212-0001In-HP for importer@patchew.org; Sun, 26 Feb 2017 11:49:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci1zt-0000vn-Ai for qemu-devel@nongnu.org; Sun, 26 Feb 2017 11:48:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ci1zq-000679-6b for qemu-devel@nongnu.org; Sun, 26 Feb 2017 11:48:33 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:50025) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ci1zq-00065K-0T for qemu-devel@nongnu.org; Sun, 26 Feb 2017 11:48:30 -0500 Received: from mail.nefkom.net (unknown [192.168.6.184]) by mail-out.m-online.net (Postfix) with ESMTP id 3vWW4Q5vhfz3hpTL; Sun, 26 Feb 2017 17:48:22 +0100 (CET) Received: from kurokawa.lan (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3vWW4P54rTzvdWQ; Sun, 26 Feb 2017 17:48:21 +0100 (CET) X-Auth-Info: mXkUnuanXSFSYaNOmmn4G+z7LBMJ/Y+dp6IFyRpT+Sg= From: Marek Vasut To: qemu-devel@nongnu.org Date: Sun, 26 Feb 2017 17:48:15 +0100 Message-Id: <20170226164815.26799-1-marex@denx.de> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 212.18.0.10 Subject: [Qemu-devel] [PATCH] nios2: iic: Convert CPU prop to qom link 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: Marek Vasut , Jeff Da Silva , Chris Wulff , Alexander Graf , Markus Armbruster , Sandra Loosemore , Yves Vandervennet , Ley Foon Tan , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a const qom link between the CPU and the IIC instead of passing the CPU link through a qom property. Signed-off-by: Marek Vasut Cc: Alexander Graf Cc: Chris Wulff Cc: Jeff Da Silva Cc: Ley Foon Tan Cc: Markus Armbruster Cc: Richard Henderson Cc: Sandra Loosemore Cc: Yves Vandervennet --- hw/intc/nios2_iic.c | 13 ++++--------- hw/nios2/10m50_devboard.c | 3 ++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/hw/intc/nios2_iic.c b/hw/intc/nios2_iic.c index 818ab1b315..70550ef8c1 100644 --- a/hw/intc/nios2_iic.c +++ b/hw/intc/nios2_iic.c @@ -62,17 +62,15 @@ static void altera_iic_init(Object *obj) sysbus_init_irq(SYS_BUS_DEVICE(obj), &pv->parent_irq); } =20 -static Property altera_iic_properties[] =3D { - DEFINE_PROP_PTR("cpu", AlteraIIC, cpu), - DEFINE_PROP_END_OF_LIST(), -}; - static void altera_iic_realize(DeviceState *dev, Error **errp) { struct AlteraIIC *pv =3D ALTERA_IIC(dev); + Error *err =3D NULL; =20 + pv->cpu =3D object_property_get_link(OBJECT(dev), "cpu", &err); if (!pv->cpu) { - error_setg(errp, "altera,iic: CPU not connected"); + error_setg(errp, "altera,iic: CPU link not found: %s", + error_get_pretty(err)); return; } } @@ -81,9 +79,6 @@ static void altera_iic_class_init(ObjectClass *klass, voi= d *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - dc->props =3D altera_iic_properties; - /* Reason: pointer property "cpu" */ - dc->cannot_instantiate_with_device_add_yet =3D true; dc->realize =3D altera_iic_realize; } =20 diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c index 0d8b9aa58f..c18e0b2a17 100644 --- a/hw/nios2/10m50_devboard.c +++ b/hw/nios2/10m50_devboard.c @@ -83,7 +83,8 @@ static void nios2_10m50_ghrd_init(MachineState *machine) =20 /* Register: Internal Interrupt Controller (IIC) */ dev =3D qdev_create(NULL, "altera,iic"); - qdev_prop_set_ptr(dev, "cpu", cpu); + object_property_add_const_link(OBJECT(dev), "cpu", OBJECT(cpu), + &error_abort); qdev_init_nofail(dev); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]); for (i =3D 0; i < 32; i++) { --=20 2.11.0