[PATCH v2 04/16] treewide: replace inverted check for PBL with new IN_PROPER macro

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Nov 25 07:12:16 PST 2024


Guarding code behind an #if IN_PROPER is easier to read than #ifndef __PBL__,
so let's use it where appropriate.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/mach-imx/romapi.c         | 2 +-
 arch/arm/mach-omap/omap3_generic.c | 2 +-
 arch/riscv/include/asm/unwind.h    | 2 +-
 drivers/pinctrl/imx-iomux-v1.c     | 2 +-
 fs/fat/ff.h                        | 2 +-
 include/abort.h                    | 2 +-
 include/dma.h                      | 2 +-
 include/linux/iopoll.h             | 4 ++--
 include/linux/kasan.h              | 2 +-
 include/linux/list.h               | 2 +-
 include/linux/printk.h             | 4 ++--
 include/printk.h                   | 4 ++--
 include/stdio.h                    | 4 ++--
 include/zero_page.h                | 2 +-
 lib/vsprintf.c                     | 4 ++--
 15 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-imx/romapi.c b/arch/arm/mach-imx/romapi.c
index 155e706437f7..10af42f28a76 100644
--- a/arch/arm/mach-imx/romapi.c
+++ b/arch/arm/mach-imx/romapi.c
@@ -256,7 +256,7 @@ const u32 *imx8m_get_bootrom_log(void)
 		return (u32 *)rom_log_addr;
 	}
 
-	if (!IN_PBL)
+	if (IN_PROPER)
 		return imx8m_scratch_get_bootrom_log();
 
 	return NULL;
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 8230b37619dc..d1b57dffd0cf 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -553,7 +553,7 @@ const struct gpmc_config omap3_nand_cfg = {
 	.size = GPMC_SIZE_16M,
 };
 
-#ifndef __PBL__
+#if IN_PROPER
 static int omap3_gpio_init(void)
 {
 	add_generic_device("omap-gpio", 0, NULL, OMAP3_GPIO1_BASE,
diff --git a/arch/riscv/include/asm/unwind.h b/arch/riscv/include/asm/unwind.h
index 00f7845147b1..4e8beb988070 100644
--- a/arch/riscv/include/asm/unwind.h
+++ b/arch/riscv/include/asm/unwind.h
@@ -4,7 +4,7 @@
 
 struct pt_regs;
 
-#if defined CONFIG_RISCV_UNWIND && !defined __PBL__
+#if defined CONFIG_RISCV_UNWIND && IN_PROPER
 void unwind_backtrace(const struct pt_regs *regs);
 #else
 static inline void unwind_backtrace(const struct pt_regs *regs)
diff --git a/drivers/pinctrl/imx-iomux-v1.c b/drivers/pinctrl/imx-iomux-v1.c
index a0878fa9eb85..ac98f4dcb763 100644
--- a/drivers/pinctrl/imx-iomux-v1.c
+++ b/drivers/pinctrl/imx-iomux-v1.c
@@ -115,7 +115,7 @@ void imx_gpio_mode(void __iomem *base, int gpio_mode)
 	}
 }
 
-#ifndef __PBL__
+#if IN_PROPER
 
 /*
  * MUX_ID format defines
diff --git a/fs/fat/ff.h b/fs/fat/ff.h
index c961de46e1f4..e1a7d029efe8 100644
--- a/fs/fat/ff.h
+++ b/fs/fat/ff.h
@@ -17,7 +17,7 @@
 #ifndef _FATFS
 #define _FATFS	8237	/* Revision ID */
 
-#ifndef __PBL__
+#if IN_PROPER
 
 #ifdef CONFIG_FS_FAT_LFN
 #define FS_FAT_LFN 1
diff --git a/include/abort.h b/include/abort.h
index 039500b04d0b..95db1b54d6d9 100644
--- a/include/abort.h
+++ b/include/abort.h
@@ -2,7 +2,7 @@
 #ifndef __ABORT_H
 #define __ABORT_H
 
-#if defined CONFIG_ARCH_HAS_DATA_ABORT_MASK && !defined __PBL__
+#if defined CONFIG_ARCH_HAS_DATA_ABORT_MASK && IN_PROPER
 
 /*
  * data_abort_mask - ignore data aborts
diff --git a/include/dma.h b/include/dma.h
index 5a82637e24ac..53cb50b707f4 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -90,7 +90,7 @@ void arch_sync_dma_for_device(void *vaddr, size_t size,
 			      enum dma_data_direction dir);
 #endif
 
-#ifndef __PBL__
+#if IN_PROPER
 void dma_sync_single_for_cpu(struct device *dev, dma_addr_t address,
 			     size_t size, enum dma_data_direction dir);
 
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index c7dcaec38237..9350a3d05007 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -32,13 +32,13 @@
 #define read_poll_timeout(op, val, cond, timeout_us, args...)	\
 ({ \
 	uint64_t start = 0; \
-	if (!IN_PBL && (timeout_us) != 0) \
+	if (IN_PROPER && (timeout_us) != 0) \
 		start = get_time_ns(); \
 	for (;;) { \
 		(val) = op(args); \
 		if (cond) \
 			break; \
-		if (!IN_PBL && (timeout_us) != 0 && \
+		if (IN_PROPER && (timeout_us) != 0 && \
 		    is_timeout(start, ((timeout_us) * USECOND))) { \
 			(val) = op(args); \
 			break; \
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 2dea347c40ae..8afdab7c9d4b 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -45,7 +45,7 @@
 extern unsigned long kasan_shadow_start;
 extern unsigned long kasan_shadow_base;
 
-#if defined(CONFIG_KASAN) && !defined(__PBL__)
+#if defined(CONFIG_KASAN) && IN_PROPER
 
 static inline void *kasan_mem_to_shadow(const void *addr)
 {
diff --git a/include/linux/list.h b/include/linux/list.h
index e28f54a0d413..35b3f573806a 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -36,7 +36,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
 	list->prev = list;
 }
 
-#if defined(CONFIG_DEBUG_LIST) && !defined(__PBL__)
+#if defined(CONFIG_DEBUG_LIST) && IN_PROPER
 extern bool __list_add_valid_or_report(struct list_head *new,
 				       struct list_head *prev,
 				       struct list_head *next);
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 07403ea60cb7..9fdf97507483 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -39,8 +39,8 @@ static inline int dev_printf(int level, const struct device *dev,
 }
 #endif
 
-#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
-	(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
+#if (IN_PROPER && !defined(CONFIG_CONSOLE_NONE)) || \
+	(IN_PBL && defined(CONFIG_PBL_CONSOLE))
 int pr_print(int level, const char *format, ...)
 	__attribute__ ((format(__printf__, 2, 3)));
 #else
diff --git a/include/printk.h b/include/printk.h
index bf9645249dae..d0e56e1994a2 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -16,8 +16,8 @@ struct device;
 #define KERN_DEBUG      ""   /* debug-level messages                 */
 #define KERN_CONT       ""
 
-#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
-	(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
+#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)));
diff --git a/include/stdio.h b/include/stdio.h
index 1ed7e1d3e38b..4edadf5c16be 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -82,8 +82,8 @@ static inline void ctrlc_handled(void)
 char *size_human_readable(unsigned long long size);
 int readline(const char *prompt, char *buf, int len);
 
-#if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
-	(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
+#if (IN_PROPER && !defined(CONFIG_CONSOLE_NONE)) || \
+	(IN_PBL && defined(CONFIG_PBL_CONSOLE))
 static inline int puts(const char *s)
 {
 	return console_puts(CONSOLE_STDOUT, s);
diff --git a/include/zero_page.h b/include/zero_page.h
index 79e0f22c7b5b..067f39a7ee96 100644
--- a/include/zero_page.h
+++ b/include/zero_page.h
@@ -4,7 +4,7 @@
 
 #include <common.h>
 
-#if defined CONFIG_ARCH_HAS_ZERO_PAGE && defined CONFIG_MMU && !defined __PBL__
+#if defined CONFIG_ARCH_HAS_ZERO_PAGE && defined CONFIG_MMU && IN_PROPER
 
 /*
  * zero_page_faulting - fault when accessing the zero page
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 1b7d568e8f0c..e421a4352a12 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -251,7 +251,7 @@ static char *raw_pointer(char *buf, const char *end, const void *ptr, int field_
 	return number(buf, end, (unsigned long) ptr, 16, field_width, precision, flags);
 }
 
-#ifndef __PBL__
+#if IN_PROPER
 static char *symbol_string(char *buf, const char *end, const void *ptr, int field_width,
 			   int precision, int flags)
 {
@@ -727,7 +727,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
 				continue;
 
 			case 's':
-				if (IS_ENABLED(CONFIG_PRINTF_WCHAR) && !IN_PBL && qualifier == 'l')
+				if (IS_ENABLED(CONFIG_PRINTF_WCHAR) && IN_PROPER && qualifier == 'l')
 					str = wstring(str, end, va_arg(args, wchar_t *),
 						      field_width, precision, flags);
 				else
-- 
2.39.5




More information about the barebox mailing list