/* Scan ie for p2p ie and look for attribute 6 channel. If available determine channel and return it.  */
static s32 brcmf_p2p_find_listen_channel(const u8 *ie, u32 ie_len)
/* Scan ie for p2p ie and look for attribute 6 channel. If available determine channel and return it.  */
static s32 brcmf_p2p_find_listen_channel(const u8 *ie, u32 ie_len)
{
	u8 channel_ie[5];
	s32 listen_channel;
	s32 err;
	err = cfg80211_get_p2p_attr(ie, ie_len,
				    IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
				    channel_ie, sizeof(channel_ie));
	if (err < 0)
		return err;
	listen_channel = (s32)channel_ie[3 + 1];
	if (listen_channel == SOCIAL_CHAN_1 ||
	    listen_channel == SOCIAL_CHAN_2 ||
	    listen_channel == SOCIAL_CHAN_3) {
		brcmf_dbg(INFO, "Found my Listen Channel %d\n", listen_channel);
		return listen_channel;
	}
	return -EPERM;
}