[PATCH v2 03/10] wpa_driver: add init and deinit P2P device functions

David Spinadel dvdspndl
Sun Mar 17 13:57:13 PDT 2013


From: David Spinadel <david.spinadel at intel.com>

Add functions to handle creation and destroying P2P device interface.

Signed-off-by: David Spinadel <david.spinadel at intel.com>
---
 src/drivers/driver.h      |   17 +++++++++++++++++
 wpa_supplicant/driver_i.h |   14 ++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 9ccd8ce..abcf339 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2646,6 +2646,23 @@ struct wpa_driver_ops {
 	 * avoid frequency conflict in single channel concurrency.
 	 */
 	int (*switch_channel)(void *priv, unsigned int freq);
+
+	/**
+	 * init_p2p_dev - Initialize P2P device interface
+	 * @priv: Private driver data of the already existing interface
+	 * @ifname: interface name, e.g., p2p-wlan0, mainly for debugging
+	 * Returns: Pointer to private data of P2P device, %NULL on failure
+	 *
+	 * NULL is returned also if P2P device interface is not supported by the
+	 * HW.
+	 */
+	void * (*init_p2p_dev)(void *priv, const char *ifname, u8 *addr);
+
+	/**
+	 * deinit_p2p_dev - Deinitialize P2P device interface
+	 * @priv: private data of the P2P device interface
+	 */
+	void (*deinit_p2p_dev)(void *priv);
 };
 
 
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 29113ff..d70da3d 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -753,4 +753,18 @@ wpa_drv_p2p_cancel_remain_on_channel(struct wpa_supplicant *wpa_s)
 	return -1;
 }
 
+static inline void *wpa_drv_init_p2p_dev(struct wpa_supplicant *wpa_s,
+					 const char *ifname, u8 *addr)
+{
+	if (!wpa_s->driver->init_p2p_dev)
+		return NULL;
+	return wpa_s->driver->init_p2p_dev(wpa_s->drv_priv, ifname, addr);
+}
+
+static inline void wpa_drv_deinit_p2p_dev(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->deinit_p2p_dev)
+		wpa_s->driver->deinit_p2p_dev(wpa_s->p2p_drv_priv);
+}
+
 #endif /* DRIVER_I_H */
-- 
1.7.10.msysgit.1




More information about the Hostap mailing list