Skip to content

Commit fbdf0c5

Browse files
Marek VasutKalle Valo
Marek Vasut
authored and
Kalle Valo
committed
wifi: wilc1000: Register wiphy after reading out chipid
Register wiphy after reading out chipid, so the chipid can be used to determine chip features and not advertise WPA3/SAE support to userspace on WILC3000. Note that wilc_netdev_cleanup() will deregister the wiphy in fail path. Tested-by: Alexis Lothoré <alexis.lothore@bootlin.com> Tested-on: WILC1000SD 07 SDIO WILC_WIFI_FW_REL_16_1_2 Tested-on: WILC3000 A SDIO WILC_WIFI_FW_REL_16_1_1 Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://patch.msgid.link/20241004114551.40236-6-marex@denx.de
1 parent 577c04f commit fbdf0c5

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

drivers/net/wireless/microchip/wilc1000/cfg80211.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,6 @@ static struct wilc *wilc_create_wiphy(struct device *dev)
17611761
{
17621762
struct wiphy *wiphy;
17631763
struct wilc *wl;
1764-
int ret;
17651764

17661765
wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(*wl));
17671766
if (!wiphy)
@@ -1804,14 +1803,8 @@ static struct wilc *wilc_create_wiphy(struct device *dev)
18041803
BIT(NL80211_IFTYPE_P2P_GO) |
18051804
BIT(NL80211_IFTYPE_P2P_CLIENT);
18061805
wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
1807-
wiphy->features |= NL80211_FEATURE_SAE;
18081806
set_wiphy_dev(wiphy, dev);
18091807
wl->wiphy = wiphy;
1810-
ret = wiphy_register(wiphy);
1811-
if (ret) {
1812-
wiphy_free(wiphy);
1813-
return NULL;
1814-
}
18151808
return wl;
18161809
}
18171810

@@ -1855,12 +1848,19 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
18551848

18561849
free_wl:
18571850
wlan_deinit_locks(wl);
1858-
wiphy_unregister(wl->wiphy);
18591851
wiphy_free(wl->wiphy);
18601852
return ret;
18611853
}
18621854
EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
18631855

1856+
int wilc_cfg80211_register(struct wilc *wilc)
1857+
{
1858+
wilc->wiphy->features |= NL80211_FEATURE_SAE;
1859+
1860+
return wiphy_register(wilc->wiphy);
1861+
}
1862+
EXPORT_SYMBOL_GPL(wilc_cfg80211_register);
1863+
18641864
int wilc_init_host_int(struct net_device *net)
18651865
{
18661866
int ret;

drivers/net/wireless/microchip/wilc1000/cfg80211.h

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
1212
const struct wilc_hif_func *ops);
13+
int wilc_cfg80211_register(struct wilc *wilc);
1314
void wilc_deinit_host_int(struct net_device *net);
1415
int wilc_init_host_int(struct net_device *net);
1516
void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size);

drivers/net/wireless/microchip/wilc1000/sdio.c

+4
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ static int wilc_sdio_probe(struct sdio_func *func,
186186
if (ret)
187187
goto dispose_irq;
188188

189+
ret = wilc_cfg80211_register(wilc);
190+
if (ret)
191+
goto dispose_irq;
192+
189193
ret = wilc_load_mac_from_nv(wilc);
190194
if (ret) {
191195
pr_err("Can not retrieve MAC address from chip\n");

drivers/net/wireless/microchip/wilc1000/spi.c

+4
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ static int wilc_bus_probe(struct spi_device *spi)
249249
if (ret)
250250
goto power_down;
251251

252+
ret = wilc_cfg80211_register(wilc);
253+
if (ret)
254+
goto power_down;
255+
252256
ret = wilc_load_mac_from_nv(wilc);
253257
if (ret) {
254258
pr_err("Can not retrieve MAC address from chip\n");

0 commit comments

Comments
 (0)