From nobody Sat Nov 23 23:45:46 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1730641306; cv=none; d=zohomail.com; s=zohoarc; b=I6yYReUlm1+dHyvQev9zWWz4POP8UIyiQWBk2PYG2Q7k1FFWKOdaPHdTqPDV2qscxmYAHX6dHbM9HJhMXWp/1y+dR3LsTeUDsmFEx/ixP6MHr+SekePsMhcg2eaMgGFssuxNMM0PIx1KvXHGOvZUocx+8yEPVSr2gnI3XIYBoGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730641306; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Hys/7KjvfIPIAYUIaZOYNBC8Ed9q/VILcwQ4ObN64sY=; b=GABYy5TxBYZaaLkQaPp6W1rbpjNYz4/fNb2wOOAn1pr4shV9oU1d98IXXn2TTn/ZW+ZViX2bkofTY18l0XRHSnKpAanDHmNJHKo7EP/XADNIGNKb+ra/aqOZJfRmIdSQghwo/aHpLs1KS+WjMjF5ND8A7CRjC3k9HZ3bIwQXTUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730641306684916.9638111424821; Sun, 3 Nov 2024 05:41:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7alG-0006iz-S9; Sun, 03 Nov 2024 08:35:22 -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 1t7alC-0006dn-Iy; Sun, 03 Nov 2024 08:35:18 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t7alA-0001XS-QP; Sun, 03 Nov 2024 08:35:18 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5cebcf96fabso2304244a12.3; Sun, 03 Nov 2024 05:35:15 -0800 (PST) Received: from archlinux.. (pd9ed7f6d.dip0.t-ipconnect.de. [217.237.127.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5664350esm424328866b.159.2024.11.03.05.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 05:35:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730640914; x=1731245714; 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=Hys/7KjvfIPIAYUIaZOYNBC8Ed9q/VILcwQ4ObN64sY=; b=h1/YkUMgCeR2g72D97l70MLgGnAzrXnh84qbxup/wgwXJbqQ4TiDIXp+GclcraKlA+ qwfyMXs48m5M6tQM+wUMS9GCSIjAO7/tp4dryAQAQzrcx+XK9zwj6gK055h9FZXgqujT MWKO8798kt9zRAuHaaQmmWijOF+fyGPWYjkz/dfyBiynsqV08lPCOlTE5sjSts9OV7kj IxJmdbhE3seHOcG3dB1qrp3gLoGAe1zhG0w/isGvnDHOzzNHV4GaENeuv3QF7gsT5z5Y S7UKfT7CqXTRHv4Yz0B8ySybhOrTU4UPUd8x/bU1aN5lHm3ebgUrr5uDgjHymMw/xSx+ wVKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730640914; x=1731245714; 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=Hys/7KjvfIPIAYUIaZOYNBC8Ed9q/VILcwQ4ObN64sY=; b=KCfbuOUcyv0D4dHk9yf4KCi1mfVeqr8JIqnvWhT3HhZA2aLWCim76Y0M1vsiRby45k 7mJDxpk6DkmotPAg4JCldiAeftO7q6Y59Xp5pEgLmipmoJpH35YQoibwCiEA4HVYoCuJ PsbNUOLSDHL0a/5S/5dSstkPc+Ryb8Q2WSxZoaokRIZyimwMxk/cybCIxs+5jgVQzFNx iq2/SteT8qWq/0xYEnjBSUBHF7NAxcHTHrjErPujwjQlLo7cDdFaOpjA9A+QZGS9SEhO 44mFxAH4Duzb9b6rNRHQW8DwBFH3Rk1fOWhYFrFMDbdCO+ohg67KkEdo1rvV9Vdx51Vm 1rwA== X-Forwarded-Encrypted: i=1; AJvYcCUxii9lc4FUi8l6+ki6iQJ4VOSab86PNuEo6c6IpTuPRthtwj0zO0MpvaerFbgenOxNsHgHq0tLNaQ=@nongnu.org, AJvYcCVATMhQ4sAIg5UwQyhW6S/Nb30VER4nmzb5u5O8+tYP4CsLyso9esGkPxIX+M4vKwJnekrzA9m4DUkM@nongnu.org X-Gm-Message-State: AOJu0YzV3hk4fGBy/6ly/yIkCO5utESfZJu7l4xnlNRBKamuF9FyEACA VotEdKwXd4qxYHVQRJ/fPvBQYYSI57U7Q9x8+p+tSk6xDFRMLeNpXY9wDA== X-Google-Smtp-Source: AGHT+IHwqqTdl88p6B2thIs7lnXeozEZZcKdLjFr19fMDQeKLzhh4hmeXCQPtJHMoudFFufGJhWU8Q== X-Received: by 2002:a17:907:6e94:b0:a9a:67aa:31f5 with SMTP id a640c23a62f3a-a9e508aaa56mr1256145166b.10.1730640914015; Sun, 03 Nov 2024 05:35:14 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Jason Wang , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , Hanna Reitz , Nicholas Piggin , Corey Minyard , Kevin Wolf , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , qemu-block@nongnu.org, Alex Williamson , Daniel Henrique Barboza Subject: [PATCH v4 24/26] hw/usb/hcd-ehci-sysbus: Prefer DEFINE_TYPES() macro Date: Sun, 3 Nov 2024 14:34:10 +0100 Message-ID: <20241103133412.73536-25-shentey@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241103133412.73536-1-shentey@gmail.com> References: <20241103133412.73536-1-shentey@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::52f; envelope-from=shentey@gmail.com; helo=mail-ed1-x52f.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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1730641308670116600 The naming of the TypeInfo array is inspired by hcd-ohci-sysbus. Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Bernhard Beschow --- hw/usb/hcd-ehci-sysbus.c | 118 +++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 68 deletions(-) diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 2b1652f7a8..eb7df93ac2 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -19,7 +19,6 @@ #include "hw/qdev-properties.h" #include "hw/usb/hcd-ehci.h" #include "migration/vmstate.h" -#include "qemu/module.h" =20 static const VMStateDescription vmstate_ehci_sysbus =3D { .name =3D "ehci-sysbus", @@ -97,17 +96,6 @@ static void ehci_sysbus_class_init(ObjectClass *klass, v= oid *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_type_info =3D { - .name =3D TYPE_SYS_BUS_EHCI, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(EHCISysBusState), - .instance_init =3D ehci_sysbus_init, - .instance_finalize =3D ehci_sysbus_finalize, - .abstract =3D true, - .class_init =3D ehci_sysbus_class_init, - .class_size =3D sizeof(SysBusEHCIClass), -}; - static void ehci_platform_class_init(ObjectClass *oc, void *data) { SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(oc); @@ -118,12 +106,6 @@ static void ehci_platform_class_init(ObjectClass *oc, = void *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_platform_type_info =3D { - .name =3D TYPE_PLATFORM_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .class_init =3D ehci_platform_class_init, -}; - static void ehci_exynos4210_class_init(ObjectClass *oc, void *data) { SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(oc); @@ -134,12 +116,6 @@ static void ehci_exynos4210_class_init(ObjectClass *oc= , void *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_exynos4210_type_info =3D { - .name =3D TYPE_EXYNOS4210_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .class_init =3D ehci_exynos4210_class_init, -}; - static void ehci_aw_h3_class_init(ObjectClass *oc, void *data) { SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(oc); @@ -150,12 +126,6 @@ static void ehci_aw_h3_class_init(ObjectClass *oc, voi= d *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_aw_h3_type_info =3D { - .name =3D TYPE_AW_H3_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .class_init =3D ehci_aw_h3_class_init, -}; - static void ehci_npcm7xx_class_init(ObjectClass *oc, void *data) { SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(oc); @@ -168,12 +138,6 @@ static void ehci_npcm7xx_class_init(ObjectClass *oc, v= oid *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_npcm7xx_type_info =3D { - .name =3D TYPE_NPCM7XX_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .class_init =3D ehci_npcm7xx_class_init, -}; - static void ehci_tegra2_class_init(ObjectClass *oc, void *data) { SysBusEHCIClass *sec =3D SYS_BUS_EHCI_CLASS(oc); @@ -184,12 +148,6 @@ static void ehci_tegra2_class_init(ObjectClass *oc, vo= id *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_tegra2_type_info =3D { - .name =3D TYPE_TEGRA2_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .class_init =3D ehci_tegra2_class_init, -}; - static void ehci_ppc4xx_init(Object *o) { EHCISysBusState *s =3D SYS_BUS_EHCI(o); @@ -207,13 +165,6 @@ static void ehci_ppc4xx_class_init(ObjectClass *oc, vo= id *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_ppc4xx_type_info =3D { - .name =3D TYPE_PPC4xx_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .class_init =3D ehci_ppc4xx_class_init, - .instance_init =3D ehci_ppc4xx_init, -}; - /* * Faraday FUSBH200 USB 2.0 EHCI */ @@ -282,24 +233,55 @@ static void fusbh200_ehci_class_init(ObjectClass *oc,= void *data) set_bit(DEVICE_CATEGORY_USB, dc->categories); } =20 -static const TypeInfo ehci_fusbh200_type_info =3D { - .name =3D TYPE_FUSBH200_EHCI, - .parent =3D TYPE_SYS_BUS_EHCI, - .instance_size =3D sizeof(FUSBH200EHCIState), - .instance_init =3D fusbh200_ehci_init, - .class_init =3D fusbh200_ehci_class_init, +static const TypeInfo ehci_sysbus_types[] =3D { + { + .name =3D TYPE_SYS_BUS_EHCI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(EHCISysBusState), + .instance_init =3D ehci_sysbus_init, + .instance_finalize =3D ehci_sysbus_finalize, + .abstract =3D true, + .class_init =3D ehci_sysbus_class_init, + .class_size =3D sizeof(SysBusEHCIClass), + }, + { + .name =3D TYPE_PLATFORM_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_platform_class_init, + }, + { + .name =3D TYPE_EXYNOS4210_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_exynos4210_class_init, + }, + { + .name =3D TYPE_AW_H3_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_aw_h3_class_init, + }, + { + .name =3D TYPE_NPCM7XX_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_npcm7xx_class_init, + }, + { + .name =3D TYPE_TEGRA2_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_tegra2_class_init, + }, + { + .name =3D TYPE_PPC4xx_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .class_init =3D ehci_ppc4xx_class_init, + .instance_init =3D ehci_ppc4xx_init, + }, + { + .name =3D TYPE_FUSBH200_EHCI, + .parent =3D TYPE_SYS_BUS_EHCI, + .instance_size =3D sizeof(FUSBH200EHCIState), + .instance_init =3D fusbh200_ehci_init, + .class_init =3D fusbh200_ehci_class_init, + }, }; =20 -static void ehci_sysbus_register_types(void) -{ - type_register_static(&ehci_type_info); - type_register_static(&ehci_platform_type_info); - type_register_static(&ehci_exynos4210_type_info); - type_register_static(&ehci_aw_h3_type_info); - type_register_static(&ehci_npcm7xx_type_info); - type_register_static(&ehci_tegra2_type_info); - type_register_static(&ehci_ppc4xx_type_info); - type_register_static(&ehci_fusbh200_type_info); -} - -type_init(ehci_sysbus_register_types) +DEFINE_TYPES(ehci_sysbus_types) --=20 2.47.0