drivers: Fix gpio_chip '.set' callback for v6.17

In Linux v6.17, the gpio_chip structure's '.set' callback function was
updated to return an integer. Add a test to conftest to detect this and
update the necessary drivers accordingly.

Bug 5483854

Change-Id: Ie48a50775885a06c8aa23ddb72fdbc73361ab92b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3440815
(cherry picked from commit 5dc88266853f0c5fbc7dd925187f63c2b6560a4b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461855
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
Jon Hunter
2025-08-27 13:13:24 +01:00
committed by mobile promotions
parent c2fd2c3c66
commit 2800fd5f4b
5 changed files with 63 additions and 5 deletions

View File

@@ -184,6 +184,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
NV_CONFTEST_FUNCTION_COMPILE_TESTS += no_llseek
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 += gpio_chip_struct_set_returns_int
NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_find
NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_device_get_chip
NV_CONFTEST_FUNCTION_COMPILE_TESTS += of_property_for_each_u32_removed_internal_args

View File

@@ -7744,6 +7744,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_GENDPD_XLATE_T_HAS_CONST_OF_PHANDLE_ARGS" "" "types"
;;
gpio_chip_struct_set_returns_int)
#
# Determine if the 'gpio_chip' structure's 'set' callback function
# return an integer value.
#
# Commit d9d87d90cc0b ("treewide: rename GPIO set callbacks back to
# their original names") made this change in Linux v6.17.
#
CODE="
#include <linux/gpio/driver.h>
#include <uapi/linux/ethtool.h>
void conftest_gpio_chip_struct_set_returns_int(struct gpio_chip *gc) {
int (*fn)(struct gpio_chip *, unsigned int offset, int value) = gc->set;
}"
compile_check_conftest "$CODE" "NV_GPIO_CHIP_STRUCT_SET_RETURNS_INT" "" "types"
;;
gpio_device_find)
#
# Determine if function gpio_device_find() present and if it is