wifi: Have a separate wifi_drv_ops in wifi_mgmt_offload struct

There is no need to hide the wpa_supplicant interface
struct so add it directly to net_wifi_mgmt_offload struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
Jukka Rissanen 2023-10-30 16:29:05 +02:00 committed by Fabio Baltieri
parent 9ef7ed0a79
commit e352a6e8e9
2 changed files with 13 additions and 3 deletions

View file

@ -871,8 +871,19 @@ struct net_wifi_mgmt_offload {
#endif
/** Wi-Fi management API */
const struct wifi_mgmt_ops *const wifi_mgmt_api;
#if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT) || defined(__DOXYGEN__)
/** Wi-Fi supplicant driver API */
void *wifi_drv_ops;
#endif
};
#if defined(CONFIG_WIFI_NM_WPA_SUPPLICANT)
/* Make sure wifi_drv_ops is after wifi_mgmt_api */
BUILD_ASSERT(offsetof(struct net_wifi_mgmt_offload, wifi_mgmt_api) <
offsetof(struct net_wifi_mgmt_offload, wifi_drv_ops));
#endif
/* Make sure that the network interface API is properly setup inside
* Wifi mgmt offload API struct (it is the first one).
*/

View file

@ -462,10 +462,9 @@ out:
static const struct wifi_mgmt_ops *const get_wifi_mgmt_api(const struct device *dev)
{
struct net_wifi_mgmt_offload *off_api =
(struct net_wifi_mgmt_offload *) dev->api;
struct net_wifi_mgmt_offload *api = (struct net_wifi_mgmt_offload *)dev->api;
return off_api ? off_api->wifi_mgmt_api : NULL;
return api ? api->wifi_mgmt_api : NULL;
}
int z_wpa_supplicant_scan(const struct device *dev, struct wifi_scan_params *params,