public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 05/16] include: kernel.h: include printk.h
Date: Wed, 27 Nov 2019 10:02:05 +0900	[thread overview]
Message-ID: <20191127010204.GH22427@linaro.org> (raw)
In-Reply-To: <54c2a476-472c-9c28-4d23-ce3c19ee579e@gmx.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 <linux/printk.h>
> 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 <takahiro.akashi@linaro.org>
> >---
> >  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 <linux/types.h>
> >+#include <linux/printk.h> /* for printf/pr_* utilities */
> >
> >  #define USHRT_MAX	((u16)(~0U))
> >  #define SHRT_MAX	((s16)(USHRT_MAX>>1))
> >
> 

  reply	other threads:[~2019-11-27  1:02 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13  0:44 [U-Boot] [PATCH v3 00/16] import x509/pkcs7 parsers from linux AKASHI Takahiro
2019-11-13  0:44 ` [U-Boot] [PATCH v3 01/16] linux_compat: move kmemdup() from ubifs.c to linux_compat.c AKASHI Takahiro
2019-11-26  3:20   ` Heinrich Schuchardt
2019-12-06 21:48   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 02/16] rtc.h: add struct udevice declaration AKASHI Takahiro
2019-12-06 21:48   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 03/16] rtc: move date.c from drivers/rtc/ to lib/ AKASHI Takahiro
2019-12-06 21:48   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 04/16] lib: add mktime64() for linux compatibility AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 05/16] include: kernel.h: include printk.h AKASHI Takahiro
2019-11-26  3:35   ` Heinrich Schuchardt
2019-11-27  1:02     ` AKASHI Takahiro [this message]
2019-12-06 21:49   ` Tom Rini
2019-12-09  1:21     ` AKASHI Takahiro
2019-11-13  0:44 ` [U-Boot] [PATCH v3 06/16] linux/time.h: include vsprintf.h AKASHI Takahiro
2019-11-26  3:56   ` Heinrich Schuchardt
2019-11-26  7:31     ` Heinrich Schuchardt
2019-11-27  1:27       ` AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 07/16] cmd: add asn1_compiler AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 08/16] Makefile: add build script for asn1 parsers AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 09/16] lib: add asn1 decoder AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 10/16] doc: add README for asn1 compiler and decoder AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 11/16] lib: add oid registry utility AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 12/16] lib: crypto: add public key utility AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:44 ` [U-Boot] [PATCH v3 13/16] lib: crypto: add rsa public key parser AKASHI Takahiro
2019-12-06 21:49   ` Tom Rini
2019-11-13  0:45 ` [U-Boot] [PATCH v3 14/16] lib: crypto: add x509 parser AKASHI Takahiro
2019-12-06 21:50   ` Tom Rini
2019-12-07 20:51     ` Heinrich Schuchardt
2019-12-07 22:34       ` Tom Rini
2019-12-09  0:59         ` AKASHI Takahiro
2019-11-13  0:45 ` [U-Boot] [PATCH v3 15/16] lib: crypto: add pkcs7 message parser AKASHI Takahiro
2019-12-06 21:50   ` Tom Rini
2019-11-13  0:45 ` [U-Boot] [PATCH v3 16/16] test: add asn1 unit test AKASHI Takahiro
2019-12-06 21:50   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191127010204.GH22427@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox