[RFC,02/10] wpa_driver: add init and deinit P2P device functions

Submitted by Arend van Spriel on Feb. 11, 2013, 11:15 a.m.

Details

Message ID 1360581347-26766-3-git-send-email-arend@broadcom.com
State Superseded
Headers show

Commit Message

Arend van Spriel Feb. 11, 2013, 11:15 a.m.
From: David Spinadel <david.spinadel@intel.com>

Add functions to handle creation and destroying P2P device interface.

Signed-hostap: David Spinadel <david.spinadel@intel.com>
---
 src/drivers/driver.h      |   17 +++++++++++++++++
 wpa_supplicant/driver_i.h |   16 ++++++++++++++++
 2 files changed, 33 insertions(+)

Comments

Arend van Spriel Feb. 11, 2013, 11:26 a.m.
On 02/11/2013 12:15 PM, Arend van Spriel wrote:
> From: David Spinadel <david.spinadel@intel.com>
> 
> Add functions to handle creation and destroying P2P device interface.
> 
> Signed-hostap: David Spinadel <david.spinadel@intel.com>
> ---
>  src/drivers/driver.h      |   17 +++++++++++++++++
>  wpa_supplicant/driver_i.h |   16 ++++++++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
> index 847600d..79f0641 100644
> --- a/wpa_supplicant/driver_i.h
> +++ b/wpa_supplicant/driver_i.h
> @@ -689,4 +689,20 @@ static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
>  				       buf_len);
>  }
>  
> +#ifdef CONFIG_P2P

Just looking at the other p2p wrappers these should probably not be
conditionally compiled.

> +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
> +
>  #endif /* DRIVER_I_H */
>
Spinadel, David Feb. 13, 2013, 6:16 a.m.
> Just looking at the other p2p wrappers these should probably not be
> conditionally compiled.
> 
Ok, makes sense.

David 

---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Patch hide | download patch | download mbox

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 1a9d951..b4f07c2 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2627,6 +2627,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 847600d..79f0641 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -689,4 +689,20 @@  static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
 				       buf_len);
 }
 
+#ifdef CONFIG_P2P
+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
+
 #endif /* DRIVER_I_H */