BRCM P2P update

- IFNAME for monitor interface is changed to m. from mon. This will
  give extra space for incrementing X in IFNAME (p2p-wlan0-X). Also, we
  have synced the reset of IFNAME w.r.t. monitor interface name.
- Fixed continuous P2P_DEV_FOUND events coming from GO. Removed the
  BRCM specific change for this.
- Fixed STATUS command for p2p interface.

Change-Id: I04210dd0b2bdba06b0192c0a61edfa0e5b47ab72
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 26e355e..2765aef 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -700,8 +700,11 @@
 	wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
 }
 
-
+#ifdef ANDROID_BRCM_P2P_PATCH
+int wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
+#else
 void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
+#endif /* ANDROID_BRCM_P2P_PATCH */
 			    struct wpa_bss *selected,
 			    struct wpa_ssid *ssid)
 {
@@ -709,14 +712,23 @@
 		wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_OVERLAP
 			"PBC session overlap");
 #ifdef CONFIG_P2P
-		if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1)
+		if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1) {
+#ifdef ANDROID_BRCM_P2P_PATCH
+			return -1;
+#else
 			return;
+#endif
+		}
 #endif /* CONFIG_P2P */
 
 #ifdef CONFIG_WPS
 		wpas_wps_cancel(wpa_s);
 #endif /* CONFIG_WPS */
+#ifdef ANDROID_BRCM_P2P_PATCH
+		return -1;
+#else
 		return;
+#endif /* ANDROID_BRCM_P2P_PATCH */
 	}
 
 	/*
@@ -737,7 +749,11 @@
 	      0))) {
 		if (wpa_supplicant_scard_init(wpa_s, ssid)) {
 			wpa_supplicant_req_new_scan(wpa_s, 10, 0);
+#ifdef ANDROID_BRCM_P2P_PATCH
+			return 0;
+#else
 			return;
+#endif
 		}
 		wpa_msg(wpa_s, MSG_DEBUG, "Request association: "
 			"reassociate: %d  selected: "MACSTR "  bssid: " MACSTR
@@ -750,6 +766,9 @@
 		wpa_dbg(wpa_s, MSG_DEBUG, "Already associated with the "
 			"selected AP");
 	}
+#ifdef ANDROID_BRCM_P2P_PATCH
+	return 0;
+#endif
 }
 
 
@@ -975,7 +994,14 @@
 		wpa_scan_results_free(scan_res);
 		if (skip)
 			return 0;
+#ifdef ANDROID_BRCM_P2P_PATCH
+		if (wpa_supplicant_connect(wpa_s, selected, ssid) < 0) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "Connect Failed");
+			return -1;
+		}
+#else
 		wpa_supplicant_connect(wpa_s, selected, ssid);
+#endif
 		wpa_supplicant_rsn_preauth_scan_results(wpa_s);
 	} else {
 		wpa_scan_results_free(scan_res);