From: Arend van Spriel Date: Sun, 25 Nov 2012 18:13:28 +0000 (+0100) Subject: cfg80211: change function signature of cfg80211_get_p2p_attr() X-Git-Tag: v3.8-rc1~139^2~17^2^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c216e6417f473ab4666f539844652bf2f4129777;p=profile%2Fivi%2Fkernel-x86-ivi.git cfg80211: change function signature of cfg80211_get_p2p_attr() The function cfg80211_get_p2p_attr() can fail and returns a negative error code. However, the return type is unsigned int. The largest positive number is determined by desired_len variable in the function, which is u16. So changing the return type to int to allow easy error checking. Also change the type for the attribute to enum for improved type checking. Signed-off-by: Arend van Spriel [fix indentation, don't use u8 attr variable] Signed-off-by: Johannes Berg --- diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8a1aec5..c2c185f 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -3652,8 +3652,9 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev); * the data is malformed or the attribute can't be found (respectively), * or the length of the found attribute (which can be zero). */ -unsigned int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, - u8 attr, u8 *buf, unsigned int bufsize); +int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, + enum ieee80211_p2p_attr_id attr, + u8 *buf, unsigned int bufsize); /* Logging, debugging and troubleshooting/diagnostic helpers. */ diff --git a/net/wireless/util.c b/net/wireless/util.c index b99f01c..db61fe8 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -980,8 +980,9 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate) } EXPORT_SYMBOL(cfg80211_calculate_bitrate); -unsigned int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, - u8 attr, u8 *buf, unsigned int bufsize) +int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, + enum ieee80211_p2p_attr_id attr, + u8 *buf, unsigned int bufsize) { u8 *out = buf; u16 attr_remaining = 0;