From patchwork Mon Feb 11 11:15:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,02/10] wpa_driver: add init and deinit P2P device functions Date: Mon, 11 Feb 2013 01:15:39 -0000 From: Arend van Spriel X-Patchwork-Id: 219575 Message-Id: <1360581347-26766-3-git-send-email-arend@broadcom.com> To: hostap@lists.shmoo.com Cc: Jouni Malinen , Johannes Berg From: David Spinadel Add functions to handle creation and destroying P2P device interface. Signed-hostap: David Spinadel --- src/drivers/driver.h | 17 +++++++++++++++++ wpa_supplicant/driver_i.h | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) 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 */