diff mbox series

[U-Boot,v1,03/11] include: kernel.h: include printk.h

Message ID 20191011074200.30269-4-takahiro.akashi@linaro.org
State Superseded
Delegated to: Tom Rini
Headers show
Series import x509/pkcs7 parsers from linux | expand

Commit Message

AKASHI Takahiro Oct. 11, 2019, 7:41 a.m. UTC
Adding "printk.h" will help improve portability from linux kernel
code (in my case, lib/asn1_decoder.c).

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 include/linux/kernel.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Heinrich Schuchardt Oct. 12, 2019, 11:47 a.m. UTC | #1
On 10/11/19 9:41 AM, AKASHI Takahiro wrote:
> Adding "printk.h" will help improve portability from linux kernel
> code (in my case, lib/asn1_decoder.c).
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>   include/linux/kernel.h | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index a85c15d8dc28..919d12bdf89c 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -2,7 +2,9 @@
>   #define _LINUX_KERNEL_H
>
>
> +#include <vsprintf.h> /* for printf utilities */

Kernel code has no vsprintf.h. Linux's lib/asn1_decoder.c has not a
single print statement. So why are you inserting vsprintf.h here?

>   #include <linux/types.h>
> +#include <linux/printk.h>

Linux include/linux/kernel.h also includes printk.h. OK.

Best regards

Heinrich
>
>   #define USHRT_MAX	((u16)(~0U))
>   #define SHRT_MAX	((s16)(USHRT_MAX>>1))
>
AKASHI Takahiro Oct. 17, 2019, 5:58 a.m. UTC | #2
On Sat, Oct 12, 2019 at 01:47:06PM +0200, Heinrich Schuchardt wrote:
> On 10/11/19 9:41 AM, AKASHI Takahiro wrote:
> >Adding "printk.h" will help improve portability from linux kernel
> >code (in my case, lib/asn1_decoder.c).
> >
> >Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >---
> >  include/linux/kernel.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> >diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> >index a85c15d8dc28..919d12bdf89c 100644
> >--- a/include/linux/kernel.h
> >+++ b/include/linux/kernel.h
> >@@ -2,7 +2,9 @@
> >  #define _LINUX_KERNEL_H
> >
> >
> >+#include <vsprintf.h> /* for printf utilities */
> 
> Kernel code has no vsprintf.h. Linux's lib/asn1_decoder.c has not a
> single print statement. So why are you inserting vsprintf.h here?

I don't remember why I mentioned to asn1_decoder.c here, but
When this statement is removed from kernel.h, some files cannot
be compiled.
The fact is that sprintf() is used in time.h without including any
related headers.
(There are still bunch of *missing headers* issues in U-Boot.)

I will add one more patch against time.h here.

Thanks,
-Takahiro Akashi


> >  #include <linux/types.h>
> >+#include <linux/printk.h>
> 
> Linux include/linux/kernel.h also includes printk.h. OK.
> 
> Best regards
> 
> Heinrich
> >
> >  #define USHRT_MAX	((u16)(~0U))
> >  #define SHRT_MAX	((s16)(USHRT_MAX>>1))
> >
>
AKASHI Takahiro Oct. 17, 2019, 6:17 a.m. UTC | #3
On Thu, Oct 17, 2019 at 02:58:45PM +0900, AKASHI Takahiro wrote:
> On Sat, Oct 12, 2019 at 01:47:06PM +0200, Heinrich Schuchardt wrote:
> > On 10/11/19 9:41 AM, AKASHI Takahiro wrote:
> > >Adding "printk.h" will help improve portability from linux kernel
> > >code (in my case, lib/asn1_decoder.c).
> > >
> > >Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > >---
> > >  include/linux/kernel.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > >diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > >index a85c15d8dc28..919d12bdf89c 100644
> > >--- a/include/linux/kernel.h
> > >+++ b/include/linux/kernel.h
> > >@@ -2,7 +2,9 @@
> > >  #define _LINUX_KERNEL_H
> > >
> > >
> > >+#include <vsprintf.h> /* for printf utilities */
> > 
> > Kernel code has no vsprintf.h. Linux's lib/asn1_decoder.c has not a
> > single print statement. So why are you inserting vsprintf.h here?
> 
> I don't remember why I mentioned to asn1_decoder.c here, but

For the record, asn1_parser.c uses pr_debug/pr_devel and others
in many places.

-Takahiro Akashi

> When this statement is removed from kernel.h, some files cannot
> be compiled.
> The fact is that sprintf() is used in time.h without including any
> related headers.
> (There are still bunch of *missing headers* issues in U-Boot.)
> 
> I will add one more patch against time.h here.
> 
> Thanks,
> -Takahiro Akashi
> 
> 
> > >  #include <linux/types.h>
> > >+#include <linux/printk.h>
> > 
> > Linux include/linux/kernel.h also includes printk.h. OK.
> > 
> > Best regards
> > 
> > Heinrich
> > >
> > >  #define USHRT_MAX	((u16)(~0U))
> > >  #define SHRT_MAX	((s16)(USHRT_MAX>>1))
> > >
> >
diff mbox series

Patch

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index a85c15d8dc28..919d12bdf89c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -2,7 +2,9 @@ 
 #define _LINUX_KERNEL_H
 
 
+#include <vsprintf.h> /* for printf utilities */
 #include <linux/types.h>
+#include <linux/printk.h>
 
 #define USHRT_MAX	((u16)(~0U))
 #define SHRT_MAX	((s16)(USHRT_MAX>>1))