From patchwork Wed Sep 11 12:13:26 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: 827388 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp761525wrc; Wed, 11 Sep 2024 05:15:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCULJnSZZEbywjKUUuyBrBMbnlkXmjoehLCRj0iCajRkj6LXqDrJWXoHJcZ+D5fHICijvC1Dcg==@linaro.org X-Google-Smtp-Source: AGHT+IH+6bQq48VSbim4/kUlPMfcF2jdKe1ZqKFOJx969iAxOLiHu/twhI6k7nmCIOi2XtvHsG88 X-Received: by 2002:a05:690c:610b:b0:6b5:916d:5a8 with SMTP id 00721157ae682-6dba6dbacc8mr28254037b3.23.1726056916258; Wed, 11 Sep 2024 05:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726056916; cv=none; d=google.com; s=arc-20240605; b=aR2jCpdosveeyOx6VULC5tZ3BYwOh/3oklpM7wAhMWjBb355s+5Hmxf+gACtCH6ZyT xOYjTvOxyrxcvtjSeUx4FMoycnZ3CDCHdmI4WnMW5HIqqOfjwAJ7aS65h29YyTX1yxE1 vXx0UsC258iatj8vnMRGIfqruW9mXxzBvJPixdJYJqO4fovA/CyUW0Rla9QivzfzXPh+ V42i5YmFGzxmmFhLGbdqrXUbIANk54JPf3S/IgEVMiKb8lAdMUmeySOn7gg0vnxRTZoT HTdGbyHQpgsqMvZpZszPpR23905OWqev81rPvg+xzsLWJfhyyjpj7L1D3vtMMj5lZv1Q zXTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=sgquy8ayg0+igtRVZU2VaE9+ZLSxvBTEk0PAs5rrZzA=; fh=WXANzaKscrTClYYFlwgxZIxtOY3zSbAYDmTBPYHhrgk=; b=X73K+/VpRhrAfqP8j7ZK2lb3k9AOXgJkGMFhoOKqgYDbCstqctD8OQiHn3rZjJ6rPV WfyCgjQVimoQRMnYc4hUHRxfudQ9KQF8qlz9BCGliIQyYsI48n6FqXKtjw1lRrrgWzEh ODY45bSYKwiIfP4N/Zhu8V4ccRh4jbnfcv3g7cpeyXR+uFkHwnHIHZf6hlWXLj2vtZdO bKnw70UkMCUlYaVLXrBNR5JBP3w2G8JBGxrodXmAbjLV60lawpnWqrTAayZG+YKuLLDf qZiaTy3prxHcG4CRqmkBcsucJeYoxGISwLKDK+Gj3/ICg0eYlCqKIbdeCqrtM6ufWXAQ jheA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="uOBY/Teb"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a9a7a55debsi1063762285a.660.2024.09.11.05.15.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 05:15:16 -0700 (PDT) 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="uOBY/Teb"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soMF9-0004dP-41; Wed, 11 Sep 2024 08:14:43 -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 1soMF7-0004X7-3u for qemu-devel@nongnu.org; Wed, 11 Sep 2024 08:14:41 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soMF4-00078W-Hd for qemu-devel@nongnu.org; Wed, 11 Sep 2024 08:14:40 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5365b71a6bdso6358587e87.2 for ; Wed, 11 Sep 2024 05:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726056875; x=1726661675; 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=sgquy8ayg0+igtRVZU2VaE9+ZLSxvBTEk0PAs5rrZzA=; b=uOBY/Teb7XBTmHItkoSmj03jQ+zpdy27ycqOutnMwZacq+RN8DkfiEDyx2YnNTeTTx 3Rq5yysMWCRrDWvPwpq6Y5yARoJvMJatc6SaZkA+SSLSURUMUaSZAVgOP8ZX+K+NkLAB cqLPwNhuUTAo1Wrgpp7N+kTXBmqLE6IPm1d2KuJWG9i/i2pv4vnP5NUzmdO2CG6gAI59 BDgDakgKdPtMqKbw01vUrwBAzrOvMYyY07MMaQFps38p6bJjH5F1aXChUbD3oxt11U3Y ZLu0MnggkiS2d5INyqGHfNSF6cSbTD7wwvMM9E5cR4d/ofd9SGoAWfByF72USnhr2wDd RQaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726056875; x=1726661675; 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=sgquy8ayg0+igtRVZU2VaE9+ZLSxvBTEk0PAs5rrZzA=; b=nNRg42Q2G7ex0yaPaI1U3tzbK8qxXkYpyHUG+QBgj6lZWbqMsFKgTsP4XWbpsVMTjP M4xAp51j/nuzVF2SCZyPhOMBc5Se/4kQIdpWmPOR0k24Q2/yUqon32KHbyMnLKje7r2U qR3l/+1p1Sm8uUjIP/U3P1ZrZlnJ0Xrt7wNWA/Uuf+9+2nV+iAsybbZGjZONGLmjC/1w OBeNaisSeT1dl919MzqFrMVn8O2CEMJVuyO2MuDYjR4CmLWZGdY4YOyGUEz5rMDDqgO2 t60Xs/i087JDdIzfOzjnDaxahlOy+uMXcofOtPVA1dCRTicY0INUi6sinB2Cfs1NpNlt JVSw== X-Gm-Message-State: AOJu0YyDnhZFQwNtlCJF4tXSc735G0tkxRC7wDXblguoZzZFClSisKkb 7qq/rP2xaVpfxegTQcpbmp+gMky82neApIuMLA+nw8c7rkg8QJ3IjRNHEDafWNtHTJ9lFE5GnB1 F X-Received: by 2002:a05:6512:2215:b0:534:5453:ecda with SMTP id 2adb3069b0e04-536587ae6c8mr11545244e87.23.1726056874706; Wed, 11 Sep 2024 05:14:34 -0700 (PDT) Received: from m1x-phil.lan ([176.187.196.107]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c72861sm605974066b.105.2024.09.11.05.14.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 05:14:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Gustavo Romero Subject: [PULL 01/56] hw/pci-host/designware: Declare CPU QOM types using DEFINE_TYPES() macro Date: Wed, 11 Sep 2024 14:13:26 +0200 Message-ID: <20240911121422.52585-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240911121422.52585-1-philmd@linaro.org> References: <20240911121422.52585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=philmd@linaro.org; helo=mail-lf1-x136.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Remove a pointless structure declaration in "designware.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Reviewed-by: Gustavo Romero Message-Id: <20231012121857.31873-2-philmd@linaro.org> --- include/hw/pci-host/designware.h | 2 -- hw/pci-host/designware.c | 39 ++++++++++++++------------------ 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h index 908f3d946b..c484e377a8 100644 --- a/include/hw/pci-host/designware.h +++ b/include/hw/pci-host/designware.h @@ -31,8 +31,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(DesignwarePCIEHost, DESIGNWARE_PCIE_HOST) #define TYPE_DESIGNWARE_PCIE_ROOT "designware-pcie-root" OBJECT_DECLARE_SIMPLE_TYPE(DesignwarePCIERoot, DESIGNWARE_PCIE_ROOT) -struct DesignwarePCIERoot; - typedef struct DesignwarePCIEViewport { DesignwarePCIERoot *root; diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c index c25d50f1c6..c8ec5e8ba9 100644 --- a/hw/pci-host/designware.c +++ b/hw/pci-host/designware.c @@ -752,28 +752,23 @@ static void designware_pcie_host_init(Object *obj) qdev_prop_set_bit(DEVICE(root), "multifunction", false); } -static const TypeInfo designware_pcie_root_info = { - .name = TYPE_DESIGNWARE_PCIE_ROOT, - .parent = TYPE_PCI_BRIDGE, - .instance_size = sizeof(DesignwarePCIERoot), - .class_init = designware_pcie_root_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_PCIE_DEVICE }, - { } +static const TypeInfo designware_pcie_types[] = { + { + .name = TYPE_DESIGNWARE_PCIE_HOST, + .parent = TYPE_PCI_HOST_BRIDGE, + .instance_size = sizeof(DesignwarePCIEHost), + .instance_init = designware_pcie_host_init, + .class_init = designware_pcie_host_class_init, + }, { + .name = TYPE_DESIGNWARE_PCIE_ROOT, + .parent = TYPE_PCI_BRIDGE, + .instance_size = sizeof(DesignwarePCIERoot), + .class_init = designware_pcie_root_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_PCIE_DEVICE }, + { } + }, }, }; -static const TypeInfo designware_pcie_host_info = { - .name = TYPE_DESIGNWARE_PCIE_HOST, - .parent = TYPE_PCI_HOST_BRIDGE, - .instance_size = sizeof(DesignwarePCIEHost), - .instance_init = designware_pcie_host_init, - .class_init = designware_pcie_host_class_init, -}; - -static void designware_pcie_register(void) -{ - type_register_static(&designware_pcie_root_info); - type_register_static(&designware_pcie_host_info); -} -type_init(designware_pcie_register) +DEFINE_TYPES(designware_pcie_types)