From 268500240a551436c5003f5843ff4d090bf3e202 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Thu, 18 May 2017 12:52:55 +0100
Subject: [PATCH] Fix build with kernel 4.12-rc1

---
 x86-64/src/wl/sys/wl_cfg80211_hybrid.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c
index 7b606e0..cedf95c 100644
--- a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c
@@ -49,8 +49,13 @@ u32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO;
 u32 wl_dbg_level = WL_DBG_ERR;
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+           enum nl80211_iftype type, struct vif_params *params);
+#else
 static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
            enum nl80211_iftype type, u32 *flags, struct vif_params *params);
+#endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
 static s32
 wl_cfg80211_scan(struct wiphy *wiphy,
@@ -461,10 +466,16 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
 	return err;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+static s32
+wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
+                         enum nl80211_iftype type, struct vif_params *params)
+#else
 static s32
 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
                          enum nl80211_iftype type, u32 *flags,
    struct vif_params *params)
+#endif
 {
 	struct wl_cfg80211_priv *wl = wiphy_to_wl(wiphy);
 	struct wireless_dev *wdev;
@@ -2364,6 +2375,19 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
 	memcpy(wl->profile->bssid, &e->addr, ETHER_ADDR_LEN);
 	memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
 	wl_update_bss_info(wl);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+	{
+		struct cfg80211_roam_info roam_info = {
+			.channel = &wl->conf->channel,
+			.bssid = (u8 *)&wl->bssid,
+			.req_ie = conn_info->req_ie,
+			.req_ie_len = conn_info->req_ie_len,
+			.resp_ie = conn_info->resp_ie,
+			.resp_ie_len = conn_info->resp_ie_len,
+		};
+		cfg80211_roamed(ndev, &roam_info, GFP_KERNEL);
+	}
+#else
 	cfg80211_roamed(ndev,
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
 			&wl->conf->channel,	 
@@ -2371,6 +2395,7 @@ wl_bss_roaming_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
 			(u8 *)&wl->bssid,
 			conn_info->req_ie, conn_info->req_ie_len,
 			conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
+#endif
 	WL_DBG(("Report roaming result\n"));
 
 	set_bit(WL_STATUS_CONNECTED, &wl->status);
-- 
2.7.4

