package/wilc-driver: fix build failure with Linux 6.17

Add a local patch pending upstream to fix build failure with Linux 6.17

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Giulio Benetti
2025-10-10 22:31:36 +02:00
committed by Julien Olivain
parent 3951339cd9
commit 9a3360fdb3

View File

@@ -0,0 +1,109 @@
From 00895566e07808a0c61d45464797d7cba2eb256c Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Fri, 10 Oct 2025 21:58:14 +0200
Subject: [PATCH] Fix build for kernel 6.17
* With commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b74947b4f6ff7c122a1bb6eb38bb7ecfbb1d3820
set_wiphy_params(), set/get_tx_power() and set_antenna() gain argument
radio_idx to get radio index. So let's add that argument according to
linux version >= 6.17.
* With commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5589313383074c48a1b3751d592a6e084ae0573
devm_gpio_request() is dropped in favor of devm_gpio_request_one().
devm_gpio_request_one() requires flags to setup gpio status, but it's
not specified in wilc_of_parse_power_pins() so keep them as GPIOF_IN
since they get defined in wilc_wlan_power() called very soon after
wilc_of_parse_power_pins().
Upstream: https://github.com/embeddedTS/wilc3000-external-module/pull/11
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
cfg80211.c | 15 +++++++++++++++
power.c | 12 +++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/cfg80211.c b/cfg80211.c
index 0e1375c..a7db9e6 100644
--- a/cfg80211.c
+++ b/cfg80211.c
@@ -997,7 +997,11 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
return 0;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+static int set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed)
+#else
static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
+#endif
{
int ret = -EINVAL;
struct cfg_param_attr cfg_param_val;
@@ -2198,6 +2202,9 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
}
static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+ int radio_idx,
+#endif
enum nl80211_tx_power_setting type, int mbm)
{
int ret;
@@ -2230,6 +2237,9 @@ static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
}
static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+ int radio_idx,
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
unsigned int link_id,
#endif
@@ -2252,7 +2262,12 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
return ret;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+static int set_antenna(struct wiphy *wiphy, int radio_idx, u32 tx_ant,
+ u32 rx_ant)
+#else
static int set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
+#endif
{
int ret;
struct wilc *wl = wiphy_priv(wiphy);
diff --git a/power.c b/power.c
index 6ab8d63..1cc391d 100644
--- a/power.c
+++ b/power.c
@@ -1,4 +1,4 @@
-#include <linux/delay.h>
+#include <linux/delay.h>OA
#include <linux/of.h>
#include <linux/version.h>
#include <linux/of_gpio.h>
@@ -37,11 +37,21 @@ int wilc_of_parse_power_pins(struct wilc *wilc)
!gpio_is_valid(power->gpios.reset))
return -EINVAL;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+ ret = devm_gpio_request_one(wilc->dev, power->gpios.chip_en, GPIOF_IN,
+ "CHIP_EN");
+#else
ret = devm_gpio_request(wilc->dev, power->gpios.chip_en, "CHIP_EN");
+#endif
if (ret)
return ret;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
+ ret = devm_gpio_request_one(wilc->dev, power->gpios.reset, GPIOF_IN,
+ "RESET");
+#else
ret = devm_gpio_request(wilc->dev, power->gpios.reset, "RESET");
+#endif
return ret;
}
--
2.47.3