Skip to content

Commit 8ea401b

Browse files
committed
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(). Signed-off-by: Giulio Benetti <[email protected]>
1 parent 34ada16 commit 8ea401b

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

cfg80211.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,11 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
997997
return 0;
998998
}
999999

1000+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
1001+
static int set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed)
1002+
#else
10001003
static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
1004+
#endif
10011005
{
10021006
int ret = -EINVAL;
10031007
struct cfg_param_attr cfg_param_val;
@@ -2198,6 +2202,9 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
21982202
}
21992203

22002204
static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2205+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
2206+
int radio_idx,
2207+
#endif
22012208
enum nl80211_tx_power_setting type, int mbm)
22022209
{
22032210
int ret;
@@ -2230,6 +2237,9 @@ static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
22302237
}
22312238

22322239
static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2240+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
2241+
int radio_idx,
2242+
#endif
22332243
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
22342244
unsigned int link_id,
22352245
#endif
@@ -2252,7 +2262,12 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
22522262
return ret;
22532263
}
22542264

2265+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
2266+
static int set_antenna(struct wiphy *wiphy, int radio_idx, u32 tx_ant,
2267+
u32 rx_ant)
2268+
#else
22552269
static int set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
2270+
#endif
22562271
{
22572272
int ret;
22582273
struct wilc *wl = wiphy_priv(wiphy);

power.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <linux/delay.h>
1+
#include <linux/delay.h>OA
22
#include <linux/of.h>
33
#include <linux/version.h>
44
#include <linux/of_gpio.h>
@@ -37,11 +37,21 @@ int wilc_of_parse_power_pins(struct wilc *wilc)
3737
!gpio_is_valid(power->gpios.reset))
3838
return -EINVAL;
3939

40+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
41+
ret = devm_gpio_request_one(wilc->dev, power->gpios.chip_en, GPIOF_IN,
42+
"CHIP_EN");
43+
#else
4044
ret = devm_gpio_request(wilc->dev, power->gpios.chip_en, "CHIP_EN");
45+
#endif
4146
if (ret)
4247
return ret;
4348

49+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
50+
ret = devm_gpio_request_one(wilc->dev, power->gpios.reset, GPIOF_IN,
51+
"RESET");
52+
#else
4453
ret = devm_gpio_request(wilc->dev, power->gpios.reset, "RESET");
54+
#endif
4555
return ret;
4656
}
4757

0 commit comments

Comments
 (0)