From 49988960d1a2601bbea5f49812ed0a1f51dc3429 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Mon, 18 Dec 2023 10:44:53 +0000 Subject: [PATCH] gpio: Use conftest to find if struct gpio_chip has of_node Use conftest to determine if struct gpio_chip has the of_node member or not. The of_node from struct gpio_chip is removed from commit 70d0fc4288da ("gpiolib: Get rid of not used of_node member") in Linux 6.2 Bug 4425688 Change-Id: Ie69000a1677b9af3ccfdf6c43140a75dad33d8cc Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037037 Reviewed-by: Shardar Mohammed Reviewed-by: Bitan Biswas GVS: Gerrit_Virtual_Submit --- drivers/gpio/gpio-max77851.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-max77851.c b/drivers/gpio/gpio-max77851.c index aa584433..60f7b453 100644 --- a/drivers/gpio/gpio-max77851.c +++ b/drivers/gpio/gpio-max77851.c @@ -4,13 +4,14 @@ * Maxim MAX77851 GPIO driver */ +#include + #include #include #include #include #include #include -#include #define GPIO_CNFG_OFFSET (5) #define GPIO_CNFG0_REG_ADDR(offset) (GPIO0_CFG0_REG + (offset * GPIO_CNFG_OFFSET)) @@ -277,7 +278,7 @@ static int max77851_gpio_probe(struct platform_device *pdev) mgpio->gpio_chip.can_sleep = 1; mgpio->gpio_chip.base = -1; #ifdef CONFIG_OF_GPIO -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) +#if defined(NV_GPIO_CHIP_STRUCT_HAS_OF_NODE_PRESENT) /* Linux 6.2 */ mgpio->gpio_chip.of_node = pdev->dev.parent->of_node; #endif #endif