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

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Maxim MAX77851 GPIO driver
*/
@@ -199,8 +199,11 @@ static int max77851_gpio_set_debounce(struct max77851_gpio *mgpio,
return ret;
}
static void max77851_gpio_set(struct gpio_chip *gc, unsigned int offset,
int value)
#if defined(NV_GPIO_CHIP_STRUCT_SET_RETURNS_INT) /* Linux v6.17 */
static int max77851_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
#else
static void max77851_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
#endif
{
struct max77851_gpio *mgpio = gpiochip_get_data(gc);
u8 val;
@@ -212,6 +215,10 @@ static void max77851_gpio_set(struct gpio_chip *gc, unsigned int offset,
GPIO_CFG1_OUTPUT, val);
if (ret < 0)
dev_err(mgpio->dev, "CNFG_GPIO_OUT update failed: %d\n", ret);
#if defined(NV_GPIO_CHIP_STRUCT_SET_RETURNS_INT) /* Linux v6.17 */
return ret;
#endif
}
static int max77851_gpio_set_config(struct gpio_chip *gc, unsigned int offset,