From 24e68a854f50e2de5b7ead18bd4d28d22566c005 Mon Sep 17 00:00:00 2001 From: ElXreno Date: Tue, 11 Aug 2026 14:57:52 +0300 Subject: [PATCH] nvidia: fix of_gpio compat shim build with CONFIG_OF_GPIO The compat of_get_named_gpio() added for kernels that no longer ship linux/of_gpio.h (removed by commit 51aaf65bbd21, "gpio: of: Remove ", v7.1-rc1) declares its __to_hwgpio() helper as taking a const struct gpio_device *. gpio_device_get_chip() has taken a mutable struct gpio_device * ever since it was introduced by commit 9b418780844c ("gpiolib: reluctantly provide gpio_device_get_chip()"), so the call inside the CONFIG_OF_GPIO block discards the qualifier: common/inc/nv-linux.h:1737:51: error: passing 'const struct gpio_device *' to parameter of type 'struct gpio_device *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] That block is only reachable on kernels >= 7.1 built with CONFIG_OF_GPIO, which is why the desktop x86 configurations do not hit it. The const buys nothing: the only caller, the compat of_get_named_gpio() right below, holds a mutable gdev from gpio_device_find_by_fwnode(). Drop it rather than casting it away. --- kernel-open/common/inc/nv-linux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel-open/common/inc/nv-linux.h b/kernel-open/common/inc/nv-linux.h index 7733e808d2..29e57ebf48 100644 --- a/kernel-open/common/inc/nv-linux.h +++ b/kernel-open/common/inc/nv-linux.h @@ -1724,7 +1724,7 @@ typedef enum #else #include -static inline int __to_hwgpio(const struct gpio_device *gdev, +static inline int __to_hwgpio(struct gpio_device *gdev, const struct of_phandle_args *gpiospec) { #if defined(CONFIG_OF_GPIO)