From patchwork Wed May 31 20:35:45 2023 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: 687303 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1459126wru; Wed, 31 May 2023 13:36:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ72RNVnmnTKnZ6aOYE1YbEdXYU4ZvDGM+Db0aeCCkmfl8p2/GFD3+5Spsg3kIAT+KB/9WXA X-Received: by 2002:a05:620a:45a6:b0:75b:23a0:e7ca with SMTP id bp38-20020a05620a45a600b0075b23a0e7camr7758084qkb.43.1685565400556; Wed, 31 May 2023 13:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685565400; cv=none; d=google.com; s=arc-20160816; b=L4+LH14rQGrWUlW5qHBVoUVOCTJao1ggnJtO5rBivOMOEOocTvPyQMgKAqkccJL5B/ ZkvVPgpOHjKEZcOXgr90FR1y+7Yel4vVny2yVNEb8i27abwOjALWYIB+yh4N8gxzWGGh nbaSpYoO1dGNSAFkCQG+7YuUHVK1/mUYKnfvXcmreksyYyKiJ0IqDVmNQa9PVEqd+CJv Br3k9BzFrECcIktpSdVi2PBZChnyRFQQpac302gBCDjmjd3QgfV2cPGB/xgzjrgvTkkg NgN7y5F/OQcUjN59GCUjls0/gHrxfuz9HG04z1YLRSYkl+u0TfRbVb9jklJ0WOuWn3qe Z+sQ== 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=axVpU0i2p75LH2asCUomaSunVbrAGYJD7scBST0rZU4=; b=Aoax+BiYu9gFB+bdhqYw2EcqRMUTQ4cmRdPeW5e6pmyV8YSWZmmIVNs9FNh4o4ZOk2 1HwMUbcCqDqKAQc9+PYPTNOSuw5sTegj7ExI0kwUNp6+kBfSzicjAnENN21+HRwpP7Sv f4xUH/fD5xCOxwU9LMMcTxx8a3yotWcsubttx8LeagtF7MojQshm2RRaMX0yLMgoLTKA A/8rm/0OptKte0ONvpa0WDvb32wFpDkXYiUcEb5Mj4YHLpI0hdrOOwiSZSdM7wKC979W F8pRdWvPSulDfcoVM6AoA8Q4aRufaowlSvZ8CW5S4+qqpWnhZx9JI+2Im+L5MBM4+Ke2 //Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w4dI9igE; 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 dy30-20020a05620a60de00b007591606f36csi8525326qkb.696.2023.05.31.13.36.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 May 2023 13:36:40 -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=w4dI9igE; 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 1q4SYL-00078f-6b; Wed, 31 May 2023 16:36:17 -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 1q4SYF-00075O-WD for qemu-devel@nongnu.org; Wed, 31 May 2023 16:36:12 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4SYE-0003AO-DB for qemu-devel@nongnu.org; Wed, 31 May 2023 16:36:11 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f606912ebaso939665e9.3 for ; Wed, 31 May 2023 13:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685565368; x=1688157368; 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=axVpU0i2p75LH2asCUomaSunVbrAGYJD7scBST0rZU4=; b=w4dI9igElL4S66mQ9PeZEGHEm2TRMeJISnLQ4j/7gJEv3yMR/8O/7L9VTf1mCwuHGy WXfNkzEDJGcf31Zj33BP1CWpJcEMpLeMfvsaSZDhD+3iWFRk1rDCv+e52/g8+bhLU6P+ PMVQvY3Urrs/G67vF7kmvVbu6vhXSTGbgIs50uwb90KOEcQ+uHR/soR2MilbxHIqAw7K g5IjRF9dxWIpcbwDfUa03Uhw4qsA4QiBc6aJM9HkGnDpuNF/xllFbfiXygllika60PS5 FRtxwwrTAE+MzNjqIr36N6rFSz0MjL1AEqiptgTt0sDtF0kR1tCGo83p3/iKrh2NcSsy hd6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685565368; x=1688157368; 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=axVpU0i2p75LH2asCUomaSunVbrAGYJD7scBST0rZU4=; b=lGnOlXgeaJxF4psj/qP8rCqQG2PEx6fg9sNgKY10GYlh3dxj0JY/Croh/Kqw0IMTQo YFYke0lBvj34tYL+DNrOlH+c+qjH74ytwviDdGlTcTSJSVMx69aIdUMkkZW4dnREknKz cDU+cX2zyvUbQhPPgEzBBPbaSuVYujOemdd9IM3OjWVe2otDmEKqCgVLbZLQinMAIWZR Rk19kwj6kyNvlzXst75pF7WNpDWD6skzmOhwTDCkpZ0Cvgy5fXU0fgtkxhkkUNgKBQ2j 8h5l7Kb257JHh0edWJkWGkb3TF8izAeupZuYoUJOzzV0qf2Qbwca150pMKRzd4O3wAra PIHw== X-Gm-Message-State: AC+VfDzOYFOuTma1c2XgOR1JIay8BYkcjl8NVlWj/QKCMrFdup0AnEBz MzY9DDtN4cBKRtZ7jvgEunjL7jeqO6uq3E3qt2w= X-Received: by 2002:a7b:ce91:0:b0:3f6:89a:94c8 with SMTP id q17-20020a7bce91000000b003f6089a94c8mr301976wmj.24.1685565368541; Wed, 31 May 2023 13:36:08 -0700 (PDT) Received: from localhost.localdomain ([176.176.146.12]) by smtp.gmail.com with ESMTPSA id i7-20020a05600c290700b003f42d8dd7ffsm21935638wmd.19.2023.05.31.13.36.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 31 May 2023 13:36:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Peter Maydell , Sergey Kambalin , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 01/15] hw/timer/arm_timer: Declare QOM types using DEFINE_TYPES() macro Date: Wed, 31 May 2023 22:35:45 +0200 Message-Id: <20230531203559.29140-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230531203559.29140-1-philmd@linaro.org> References: <20230531203559.29140-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. Replace the type_init() / type_register_static() combination. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/timer/arm_timer.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index 69c8863472..e410b37a23 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -380,13 +380,6 @@ static void icp_pit_init(Object *obj) save themselves. */ } -static const TypeInfo icp_pit_info = { - .name = TYPE_INTEGRATOR_PIT, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(icp_pit_state), - .instance_init = icp_pit_init, -}; - static Property sp804_properties[] = { DEFINE_PROP_UINT32("freq0", SP804State, freq0, 1000000), DEFINE_PROP_UINT32("freq1", SP804State, freq1, 1000000), @@ -402,18 +395,20 @@ static void sp804_class_init(ObjectClass *klass, void *data) k->vmsd = &vmstate_sp804; } -static const TypeInfo sp804_info = { - .name = TYPE_SP804, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(SP804State), - .instance_init = sp804_init, - .class_init = sp804_class_init, +static const TypeInfo arm_timer_types[] = { + { + .name = TYPE_INTEGRATOR_PIT, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(icp_pit_state), + .instance_init = icp_pit_init, + + }, { + .name = TYPE_SP804, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SP804State), + .instance_init = sp804_init, + .class_init = sp804_class_init, + } }; -static void arm_timer_register_types(void) -{ - type_register_static(&icp_pit_info); - type_register_static(&sp804_info); -} - -type_init(arm_timer_register_types) +DEFINE_TYPES(arm_timer_types)