From patchwork Fri Feb 16 11:03:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 773318 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp1287144wre; Fri, 16 Feb 2024 03:08:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUggkCqYv4MoP6kbb20F4kEyv+3HESrF8rt1k9lltz2espMz5C+uHU/KtT9VoEYhLtJW8lpoGPxYh5+RKvd0nTW X-Google-Smtp-Source: AGHT+IGnUexjBGLfESC8HCw3kb5kvxA2yaj6dfLAtTBIubPUyfZykH8m0DZ/5lJA/WW23prgd4FP X-Received: by 2002:a05:622a:207:b0:42c:68b4:1f9 with SMTP id b7-20020a05622a020700b0042c68b401f9mr5972996qtx.0.1708081703189; Fri, 16 Feb 2024 03:08:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708081703; cv=none; d=google.com; s=arc-20160816; b=Vn2HQhNlY0xCQIX9PrQMgTicgQiE8sv01TrJGH9ZDIMCmJMevbMtU+EUA14WKVwsO0 jswtHIrrEtgevw6Yhf3qhzqpXxEuFLI2sLzVdNSnGZbuB7R6PjApzt3W49M0sZb0nrEn msgXEwt3wnw1y41nghueczCC3+W9mbbqCF0e3ubnwrZ7l52/vF4mJ2UXH4rOCAVr8grL cldlwCrs/Z+xjsZ6QLoMfg22AXmwTn5noE/ORkR8pVtOUYsuB8SUhgVZ1+9oACHsV16w u1QqBD/ir7p9aJws0mY7lhoDXQYTbstpi1hm33U/3u0OsZRWvRlR5q4WLnI43mTBMQde I+lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/zKKBP4rtXDo5bJMJS/mfNxVsCqCESb5cpbpX3cp4fo=; fh=1CsvuuPs9UPSTZuV1m9yFwpqVLOER2vpzJGWrJFmFxE=; b=q4sgzbZ1crLzQ2ythjeMx1g8g86GatQI7yhFPpQVg5zFrCW4UoQI06a6u/at4MvbpW Lzhc2+FABKrA4ptBT2VkqtEUT2OKEgpI1uJfrdRmtxDRvgGQ6To58FUAcG3hCNduDhYi AW7ANpMhVRacSgF0JrP5I2D5ArVSNN6ZbJpENklsCWHcfQLzqoKQx+Y9q85HplUkuTOl iZdiBuz33Vs5m7Q+sl8KjRkXW1gJiOj9wyECKD0MPU12tNNtf9GEl7rEqkG7hhAfN/FO GwwHmsP6/9bcCJ3wnq3g3oBXIHcRlq+7W+i39gUIMbx5AALfTpHerVW3UavYiMJc9SoW +C6g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hgHoEzOT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e14-20020ac845ce000000b0042c459cd209si3477476qto.600.2024.02.16.03.08.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2024 03:08:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hgHoEzOT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raw1X-0008WT-5h; Fri, 16 Feb 2024 06:04:55 -0500 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 1raw1U-0008L4-E4 for qemu-devel@nongnu.org; Fri, 16 Feb 2024 06:04:52 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raw1R-00018S-U9 for qemu-devel@nongnu.org; Fri, 16 Feb 2024 06:04:51 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41243d19ecaso3270935e9.3 for ; Fri, 16 Feb 2024 03:04:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708081488; x=1708686288; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/zKKBP4rtXDo5bJMJS/mfNxVsCqCESb5cpbpX3cp4fo=; b=hgHoEzOTJE2GAUdiiRHOopema77vTDTSD4nbLnBygQ13j/5siddqlKYhgLWQMwuvpM HovwuaGJVjwV2RwJZebBlNkmH3ZIh2Yr3j/FPdNLpwePpUNcaxONY+ev1+puxcpta4ed zkXbvCaYzjoAzcsrFr6nfWNGihexkUPC5kRzLhWNY5HhegVUjHdLdKAMkKlWJX4vZlvs KtZwXjWB0Yck/8I50TABB2tH1t1maoOYUYZgDrkKA2jWXx+0/qDa9P91lqIdH656Q9CA wy7cTaLR1rXo2s9AuB43NiHqHuQ+FWQce4M1crAv/njIu/Rzv2KI/Vo8nZrZlU9XVzH4 HaSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708081488; x=1708686288; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/zKKBP4rtXDo5bJMJS/mfNxVsCqCESb5cpbpX3cp4fo=; b=Hepvf3vzem+D1rCkBq51+gHDED1tgt4QYNebjbz92hrxubhEDfoL4kb/hoR+7TqycU NRINbGJ5iTSGjv9Tn8qcqhunRkSKGQhOdhlKcKyjRXMy2gZmVgxej5rjeWhvNydg+3WM kS/+fHO5UNkLknpsT7OC404YNc7oF3x0rRwuMkKY9rioLJkSIGkuAboLr8fbcul4e2AP MZ1hjml6uq9PsXeE39PN/xmMza+aMgZCrsaHWTkVUHA/49XRx/3G5CBeHN0v/zFkD8pK 6FzIFKDFLKAMgLNw36tzTBsP2N73xWAsPrzMHFrxJyzePYye/g7QdukXaJWX2B1ctp3v GFtQ== X-Gm-Message-State: AOJu0Ywpj9cuxTmi0T/HYAgaRM9m8GCOVantY246+L89pMP2d5307UYY NV/PzsEpWdjdi2BOhfCdV/k2nR1Q3Ho9ys7fMeyzC4nmD1fB/VJ0oZ5q/XrzgeMA8DT+SNaA/VT V X-Received: by 2002:a05:600c:6a07:b0:410:ed9f:7acb with SMTP id jj7-20020a05600c6a0700b00410ed9f7acbmr3427466wmb.40.1708081488237; Fri, 16 Feb 2024 03:04:48 -0800 (PST) Received: from m1x-phil.lan ([176.187.210.246]) by smtp.gmail.com with ESMTPSA id z10-20020a1c4c0a000000b00410794ddfc6sm1951788wmf.35.2024.02.16.03.04.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 16 Feb 2024 03:04:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, qemu-block@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Herv?= =?utf-8?q?=C3=A9_Poussineau?= Subject: [PATCH 14/21] hw/pci-host/raven: Prefer object_initialize_child over object_initialize Date: Fri, 16 Feb 2024 12:03:05 +0100 Message-ID: <20240216110313.17039-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240216110313.17039-1-philmd@linaro.org> References: <20240216110313.17039-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When the QOM parent is available, prefer object_initialize_child() over object_initialize(), since it create the parent relationship. Signed-off-by: Philippe Mathieu-Daudé --- hw/pci-host/raven.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 9e47caebc5..5ef25edba6 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -290,7 +290,6 @@ static void raven_pcihost_initfn(Object *obj) PCIHostState *h = PCI_HOST_BRIDGE(obj); PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj); MemoryRegion *address_space_mem = get_system_memory(); - DeviceState *pci_dev; memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000); memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s, @@ -328,11 +327,10 @@ static void raven_pcihost_initfn(Object *obj) h->bus = &s->pci_bus; - object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE); - pci_dev = DEVICE(&s->pci_dev); + object_initialize_child(obj, "bridge", &s->pci_dev, TYPE_RAVEN_PCI_DEVICE); object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0), NULL); - qdev_prop_set_bit(pci_dev, "multifunction", false); + qdev_prop_set_bit(DEVICE(&s->pci_dev), "multifunction", false); } static void raven_realize(PCIDevice *d, Error **errp)