Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2520707lqo; Tue, 14 May 2024 00:45:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHsKMfIjrMSlPNERuho/0PEzgHLsoWrB0T1QanQxuZQ7RrGndVCRInzrMQO7tXxmh6ZRbS8OibFmH80TtbYwqPJNdGmrRBM3Zx3IHCjg== X-Google-Smtp-Source: AGHT+IG3yS9OBVcGtzuP/KSXTpvjxS6dDNOkWOziTgTiq3rCbdMU6yXZ9pwdS1xxt7K4Rr/J09vY X-Received: by 2002:a05:620a:2591:b0:792:b938:7769 with SMTP id af79cd13be357-792c75787d3mr1708062285a.11.1715672751292; Tue, 14 May 2024 00:45:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715672751; cv=pass; d=google.com; s=arc-20160816; b=Sc1rH3jhqu/vm+HzQA5nLMlpIVig3g2VsDjaKswx17LmryDHcU0VQ1tP2tMPFk9O71 9OIphqeeZclRPa6VQRopS+J5dspbIIMuY2tECFaQqRDBW3nGwiyyl5nJ6zFG4GY/pq43 Qozas8agjrHKNsE4qIyYm/sxBVe2xPdTF5e2ex7Cy8syJIw7IpsJVpRY/0RnjWc+fSFu vTP+9MvcsglnvcTWt7qKb3V60/LZTdIuq2+mb7wT1UtaxKaV+3DxKxBG17LgTHAfSykR HDW+JeZRFq7BEq0Yb1PZP7RH0Q7QYxBIpajrZx0quGqP9ga1Mn9lCk+Qkq+0Mp01O7db hndQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=0LL4vsXcZ3gJkBAmT/wQvpdHFJxm76kDT7fXNvnQr7k=; fh=fc8QmARA8E7YNm1j+FzJ+zXZQ18IECegoDEeDiVUfuk=; b=asz1fQrlmfhzhuk1d8gqK8YRj3f3xIDTX14QrulNkZashES/wb4F1viYzKvccDYZw+ q7jVaxND3T2NWw9NRAjEX22dA90fsb8KbdnKdV/Rn4BMVfg7lYTIvvtmQMI8Jak0KIJl k8JbL/LLrEunKzDINvbmGMVXO+51e6TX17OajjRIaIX3n7et/xIw9rv2yLKGEUwKrWpT O7qstjCA2hdTEmpxi0VB2jXLH0kl7794a9rfUHiutT1111l2xNfqnKofTk8ySpyLgVjP 1XRCgZXm6V4xPOq5YUS+AOrG5btPTOCpEAVdz57hv2a610WmR9LpPqp91ImF4RE7l4PK rWEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AOjU5dzi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-178413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792bf277985si1246143385a.97.2024.05.14.00.45.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 00:45:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AOjU5dzi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-178413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E8F221C2173C for ; Tue, 14 May 2024 07:45:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5B7C17583; Tue, 14 May 2024 07:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AOjU5dzi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD51413ACC; Tue, 14 May 2024 07:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715672743; cv=none; b=dtAD3DpTwPdueiV91w0J9ZZeO3b7s1TlAVh/9xKIuTZ4q2BkysH3yX++bweniQkhmBMJdq4nip8/6eRCu0kFK5N3P2x740/mufVx5gCmoUkJ4J4tLSG4CSNcwB/nDbB9dBA4qs0/Ykowr7A8KivFtGX/oweezJf8IpwZILE8ZNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715672743; c=relaxed/simple; bh=EGS3ZuMGZ+F6WZx/X5Vj2TH/jG0ZBFzj2A5DAjkwPAI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cuBKKVty5JlT0D6n3v2rlNbjRcQsH+Q5tLv87qtLkFvg7mtmLRNtf1VLIa6Rp5P2fIBxGs5OlHzAstvx5BbP87PTlFzQBKD2bsyQihJp11dt4N0oYTjqTvJUjgWkgjr+IMMQhhTck5jdbCCK1XYtB8T+VYSo3WmkuNwJB0LV+Hc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AOjU5dzi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E0CDC4AF07; Tue, 14 May 2024 07:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715672743; bh=EGS3ZuMGZ+F6WZx/X5Vj2TH/jG0ZBFzj2A5DAjkwPAI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AOjU5dzizmJ+ccKgqPrPj4cKxv5pDyunMmD/rI6PXp1uKmJ273a7mFMEh3lp0Oj2t /6Q4NBUjAAyeUodIuavCcpV8+a/rRHdLFhT1wjNQXtlqP24QOK5A2h++kH43uMfc6d o16lekPQMIIu8gkTrZ0R76hkCfce2uo/lY3qsnducvDIpRUq6BnHMOnefYLpZvpmIO WI/VwJIYtOOay2VT2U1o42jtJrF2C78FW16cKmCtQhVoT2KMvhWVOgq6XuSxXrsYpV nA+6Nrb7gZDwwNW7vl7sYG7eNgoIoqoOmTvLp9UP2r7X7546O0yzvHiKCotwvGsprk 8lT4rGrUyrh5g== Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a59a8f0d941so1281218166b.2; Tue, 14 May 2024 00:45:43 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCU4di7VbMfrYdeMMlwgVD4rK4OaPlT3g3bfqeafUz4mFt9WSnWgDVM71ioNLU8jkwVwV4IfQEi6F7mp6i6TpHXZ0O/IHr8ezC6f0Qc+MkV8ceriJvJt+FtdnzI7SdVhIoEOiBeVWv8ukA== X-Gm-Message-State: AOJu0Yxe8eS5WLWBCFIMFXEOwdaCcWsRKVnk+al6dn5e66lEVHoI7H5T Zt/mqlw9/L0eV9xnnlRwQf6+3ie0JbU0E/ejk4L1wfkAYa2333gWVfK+VyfDvm2f6/zUo3XHM3r meWkbaEnmijMr0vlSBC9CcwlX4rM= X-Received: by 2002:a17:906:6a1c:b0:a5a:6c0e:90f7 with SMTP id a640c23a62f3a-a5a6c0e91a4mr357298266b.42.1715672741853; Tue, 14 May 2024 00:45:41 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240514073910.27048-1-yangtiezhu@loongson.cn> In-Reply-To: <20240514073910.27048-1-yangtiezhu@loongson.cn> From: Huacai Chen Date: Tue, 14 May 2024 15:45:30 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] LoongArch: Remove ACPI related ifdefs in platform_init() To: Tiezhu Yang Cc: rafael@kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Tiezhu, On Tue, May 14, 2024 at 3:39=E2=80=AFPM Tiezhu Yang wrote: > > acpi_table_upgrade() and acpi_boot_table_init() are defined as > empty function under !CONFIG_ACPI_TABLE_UPGRADE and !CONFIG_ACPI > in include/linux/acpi.h, there are no implicit declaration errors > with various configs. Furthermore, CONFIG_ACPI is always set due > to config ACPI is selected by config LOONGARCH. Thus, just remove > ACPI related ifdefs to call the functions directly. > > #ifdef CONFIG_ACPI_TABLE_UPGRADE > void acpi_table_upgrade(void); > #else > static inline void acpi_table_upgrade(void) { } > #endif > > #ifdef CONFIG_ACPI > ... > void acpi_boot_table_init (void); > ... > #else /* !CONFIG_ACPI */ > ... > static inline void acpi_boot_table_init(void) > { > } > ... > #endif /* !CONFIG_ACPI */ > > Signed-off-by: Tiezhu Yang > --- > > Another way is to guard the related code under CONFIG_ACPI, > but I think it is not necessary, like this: > > @@ -351,10 +351,8 @@ void __init platform_init(void) > arch_reserve_vmcore(); > arch_reserve_crashkernel(); > > -#ifdef CONFIG_ACPI_TABLE_UPGRADE > - acpi_table_upgrade(); > -#endif > #ifdef CONFIG_ACPI > + acpi_table_upgrade(); > acpi_gbl_use_default_register_widths =3D false; > acpi_boot_table_init(); > #endif I agree to remove CONFIG_ACPI_TABLE_UPGRADE since it is ugly and unnecessary here. But I prefer to keep CONFIG_ACPI (in addition, put acpi_table_upgrade() after CONFIG_ACPI). Because CONFIG_ACPI is not just to prevent build error, but also a signal to tell us the code is ACPI-specific. Huacai > > arch/loongarch/kernel/setup.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.= c > index 60e0fe97f61a..da96f871cf73 100644 > --- a/arch/loongarch/kernel/setup.c > +++ b/arch/loongarch/kernel/setup.c > @@ -351,13 +351,9 @@ void __init platform_init(void) > arch_reserve_vmcore(); > arch_reserve_crashkernel(); > > -#ifdef CONFIG_ACPI_TABLE_UPGRADE > acpi_table_upgrade(); > -#endif > -#ifdef CONFIG_ACPI > acpi_gbl_use_default_register_widths =3D false; > acpi_boot_table_init(); > -#endif > > early_init_fdt_scan_reserved_mem(); > unflatten_and_copy_device_tree(); > -- > 2.42.0 >