From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jisheng Zhang Date: Tue, 18 Jan 2022 22:13:03 +0800 Subject: [PATCH v2 0/5] kexec: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef In-Reply-To: <20220116133847.GE2388@MiWiFi-R3L-srv> References: <20211206160514.2000-1-jszhang@kernel.org> <20220116133847.GE2388@MiWiFi-R3L-srv> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kexec@lists.infradead.org On Sun, Jan 16, 2022 at 09:38:47PM +0800, Baoquan He wrote: > Hi Jisheng, Hi Baoquan, > > On 12/07/21 at 12:05am, Jisheng Zhang wrote: > > Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" > > by a check for "IS_ENABLED(CONFIG_KEXEC_CORE)", to simplify the code > > and increase compile coverage. > > I go through this patchset, You mention the benefits it brings are > 1) simplity the code; > 2) increase compile coverage; > > For benefit 1), it mainly removes the dummy function in x86, arm and > arm64, right? Another benefit: remove those #ifdef #else #endif usage. Recently, I fixed a bug due to lots of "#ifdefs": http://lists.infradead.org/pipermail/linux-riscv/2021-December/010607.html > > For benefit 2), increasing compile coverage, could you tell more how it > achieves and why it matters? What if people disables CONFIG_KEXEC_CORE in > purpose? Please forgive my poor compiling knowledge. Just my humble opinion, let's compare the code:: #ifdef CONFIG_KEXEC_CORE code block A; #endif If KEXEC_CORE is disabled, code block A won't be compiled at all, the preprocessor will remove code block A; If we convert the code to: if (IS_ENABLED(CONFIG_KEXEC_CORE)) { code block A; } Even if KEXEC_CORE is disabled, code block A is still compiled. Thanks