diff --git a/drivers/media/platform/tegra/cdi/cdi_gpio.c b/drivers/media/platform/tegra/cdi/cdi_gpio.c index 5cbce785..be48e37a 100644 --- a/drivers/media/platform/tegra/cdi/cdi_gpio.c +++ b/drivers/media/platform/tegra/cdi/cdi_gpio.c @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -42,7 +42,7 @@ static struct gpio_chip *cdi_gpio_get_chip(struct platform_device *pdev, struct cdi_gpio_plat_data *pd) { struct gpio_chip *gc = NULL; -#if !defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */ +#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */ struct gpio_device *gdev; #endif char name[MAX_STR_SIZE]; @@ -54,14 +54,14 @@ static struct gpio_chip *cdi_gpio_get_chip(struct platform_device *pdev, } strcpy(name, pd->gpio_prnt_chip); -#if defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */ - gc = gpiochip_find(name, cdi_gpio_chip_match); -#else +#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */ gdev = gpio_device_find(name, cdi_gpio_chip_match); if (gdev) { gc = gpio_device_get_chip(gdev); gpio_device_put(gdev); } +#else + gc = gpiochip_find(name, cdi_gpio_chip_match); #endif if (!gc) { dev_err(&pdev->dev, "%s: unable to find gpio parent chip %s\n", diff --git a/drivers/media/platform/tegra/isc/isc_gpio.c b/drivers/media/platform/tegra/isc/isc_gpio.c index 2fdbf45b..a4712274 100644 --- a/drivers/media/platform/tegra/isc/isc_gpio.c +++ b/drivers/media/platform/tegra/isc/isc_gpio.c @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -43,7 +43,7 @@ static struct gpio_chip *isc_gpio_get_chip(struct platform_device *pdev, { struct gpio_chip *gc = NULL; char name[MAX_STR_SIZE]; -#if !defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */ +#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */ struct gpio_device *gdev; #endif @@ -54,14 +54,14 @@ static struct gpio_chip *isc_gpio_get_chip(struct platform_device *pdev, } strcpy(name, pd->gpio_prnt_chip); -#if defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */ - gc = gpiochip_find(name, isc_gpio_chip_match); -#else +#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */ gdev = gpio_device_find(name, isc_gpio_chip_match); if (gdev) { gc = gpio_device_get_chip(gdev); gpio_device_put(gdev); } +#else + gc = gpiochip_find(name, isc_gpio_chip_match); #endif if (!gc) { dev_err(&pdev->dev, "%s: unable to find gpio parent chip %s\n", diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 295ddbf1..187086f2 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -136,7 +136,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_get_named_gpio_flags NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_chip_struct_has_of_node_present -NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpiochip_find +NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_find NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_base_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index e5b86815..9c29188f 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -5524,24 +5524,6 @@ compile_test() { compile_check_conftest "$CODE" "NV_GPIO_CHIP_STRUCT_HAS_OF_NODE_PRESENT" "" "types" ;; - gpiochip_find) - # - # Determine if function gpiochip_find() present or not. - # - # The function gpiochip_find() is removed from commit 2654521d774f9 - # ("gpiolib: remove gpiochip_find()" in Linux 6.7 - # - CODE=" - #include - void conftest_gpiochip_find_present(void) - { - gpiochip_find(); - } - " - - compile_check_conftest "$CODE" "NV_GPIOCHIP_FIND_PRESENT" "" "functions" - ;; - devm_gpio_request_one) # # Determine if devm_gpio_request_one() function is present @@ -7095,6 +7077,26 @@ compile_test() { compile_check_conftest "$CODE" "NV_GENDPD_XLATE_T_HAS_CONST_OF_PHANDLE_ARGS" "" "types" ;; + gpio_device_find) + # + # Determine if function gpio_device_find() present. + # + # The function gpio_device_find() was add by commit cfe102f63308 + # ("gpiolib: provide gpio_device_find()") in Linux v6.7 replacing + # the legacy and broken gpiochip_find(), which has since been + # removed. + # + CODE=" + #include + void conftest_gpio_device_find(void) + { + gpio_device_find(); + } + " + + compile_check_conftest "$CODE" "NV_GPIO_DEVICE_FIND_PRESENT" "" "functions" + ;; + netif_set_tso_max_size) # # Determine if netif_set_tso_max_size() function is present