Patch "linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     linux-kconfig.h-replace-if_enabled-with-ptr_if-in-li.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6a7364ec871e567433a4402c29b2070598742226
Author: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Date:   Thu May 6 02:45:15 2021 +0900

    linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>
    
    [ Upstream commit 0ab1438bad43d95877f848b7df551bd431680270 ]
    
    <linux/kconfig.h> is included from all the kernel-space source files,
    including C, assembly, linker scripts. It is intended to contain a
    minimal set of macros to evaluate CONFIG options.
    
    IF_ENABLED() is an intruder here because (x ? y : z) is C code, which
    should not be included from assembly files or linker scripts.
    
    Also, <linux/kconfig.h> is no longer self-contained because NULL is
    defined in <linux/stddef.h>.
    
    Move IF_ENABLED() out to <linux/kernel.h> as PTR_IF(). PTF_IF()
    takes the general boolean expression instead of a CONFIG option
    so that it fits better in <linux/kernel.h>.
    
    Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Stable-dep-of: 18ab69c8ca56 ("Input: iqs269a - do not poll during suspend or resume")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index e0df5ad6741dc..4d07c531371cd 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -11,6 +11,7 @@
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/kernel.h>
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -2826,6 +2827,8 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#define IF_ENABLED(cfg, ptr)	PTR_IF(IS_ENABLED(cfg), (ptr))
+
 static const struct of_device_id ingenic_pinctrl_of_match[] = {
 	{ .compatible = "ingenic,jz4740-pinctrl", .data = &jz4740_chip_info },
 	{ .compatible = "ingenic,jz4725b-pinctrl", .data = &jz4725b_chip_info },
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 394f10fc29aad..66948e1bf4fa6 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -47,6 +47,8 @@
  */
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
 
+#define PTR_IF(cond, ptr)	((cond) ? (ptr) : NULL)
+
 #define u64_to_user_ptr(x) (		\
 {					\
 	typecheck(u64, (x));		\



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux