All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/pci-host/articia: Add variable for common type cast
@ 2025-10-25 12:55 BALATON Zoltan
  2025-10-25 16:49 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: BALATON Zoltan @ 2025-10-25 12:55 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc
  Cc: Nicholas Piggin, Harsh Prateek Bora, Philippe Mathieu-Daudé

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 <balaton@eik.bme.hu>
---
Based-on: <cover.1761346145.git.balaton@eik.bme.hu>

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 = ARTICIA(dev);
     PCIHostState *h = PCI_HOST_BRIDGE(dev);
+    Object *o = OBJECT(dev);
     MemoryRegion *mr;
     PCIDevice *pdev;
 
     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);
 
-    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 = 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_SIZE);
     memory_region_add_subregion(get_system_memory(), PCI_LOW_ADDR, mr);
     mr = 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);
 
-- 
2.41.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-25 20:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-25 12:55 [PATCH] hw/pci-host/articia: Add variable for common type cast BALATON Zoltan
2025-10-25 16:49 ` Philippe Mathieu-Daudé
2025-10-25 20:03   ` BALATON Zoltan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.