From patchwork Tue Nov 5 22:47:22 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: 840831 Delivered-To: patch@linaro.org Received: by 2002:a5d:6307:0:b0:381:e71e:8f7b with SMTP id i7csp240277wru; Tue, 5 Nov 2024 14:51:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVWWjg8/IR2tT2ADe21LT+NV2c5sp6Pccrg8jknLMmDxsjrAPrhRb6faAfYxx5LypiXP6SkNw==@linaro.org X-Google-Smtp-Source: AGHT+IEgRxOhdFrZUd+e4BwhTrv+kWw+gTpXRfbH4En9diFr7njRvVVOL1blrbeGt4E8ErQj27gT X-Received: by 2002:a05:6214:3d08:b0:6cb:ef8d:b10 with SMTP id 6a1803df08f44-6d18584a5ddmr557830836d6.39.1730847060052; Tue, 05 Nov 2024 14:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730847060; cv=none; d=google.com; s=arc-20240605; b=fGXbNR/lkdI81RlQPOCzC3pH3FdDCpoNyIKbnSp7cQIfxYoh7RGfgPsP/Jxnw1OVdV F4V50Sb8rtn2KpE19SDUNLwVsF+GcsVU36HCR08bHjal1cLARcMt7eJDxoxEfxaguQCf I1fTsnZl/Lc8W1mdsNNt+KZslQYahfgshKsyHD/rYQ3arWBU+BVZPLV5COPWjcGdxylJ 3yI1DyzdaWNrQNkdGWPNNVn8Fv81M6+0h3kgzjIJBbHCZC18dznbPgCrtnst5VYOIwea AJfdLfVVLj5eDDL3s6T7/i4QJxL246vt99zo3eQC2Wsw7tTNHO1rG6hJcPO+G8aS7f7v YO5w== 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=POH9GGPh8eEOywwiqXrYQY7PtUqeDBAiKsSZ852ign4=; fh=AUbIe/x05OB54MpDx0J1ZtOu3YJ9qKm4HFGYPvj71BQ=; b=LR3UTo3X3UsVkzqSBUjUrG0L8TrgQw/9zZAZy2bjdckqVLmLj67DsOzMZITEWlDPg8 6XPxNaOGLddJKDqaB39Rv9/20c8B8wpH92/dn7flaPDvXwZEQp47W2agVJwBGXqs3IqO bx4b89Z270vKCwGv4JGqhNmCqf0YcU9/xFT1nSlTL99bcWKccgBq5lds2kKQBsQeDH4d YA3z4WfJW+1FJMvPoAuUR+JicJtcJa8aaI9mcHD7XWBkComlfZFl+rJ+eSWQwjANKzwg 1BxCUsFFvpi8hmucQ5doMv0O7+EeKVm8E9wk6MH6RFyO3cV6eMHDAiuAwUYjqp+bbqDT PaJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mgeeHISb; 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 6a1803df08f44-6d36837f14bsi93882426d6.281.2024.11.05.14.50.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Nov 2024 14:51:00 -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=mgeeHISb; 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 1t8SNL-0001Dy-Jd; Tue, 05 Nov 2024 17:50:20 -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 1t8SMo-0000pG-Ou for qemu-devel@nongnu.org; Tue, 05 Nov 2024 17:49:43 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8SMm-0004Rs-Uj for qemu-devel@nongnu.org; Tue, 05 Nov 2024 17:49:42 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43161c0068bso50977385e9.1 for ; Tue, 05 Nov 2024 14:49:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730846978; x=1731451778; 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=POH9GGPh8eEOywwiqXrYQY7PtUqeDBAiKsSZ852ign4=; b=mgeeHISbJftcn3a5xULqlnrGKJ9MaaWBKY4x6iSfskmIfuwh8MjTVXiq6d0zNDCA4m B3Gr2Jb6cSJ06t+pM93JteSEQEDwIxq2J9v6wAoM+TL1rLE3KlY0QV2bMW8WgvVi8OUp qIU398kgd+71RIK68Opc7OVI0ZWaSnMY/EMIUOdNuSFImfQgVopjDY+74e1TSpTzAD1H OGQDz8PF5NsZuI+HWUR54AaHhC1OAdmXhvvkjPr2YL4oBis8wsEPD3xOPWjUBRO0lnaq Npld8ZNItksaUYbdz09v7UHZPXr7VJ0zRObBL/jRva8lswjp4ZYPIWNhAnDrwTAbP/1J fRzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730846978; x=1731451778; 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=POH9GGPh8eEOywwiqXrYQY7PtUqeDBAiKsSZ852ign4=; b=CadkVaSAwKOFqfGo3s3p1TltQXQ5L8uI4rFn/mCDkFo8uND4v9gmpGXp+9/VPvvVPW AifzDnxdVdm9ZK4w1RT17oXPh/Qg+n3oD1BvUb2X04OnHopxdwSupzXxrJe8uRf/NPU7 NOPu0Of2VPd0raZq8u34A/mHRyXBgxy1lzF9LK3vObx5vjM6nCA0aVZotex9RbkkTpcl O6XtU0FmYCPCnUqsX7MKifD/6gRWE/wu5qzR7fNsHwXPWHVblvY45pzJl7Uy7yEWCxKE m3o58+Xzu9GMoqx4kUSgNAP6wsFM1VBK4CiulpZtYxxNhxVzdoUJJ75dg2s/1/2lcgdI jSNw== X-Gm-Message-State: AOJu0Ywxhl2BWc1WPlZrWWAW00QR8tPSw/6oZQjcyornOmVV/Gu+ws7V rbtdKOBt6IS7yxweASSITZGsnexNKLCq9agMBLkY2d1vz16fc1MiYSEp8A/4dkTYWEQmppfStBH w/rq3hQ== X-Received: by 2002:adf:e198:0:b0:37d:51bc:3229 with SMTP id ffacd0b85a97d-381c7ac7d79mr14398421f8f.51.1730846978069; Tue, 05 Nov 2024 14:49:38 -0800 (PST) Received: from localhost.localdomain ([154.14.63.34]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10d40d5sm17255398f8f.25.2024.11.05.14.49.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Nov 2024 14:49:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bernhard Beschow , =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Philippe_Math?= =?utf-8?q?ieu-Daud=C3=A9?= Subject: [PULL 24/29] hw/sd/sdhci: Prefer DEFINE_TYPES() macro Date: Tue, 5 Nov 2024 22:47:22 +0000 Message-ID: <20241105224727.53059-25-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241105224727.53059-1-philmd@linaro.org> References: <20241105224727.53059-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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 From: Bernhard Beschow Reviewed-by: Cédric Le Goater Signed-off-by: Bernhard Beschow Message-ID: <20241103133412.73536-21-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/sd/sdhci.c | 62 +++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index ed014993910..dbe5c2340c6 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -37,7 +37,6 @@ #include "migration/vmstate.h" #include "sdhci-internal.h" #include "qemu/log.h" -#include "qemu/module.h" #include "trace.h" #include "qom/object.h" @@ -1598,15 +1597,6 @@ static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) sdhci_common_class_init(klass, data); } -static const TypeInfo sdhci_sysbus_info = { - .name = TYPE_SYSBUS_SDHCI, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(SDHCIState), - .instance_init = sdhci_sysbus_init, - .instance_finalize = sdhci_sysbus_finalize, - .class_init = sdhci_sysbus_class_init, -}; - /* --- qdev bus master --- */ static void sdhci_bus_class_init(ObjectClass *klass, void *data) @@ -1617,13 +1607,6 @@ static void sdhci_bus_class_init(ObjectClass *klass, void *data) sbc->set_readonly = sdhci_set_readonly; } -static const TypeInfo sdhci_bus_info = { - .name = TYPE_SDHCI_BUS, - .parent = TYPE_SD_BUS, - .instance_size = sizeof(SDBus), - .class_init = sdhci_bus_class_init, -}; - /* --- qdev i.MX eSDHC --- */ #define USDHC_MIX_CTRL 0x48 @@ -1882,12 +1865,6 @@ static void imx_usdhc_init(Object *obj) s->quirks = SDHCI_QUIRK_NO_BUSY_IRQ; } -static const TypeInfo imx_usdhc_info = { - .name = TYPE_IMX_USDHC, - .parent = TYPE_SYSBUS_SDHCI, - .instance_init = imx_usdhc_init, -}; - /* --- qdev Samsung s3c --- */ #define S3C_SDHCI_CONTROL2 0x80 @@ -1946,18 +1923,31 @@ static void sdhci_s3c_init(Object *obj) s->io_ops = &sdhci_s3c_mmio_ops; } -static const TypeInfo sdhci_s3c_info = { - .name = TYPE_S3C_SDHCI , - .parent = TYPE_SYSBUS_SDHCI, - .instance_init = sdhci_s3c_init, +static const TypeInfo sdhci_types[] = { + { + .name = TYPE_SDHCI_BUS, + .parent = TYPE_SD_BUS, + .instance_size = sizeof(SDBus), + .class_init = sdhci_bus_class_init, + }, + { + .name = TYPE_SYSBUS_SDHCI, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SDHCIState), + .instance_init = sdhci_sysbus_init, + .instance_finalize = sdhci_sysbus_finalize, + .class_init = sdhci_sysbus_class_init, + }, + { + .name = TYPE_IMX_USDHC, + .parent = TYPE_SYSBUS_SDHCI, + .instance_init = imx_usdhc_init, + }, + { + .name = TYPE_S3C_SDHCI, + .parent = TYPE_SYSBUS_SDHCI, + .instance_init = sdhci_s3c_init, + }, }; -static void sdhci_register_types(void) -{ - type_register_static(&sdhci_sysbus_info); - type_register_static(&sdhci_bus_info); - type_register_static(&imx_usdhc_info); - type_register_static(&sdhci_s3c_info); -} - -type_init(sdhci_register_types) +DEFINE_TYPES(sdhci_types)