blob: d23e49d6578d3136fe0a6e3b72be80aac8db1b93 [file] [log] [blame]
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -639,6 +639,23 @@ static const struct net_device_ops brcmf
.ndo_set_rx_mode = brcmf_netdev_set_multicast_list
};
+#undef netdev_set_priv_destructor
+#if LINUX_VERSION_IS_LESS(4,11,9)
+#define netdev_set_priv_destructor(_dev, _destructor) \
+ (_dev)->destructor = (_destructor)
+#else
+#define netdev_set_priv_destructor(_dev, _destructor) \
+ (_dev)->priv_destructor = (_destructor)
+#endif
+
+#if LINUX_VERSION_IS_LESS(4,12,0)
+static void __brcmf_cfg80211_free_netdev(struct net_device *ndev)
+{
+ brcmf_cfg80211_free_netdev(ndev);
+ free_netdev(ndev);
+}
+#endif
+
int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked)
{
struct brcmf_pub *drvr = ifp->drvr;
@@ -812,7 +829,11 @@ struct brcmf_if *brcmf_add_if(struct brc
if (!ndev)
return ERR_PTR(-ENOMEM);
+#if LINUX_VERSION_IS_LESS(4,12,0)
+ ndev->priv_destructor = __brcmf_cfg80211_free_netdev;
+#else
ndev->needs_free_netdev = true;
+#endif
ifp = netdev_priv(ndev);
ifp->ndev = ndev;
/* store mapping ifidx to bsscfgidx */