Cheers,
-Paul
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> ---
>
> drivers/pinctrl/pinctrl-ingenic.c | 20 ++++++++++----------
> include/linux/kconfig.h | 6 ------
> include/linux/kernel.h | 2 ++
> 3 files changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c
> b/drivers/pinctrl/pinctrl-ingenic.c
> index f2746125b077..b21e2ae4528d 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -2496,43 +2496,43 @@ static int __init
> ingenic_pinctrl_probe(struct platform_device *pdev)
> static const struct of_device_id ingenic_pinctrl_of_match[] = {
> {
> .compatible = "ingenic,jz4740-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_JZ4740,
&jz4740_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_JZ4740),
&jz4740_chip_info)
> },
> {
> .compatible = "ingenic,jz4725b-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_JZ4725B,
&jz4725b_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_JZ4725B),
&jz4725b_chip_info)
> },
> {
> .compatible = "ingenic,jz4760-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_JZ4760,
&jz4760_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_JZ4760),
&jz4760_chip_info)
> },
> {
> .compatible = "ingenic,jz4760b-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_JZ4760,
&jz4760_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_JZ4760),
&jz4760_chip_info)
> },
> {
> .compatible = "ingenic,jz4770-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_JZ4770,
&jz4770_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_JZ4770),
&jz4770_chip_info)
> },
> {
> .compatible = "ingenic,jz4780-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_JZ4780,
&jz4780_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_JZ4780),
&jz4780_chip_info)
> },
> {
> .compatible = "ingenic,x1000-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_X1000,
&x1000_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_X1000),
&x1000_chip_info)
> },
> {
> .compatible = "ingenic,x1000e-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_X1000,
&x1000_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_X1000),
&x1000_chip_info)
> },
> {
> .compatible = "ingenic,x1500-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_X1500,
&x1500_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_X1500),
&x1500_chip_info)
> },
> {
> .compatible = "ingenic,x1830-pinctrl",
> - .data = IF_ENABLED(CONFIG_MACH_X1830,
&x1830_chip_info)
> + .data = PTR_IF(IS_ENABLED(CONFIG_MACH_X1830),
&x1830_chip_info)
> },
> { /* sentinel */ },
> };
> diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
> index 24a59cb06963..cc8fa109cfa3 100644
> --- a/include/linux/kconfig.h
> +++ b/include/linux/kconfig.h
> @@ -70,10 +70,4 @@
> */
> #define IS_ENABLED(option) __or(IS_BUILTIN(option),
> IS_MODULE(option))
>
> -/*
> - * IF_ENABLED(CONFIG_FOO, ptr) evaluates to (ptr) if CONFIG_FOO
is
> set to 'y'
> - * or 'm', NULL otherwise.
> - */
> -#define IF_ENABLED(option, ptr) (IS_ENABLED(option) ? (ptr) :
NULL)
> -
> #endif /* __LINUX_KCONFIG_H */
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 5b7ed6dc99ac..8685ca4cf287 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -38,6 +38,8 @@
> #define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned
> long)(p), (a)))
> #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) -
1)) == 0)
>
> +#define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL)
> +
> /* generic data direction definitions */
> #define READ 0
> #define WRITE 1
> --
> 2.27.0
>