On Monday, 16 May 2022 23:56:38 CEST Jakub Kicinski wrote: > diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c > index 83fb51b6e299..15d2bb4cd301 100644 > --- a/net/batman-adv/hard-interface.c > +++ b/net/batman-adv/hard-interface.c > @@ -307,9 +307,11 @@ static bool batadv_is_cfg80211_netdev(struct net_device *net_device) > if (!net_device) > return false; > > +#if IS_ENABLED(CONFIG_WIRELESS) > /* cfg80211 drivers have to set ieee80211_ptr */ > if (net_device->ieee80211_ptr) > return true; > +#endif > > return false; > } Acked-by: Sven Eckelmann <sven@xxxxxxxxxxxxx> On Tuesday, 17 May 2022 09:48:24 CEST Johannes Berg wrote: > Something like the patch below might do that, but I haven't carefully > checked it yet, nor checked if there are any paths in mac80211/drivers > that might be doing this check - and it looks from Jakub's patch that > batman code would like to check this too. Yes, if something like netdev_is_wireless would be available then we could change it to: diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 35fadb924849..50a53e3364bf 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -294,26 +294,6 @@ static bool batadv_is_wext_netdev(struct net_device *net_device) return false; } -/** - * batadv_is_cfg80211_netdev() - check if the given net_device struct is a - * cfg80211 wifi interface - * @net_device: the device to check - * - * Return: true if the net device is a cfg80211 wireless device, false - * otherwise. - */ -static bool batadv_is_cfg80211_netdev(struct net_device *net_device) -{ - if (!net_device) - return false; - - /* cfg80211 drivers have to set ieee80211_ptr */ - if (net_device->ieee80211_ptr) - return true; - - return false; -} - /** * batadv_wifi_flags_evaluate() - calculate wifi flags for net_device * @net_device: the device to check @@ -328,7 +308,7 @@ static u32 batadv_wifi_flags_evaluate(struct net_device *net_device) if (batadv_is_wext_netdev(net_device)) wifi_flags |= BATADV_HARDIF_WIFI_WEXT_DIRECT; - if (batadv_is_cfg80211_netdev(net_device)) + if (netdev_is_wireless(net_device)) wifi_flags |= BATADV_HARDIF_WIFI_CFG80211_DIRECT; real_netdev = batadv_get_real_netdevice(net_device); @@ -341,7 +321,7 @@ static u32 batadv_wifi_flags_evaluate(struct net_device *net_device) if (batadv_is_wext_netdev(real_netdev)) wifi_flags |= BATADV_HARDIF_WIFI_WEXT_INDIRECT; - if (batadv_is_cfg80211_netdev(real_netdev)) + if (netdev_is_wireless(real_netdev)) wifi_flags |= BATADV_HARDIF_WIFI_CFG80211_INDIRECT; out:
Attachment:
signature.asc
Description: This is a digitally signed message part.