Skip to content

Commit 053a93d

Browse files
holtmanndavem330
authored andcommitted
cfg80211: assign device type in netdev notifier callback
Instead of having to modify every non-mac80211 for device type assignment, do this inside the netdev notifier callback of cfg80211. So all drivers that integrate with cfg80211 will export a proper device type. Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7ffbe3f commit 053a93d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

net/mac80211/iface.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,10 +754,6 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
754754
return 0;
755755
}
756756

757-
static struct device_type wiphy_type = {
758-
.name = "wlan",
759-
};
760-
761757
int ieee80211_if_add(struct ieee80211_local *local, const char *name,
762758
struct net_device **new_dev, enum nl80211_iftype type,
763759
struct vif_params *params)
@@ -789,7 +785,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
789785

790786
memcpy(ndev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
791787
SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
792-
SET_NETDEV_DEVTYPE(ndev, &wiphy_type);
793788

794789
/* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */
795790
sdata = netdev_priv(ndev);

net/wireless/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,10 @@ static void wdev_cleanup_work(struct work_struct *work)
625625
dev_put(wdev->netdev);
626626
}
627627

628+
static struct device_type wiphy_type = {
629+
.name = "wlan",
630+
};
631+
628632
static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
629633
unsigned long state,
630634
void *ndev)
@@ -641,6 +645,9 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
641645
WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED);
642646

643647
switch (state) {
648+
case NETDEV_POST_INIT:
649+
SET_NETDEV_DEVTYPE(dev, &wiphy_type);
650+
break;
644651
case NETDEV_REGISTER:
645652
/*
646653
* NB: cannot take rdev->mtx here because this may be

0 commit comments

Comments
 (0)