mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] include: rename printk.h to printf.h
@ 2025-01-06  9:19 Ahmad Fatoum
  2025-01-06  9:19 ` [PATCH 2/2] vsprintf: document %JP format specifier as being barebox-specific Ahmad Fatoum
  2025-01-06 13:21 ` [PATCH 1/2] include: rename printk.h to printf.h Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-01-06  9:19 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We also have <linux/printk.h>, which defines the pr_* and dev_* family
of Linux logging functions. printk.h only defines the base printing
functions as well as the printk macro, which expands to printf.

To make it clearer, which is which, rename printk.h to printf.h.

No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/mmu-common.h         |  2 +-
 arch/arm/mach-imx/bootrom-cmd.c   |  2 +-
 arch/riscv/lib/stacktrace.c       |  2 +-
 include/asm-generic/bug.h         |  2 +-
 include/firmware.h                |  2 +-
 include/linux/barebox-wrapper.h   |  2 +-
 include/linux/printk.h            |  2 +-
 include/printk.h                  | 63 -------------------------------
 include/stdio.h                   |  2 +-
 include/tlsf.h                    |  2 +-
 scripts/include/asm-generic/bug.h |  2 +-
 test/self/idr.c                   |  2 +-
 12 files changed, 11 insertions(+), 74 deletions(-)
 delete mode 100644 include/printk.h

diff --git a/arch/arm/cpu/mmu-common.h b/arch/arm/cpu/mmu-common.h
index ec24f5c89f2b..d0b50662570a 100644
--- a/arch/arm/cpu/mmu-common.h
+++ b/arch/arm/cpu/mmu-common.h
@@ -3,7 +3,7 @@
 #ifndef __ARM_MMU_COMMON_H
 #define __ARM_MMU_COMMON_H
 
-#include <printk.h>
+#include <printf.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
diff --git a/arch/arm/mach-imx/bootrom-cmd.c b/arch/arm/mach-imx/bootrom-cmd.c
index 76455db301fe..afdf1302254b 100644
--- a/arch/arm/mach-imx/bootrom-cmd.c
+++ b/arch/arm/mach-imx/bootrom-cmd.c
@@ -3,7 +3,7 @@
 #include <command.h>
 #include <errno.h>
 #include <getopt.h>
-#include <printk.h>
+#include <printf.h>
 #include <linux/bitops.h>
 #include <linux/bitfield.h>
 #include <mach/imx/imx8m-regs.h>
diff --git a/arch/riscv/lib/stacktrace.c b/arch/riscv/lib/stacktrace.c
index b678ad7d5241..7cf102a06fe0 100644
--- a/arch/riscv/lib/stacktrace.c
+++ b/arch/riscv/lib/stacktrace.c
@@ -8,7 +8,7 @@
  */
 
 #include <linux/kernel.h>
-#include <printk.h>
+#include <printf.h>
 #include <asm/unwind.h>
 #include <asm/ptrace.h>
 #include <asm-generic/memory_layout.h>
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 0277527491cf..389327adfc5d 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -4,7 +4,7 @@
 #define _ASM_GENERIC_BUG_H
 
 #include <linux/compiler.h>
-#include <printk.h>
+#include <printf.h>
 
 #define BUG() do { \
 	printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
diff --git a/include/firmware.h b/include/firmware.h
index 361ff2f8ae52..d7feae13719b 100644
--- a/include/firmware.h
+++ b/include/firmware.h
@@ -7,7 +7,7 @@
 #define FIRMWARE_H
 
 #include <pbl.h>
-#include <printk.h>
+#include <printf.h>
 #include <types.h>
 #include <driver.h>
 #include <debug_ll.h>
diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h
index 8320a24b7bc1..7f584662f33a 100644
--- a/include/linux/barebox-wrapper.h
+++ b/include/linux/barebox-wrapper.h
@@ -5,7 +5,7 @@
 #include <xfuncs.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <printk.h>
+#include <printf.h>
 
 #define vmalloc(len)		malloc(len)
 #define __vmalloc(len, mode, pgsz)	malloc(len)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 9fdf97507483..469ca879c7fd 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -4,7 +4,7 @@
 
 #include <linux/list.h>
 #include <linux/err.h>
-#include <printk.h>
+#include <printf.h>
 #include <stdarg.h>
 
 #define MSG_EMERG      0    /* system is unusable */
diff --git a/include/printk.h b/include/printk.h
deleted file mode 100644
index d0e56e1994a2..000000000000
--- a/include/printk.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __PRINTK_H
-#define __PRINTK_H
-
-#include <linux/types.h>
-
-struct device;
-
-#define KERN_EMERG      ""   /* system is unusable                   */
-#define KERN_ALERT      ""   /* action must be taken immediately     */
-#define KERN_CRIT       ""   /* critical conditions                  */
-#define KERN_ERR        ""   /* error conditions                     */
-#define KERN_WARNING    ""   /* warning conditions                   */
-#define KERN_NOTICE     ""   /* normal but significant condition     */
-#define KERN_INFO       ""   /* informational                        */
-#define KERN_DEBUG      ""   /* debug-level messages                 */
-#define KERN_CONT       ""
-
-#if (IN_PROPER && !defined(CONFIG_CONSOLE_NONE)) || \
-	(IN_PBL && defined(CONFIG_PBL_CONSOLE))
-int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
-#else
-static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
-static inline int printf(const char *fmt, ...)
-{
-	return 0;
-}
-#endif
-
-void __attribute__((noreturn)) panic(const char *fmt, ...);
-void __attribute__((noreturn)) panic_no_stacktrace(const char *fmt, ...);
-
-#define printk			printf
-
-enum {
-	DUMP_PREFIX_NONE,
-	DUMP_PREFIX_ADDRESS,
-	DUMP_PREFIX_OFFSET
-};
-extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
-			      int groupsize, char *linebuf, size_t linebuflen,
-			      bool ascii);
-extern void dev_print_hex_dump(struct device *dev, const char *level,
-			       const char *prefix_str, int prefix_type,
-			       int rowsize, int groupsize, const void *buf,
-			       size_t len, bool ascii);
-
-#define print_hex_dump(level, prefix_str, prefix_type, rowsize,		       \
-			     groupsize, buf, len, ascii)		       \
-	dev_print_hex_dump(NULL, level, prefix_str, prefix_type, rowsize,      \
-		       groupsize, buf, len, ascii)
-
-#ifdef CONFIG_ARCH_HAS_STACK_DUMP
-void dump_stack(void);
-#else
-static inline void dump_stack(void)
-{
-	printf("no stack data available\n");
-}
-#endif
-
-
-#endif
diff --git a/include/stdio.h b/include/stdio.h
index 883b06529fdc..c02d383d6bad 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -4,7 +4,7 @@
 
 #include <stdarg.h>
 #include <console.h>
-#include <printk.h>
+#include <printf.h>
 
 /*
  * STDIO based functions (can always be used)
diff --git a/include/tlsf.h b/include/tlsf.h
index 2f82d0fa005b..e0dcdac1e7ab 100644
--- a/include/tlsf.h
+++ b/include/tlsf.h
@@ -42,7 +42,7 @@
 extern "C" {
 #endif
 
-#include <printk.h>
+#include <printf.h>
 #include <linux/bug.h>
 
 #define tlsf_assert(expr) do {                              \
diff --git a/scripts/include/asm-generic/bug.h b/scripts/include/asm-generic/bug.h
index c53ced628fcc..6847fc82801e 100644
--- a/scripts/include/asm-generic/bug.h
+++ b/scripts/include/asm-generic/bug.h
@@ -3,7 +3,7 @@
 #ifndef _ASM_GENERIC_BUG_H
 #define _ASM_GENERIC_BUG_H
 
-#include <printk.h>
+#include <printf.h>
 #include <stdlib.h>
 
 #define BUG() do { \
diff --git a/test/self/idr.c b/test/self/idr.c
index 3d23141e0f03..bb902b041bb4 100644
--- a/test/self/idr.c
+++ b/test/self/idr.c
@@ -2,7 +2,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <printk.h>
+#include <printf.h>
 #include <linux/idr.h>
 #include <bselftest.h>
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] vsprintf: document %JP format specifier as being barebox-specific
  2025-01-06  9:19 [PATCH 1/2] include: rename printk.h to printf.h Ahmad Fatoum
@ 2025-01-06  9:19 ` Ahmad Fatoum
  2025-01-06 13:21 ` [PATCH 1/2] include: rename printk.h to printf.h Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-01-06  9:19 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

%JP was added before the documentation was adapted to differentiate
between format specifiers inherited from Linux and thus specific to
barebox. Move it to correctly indicate that this is a barebox extension.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 lib/vsprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index edc3f4aa4fe0..cb42caebca16 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -510,12 +510,12 @@ char *device_node_string(char *buf, const char *end, const struct device_node *n
  *              C colon
  *              D dash
  *              N no separator
- * - 'JP' For a JSON path
  * - 'M' For a 6-byte MAC address, it prints the address in the
  *       usual colon-separated hex notation
  *
  * Additionally, we support following barebox-specific format specifiers:
  *
+ * - 'JP' For a JSON path
  * - 'D' For EFI device paths
  */
 static char *pointer(const char *fmt, char *buf, const char *end, const void *ptr,
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] include: rename printk.h to printf.h
  2025-01-06  9:19 [PATCH 1/2] include: rename printk.h to printf.h Ahmad Fatoum
  2025-01-06  9:19 ` [PATCH 2/2] vsprintf: document %JP format specifier as being barebox-specific Ahmad Fatoum
@ 2025-01-06 13:21 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-01-06 13:21 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 06 Jan 2025 10:19:05 +0100, Ahmad Fatoum wrote:
> We also have <linux/printk.h>, which defines the pr_* and dev_* family
> of Linux logging functions. printk.h only defines the base printing
> functions as well as the printk macro, which expands to printf.
> 
> To make it clearer, which is which, rename printk.h to printf.h.
> 
> No functional change.
> 
> [...]

Applied, thanks!

[1/2] include: rename printk.h to printf.h
      https://git.pengutronix.de/cgit/barebox/commit/?id=8c51927982a4 (link may not be stable)
[2/2] vsprintf: document %JP format specifier as being barebox-specific
      https://git.pengutronix.de/cgit/barebox/commit/?id=9942fd79f1f9 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-06 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-06  9:19 [PATCH 1/2] include: rename printk.h to printf.h Ahmad Fatoum
2025-01-06  9:19 ` [PATCH 2/2] vsprintf: document %JP format specifier as being barebox-specific Ahmad Fatoum
2025-01-06 13:21 ` [PATCH 1/2] include: rename printk.h to printf.h Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox