From 24277bb93e932ecb8cc7675486d045965d46a429 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Fri, 5 Jan 2018 13:33:04 -0800 Subject: [PATCH] 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 --- core/hdd/inc/wlan_hdd_main.h | 17 +++++++++++++++++ core/hdd/src/wlan_hdd_cfg80211.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 177d62cc31bc..af22d404863d 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/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 diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 0d11520e395d..c9c4bc0f94d0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/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);