Browse Source

qcacld-3.0: Add wrapper for nla_parse_nested()

The Linux kernel version 4.12 introduced an API change to
nla_parse_nested(). Add conditional compilation to call
nla_parse_nested with the correct parameters based on the
version of the linux kernel being compiled against.

Change-Id: I5214e9622d63ec928f5814f5840528f8c0d61422
CRs-Fixed: 2167853
Dustin Brown 7 years ago
parent
commit
24277bb93e
2 changed files with 18 additions and 1 deletions
  1. 17 0
      core/hdd/inc/wlan_hdd_main.h
  2. 1 1
      core/hdd/src/wlan_hdd_cfg80211.c

+ 17 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -2762,6 +2762,7 @@ static inline void hdd_update_hlp_info(struct net_device *dev,
 #endif
 
 #undef nla_parse
+#undef nla_parse_nested
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
 static inline void hdd_dev_setup_destructor(struct net_device *dev)
 {
@@ -2774,6 +2775,13 @@ hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
 {
 	return nla_parse(tb, maxtype, head, len, policy);
 }
+
+static inline int
+hdd_nla_parse_nested(struct nlattr *tb[], int maxtype, const struct nlattr *nla,
+		     const struct nla_policy *policy)
+{
+	return nla_parse_nested(tb, maxtype, nla, policy);
+}
 #else
 static inline void hdd_dev_setup_destructor(struct net_device *dev)
 {
@@ -2786,8 +2794,17 @@ hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
 {
 	return nla_parse(tb, maxtype, head, len, policy, NULL);
 }
+
+static inline int
+hdd_nla_parse_nested(struct nlattr *tb[], int maxtype, const struct nlattr *nla,
+		     const struct nla_policy *policy)
+{
+	return nla_parse_nested(tb, maxtype, nla, policy, NULL);
+}
 #endif /* KERNEL_VERSION(4, 12, 0) */
 #define nla_parse(...) (obsolete, use wlan_cfg80211_nla_parse or hdd_nla_parse)
+#define nla_parse_nested(...) \
+	(obsolete, use wlan_cfg80211_nla_parse_nested or hdd_nla_parse_nested)
 
 /**
  * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API

+ 1 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -12708,7 +12708,7 @@ static int __wlan_hdd_cfg80211_fetch_bss_transition_status(struct wiphy *wiphy,
 	nla_for_each_nested(attr,
 			    tb[QCA_WLAN_VENDOR_ATTR_BTM_CANDIDATE_INFO],
 			    rem) {
-		ret = nla_parse_nested(
+		ret = hdd_nla_parse_nested(
 				tb_msg,
 				QCA_WLAN_VENDOR_ATTR_BTM_CANDIDATE_INFO_MAX,
 				attr, btm_cand_list_policy);