From de3edcbb9e809472397607d403789315fa5996d7 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Fri, 5 Jan 2018 13:56:10 -0800 Subject: [PATCH] qcacmn: 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: I878a29b352c998a751a979f66a9c3c4c7ecfd442 CRs-Fixed: 2167861 --- os_if/linux/wlan_cfg80211.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/os_if/linux/wlan_cfg80211.h b/os_if/linux/wlan_cfg80211.h index 0082a93de2b5..241fb0e4f06c 100644 --- a/os_if/linux/wlan_cfg80211.h +++ b/os_if/linux/wlan_cfg80211.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -65,6 +65,7 @@ }, #undef nla_parse +#undef nla_parse_nested #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, int maxtype, @@ -74,6 +75,15 @@ static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, { return nla_parse(tb, maxtype, head, len, policy); } + +static inline int +wlan_cfg80211_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 int wlan_cfg80211_nla_parse(struct nlattr **tb, int maxtype, @@ -83,8 +93,18 @@ static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, { return nla_parse(tb, maxtype, head, len, policy, NULL); } + +static inline int +wlan_cfg80211_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 -#define nla_parse(...) (obsolete, use wlan_cfg80211_nla_parse or hdd_nla_parse) +#define nla_parse(...) (obsolete, use wlan_cfg80211_nla_parse) +#define nla_parse_nested(...) (obsolete, use wlan_cfg80211_nla_parse_nested) #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) static inline int