From nobody Mon Oct 27 11:35:16 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1761396984976573.1159687183942; Sat, 25 Oct 2025 05:56:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vCdnt-00054C-PC; Sat, 25 Oct 2025 08:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vCdnm-00053f-Rt; Sat, 25 Oct 2025 08:55:22 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vCdnk-0005fz-Ub; Sat, 25 Oct 2025 08:55:22 -0400 Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 1297B597307; Sat, 25 Oct 2025 14:55:14 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by localhost (zero.eik.bme.hu [127.0.0.1]) (amavis, port 10028) with ESMTP id O6JizkaC8B8l; Sat, 25 Oct 2025 14:55:12 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 19967597305; Sat, 25 Oct 2025 14:55:12 +0200 (CEST) X-Virus-Scanned: amavis at eik.bme.hu From: BALATON Zoltan Subject: [PATCH] hw/pci-host/articia: Add variable for common type cast MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Nicholas Piggin , Harsh Prateek Bora , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Message-Id: <20251025125512.19967597305@zero.eik.bme.hu> Date: Sat, 25 Oct 2025 14:55:12 +0200 (CEST) Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1761396990521158500 Content-Type: text/plain; charset="utf-8" We need the device casted to OBJECT often enough in realize to store it in a local variable that also makes function calls more readable. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Based-on: hw/pci-host/articia.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/articia.c b/hw/pci-host/articia.c index 761e89bc8f..56fe3b6953 100644 --- a/hw/pci-host/articia.c +++ b/hw/pci-host/articia.c @@ -174,24 +174,24 @@ static void articia_realize(DeviceState *dev, Error *= *errp) { ArticiaState *s =3D ARTICIA(dev); PCIHostState *h =3D PCI_HOST_BRIDGE(dev); + Object *o =3D OBJECT(dev); MemoryRegion *mr; PCIDevice *pdev; =20 bitbang_i2c_init(&s->smbus, i2c_init_bus(dev, "smbus")); - memory_region_init_io(&s->gpio_reg, OBJECT(s), &articia_gpio_ops, s, + memory_region_init_io(&s->gpio_reg, o, &articia_gpio_ops, s, TYPE_ARTICIA, 4); =20 - memory_region_init(&s->mem, OBJECT(dev), "pci-mem", UINT64_MAX); - memory_region_init(&s->io, OBJECT(dev), "pci-io", 0xc00000); - memory_region_init_io(&s->reg, OBJECT(s), &articia_reg_ops, s, + memory_region_init(&s->mem, o, "pci-mem", UINT64_MAX); + memory_region_init(&s->io, o, "pci-io", 0xc00000); + memory_region_init_io(&s->reg, o, &articia_reg_ops, s, TYPE_ARTICIA, 0x1000000); memory_region_add_subregion_overlap(&s->reg, 0, &s->io, 1); mr =3D g_new(MemoryRegion, 1); - memory_region_init_alias(mr, OBJECT(dev), "pci-mem-low", &s->mem, - 0, PCI_LOW_SIZE); + memory_region_init_alias(mr, o, "pci-mem-low", &s->mem, 0, PCI_LOW_SIZ= E); memory_region_add_subregion(get_system_memory(), PCI_LOW_ADDR, mr); mr =3D g_new(MemoryRegion, 1); - memory_region_init_alias(mr, OBJECT(dev), "pci-mem-high", &s->mem, + memory_region_init_alias(mr, o, "pci-mem-high", &s->mem, PCI_HIGH_ADDR, PCI_HIGH_SIZE); memory_region_add_subregion(get_system_memory(), PCI_HIGH_ADDR, mr); =20 --=20 2.41.3