From mboxrd@z Thu Jan 1 00:00:00 1970 From: AKASHI Takahiro Date: Wed, 27 Nov 2019 10:02:05 +0900 Subject: [U-Boot] [PATCH v3 05/16] include: kernel.h: include printk.h In-Reply-To: <54c2a476-472c-9c28-4d23-ce3c19ee579e@gmx.de> References: <20191113004502.29986-1-takahiro.akashi@linaro.org> <20191113004502.29986-6-takahiro.akashi@linaro.org> <54c2a476-472c-9c28-4d23-ce3c19ee579e@gmx.de> Message-ID: <20191127010204.GH22427@linaro.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Heinrich, On Tue, Nov 26, 2019 at 04:35:00AM +0100, Heinrich Schuchardt wrote: > On 11/13/19 1:44 AM, AKASHI Takahiro wrote: > >Adding "printk.h" will help improve portability from linux kernel > >code (in my case, lib/asn1_decoder.c and others) where printf and > > nits: > > %s/printf/printk/g Okay. > You anyway change the includes in lib/crypto/public_key.c in patch 12/16 > and lib/asn1_decoder in patch 09/16. So why not add linux/printk.h there? I would rather disagree here as I have good reasons. First, adding "printk.h" to "linux/kernel.h" makes sense simply as Linux's original "linux/kernel.h" also has it. So when you will import any files from linux in the future, you will probably get *less* bothered with missing include files in .c file. Second, I would like to change linux code at the very minimum if possible. In lib/crypto/public_key.c, for example, I simply deleted not-used and non-existing include files or just replaced any with its counterpart in U-Boot (module.h -> compat.h). > Otherwise I would expect this patch to remove #include > in all files where it becomes obsolete due to this patch, e.g. > > board/synopsys/hsdk/hsdk.c > arch/arm/mach-uniphier/fdt-fixup.c > arch/arm/mach-uniphier/dram_init.c > arch/arm/mach-uniphier/arm32/psci.c > arch/arm/mach-uniphier/dram/ddrphy-training.c I don't fully understand that why those files include "linux/kernel.h". Different source files may include "linux/kernel.h" for different reasons. Take board/synopsys/hsdk/hsdk.c, for example. It uses ARRAY_SIZE macro for its convenience, *not* for printk. I believe that including any include files *directly & explicitly* for its own use of any definitions or functions is a good practice even if such include files may be included *indirectly* via another include file. So I want to keep this patch unchanged. -Takahiro Akashi > Best regards > > Heinrich > > >pr_* variant functions are used. > > > >Signed-off-by: AKASHI Takahiro > >--- > > include/linux/kernel.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > >diff --git a/include/linux/kernel.h b/include/linux/kernel.h > >index 5c7e5f635b1a..564819a1c0a7 100644 > >--- a/include/linux/kernel.h > >+++ b/include/linux/kernel.h > >@@ -1,8 +1,8 @@ > > #ifndef _LINUX_KERNEL_H > > #define _LINUX_KERNEL_H > > > >- > > #include > >+#include /* for printf/pr_* utilities */ > > > > #define USHRT_MAX ((u16)(~0U)) > > #define SHRT_MAX ((s16)(USHRT_MAX>>1)) > > >