Skip to content

Commit 2fe5db9

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 <giulio.benetti@benettiengineering.com>
1 parent d0bd363 commit 2fe5db9

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
@@ -1000,7 +1000,11 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev,
10001000
return 0;
10011001
}
10021002

1003+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
1004+
static int set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed)
1005+
#else
10031006
static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
1007+
#endif
10041008
{
10051009
int ret = -EINVAL;
10061010
struct cfg_param_attr cfg_param_val;
@@ -2209,6 +2213,9 @@ static void wilc_set_wakeup(struct wiphy *wiphy, bool enabled)
22092213
}
22102214

22112215
static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2216+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
2217+
int radio_idx,
2218+
#endif
22122219
enum nl80211_tx_power_setting type, int mbm)
22132220
{
22142221
int ret;
@@ -2241,6 +2248,9 @@ static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
22412248
}
22422249

22432250
static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
2251+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
2252+
int radio_idx,
2253+
#endif
22442254
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
22452255
unsigned int link_id,
22462256
#endif
@@ -2263,7 +2273,12 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
22632273
return ret;
22642274
}
22652275

2276+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
2277+
static int set_antenna(struct wiphy *wiphy, int radio_idx, u32 tx_ant,
2278+
u32 rx_ant)
2279+
#else
22662280
static int set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant)
2281+
#endif
22672282
{
22682283
int ret;
22692284
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)