16
16
17
17
#define SCAN_TIMEOUT 30
18
18
19
+ const struct zep_wpa_supp_dev_ops * get_dev_ops (const struct device * dev )
20
+ {
21
+ struct net_wifi_mgmt_offload * api ;
22
+
23
+ api = (struct net_wifi_mgmt_offload * )dev -> api ;
24
+
25
+ return api -> wifi_drv_ops ;
26
+ }
27
+
19
28
void wpa_supplicant_event_wrapper (void * ctx ,
20
29
enum wpa_event_type event ,
21
30
union wpa_event_data * data )
@@ -60,8 +69,7 @@ static int wpa_drv_zep_abort_scan(void *priv,
60
69
61
70
if_ctx = priv ;
62
71
63
- dev_ops = if_ctx -> dev_ctx -> config ;
64
-
72
+ dev_ops = get_dev_ops (if_ctx -> dev_ctx );
65
73
if (!dev_ops -> scan_abort ) {
66
74
wpa_printf (MSG_ERROR ,
67
75
"%s: No op registered for scan_abort\n" ,
@@ -478,8 +486,7 @@ static int wpa_drv_register_frame(struct zep_drv_if_ctx *if_ctx,
478
486
{
479
487
const struct zep_wpa_supp_dev_ops * dev_ops = NULL ;
480
488
481
- dev_ops = if_ctx -> dev_ctx -> config ;
482
-
489
+ dev_ops = get_dev_ops (if_ctx -> dev_ctx );
483
490
if (!dev_ops -> register_frame )
484
491
return -1 ;
485
492
@@ -641,7 +648,7 @@ struct hostapd_hw_modes *wpa_drv_get_hw_feature_data(void *priv,
641
648
642
649
if_ctx = priv ;
643
650
644
- dev_ops = if_ctx -> dev_ctx -> config ;
651
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
645
652
646
653
struct phy_info_arg result = {
647
654
.num_modes = num_modes ,
@@ -718,7 +725,7 @@ static void *wpa_drv_zep_init(void *ctx,
718
725
void * global_priv )
719
726
{
720
727
struct zep_drv_if_ctx * if_ctx = NULL ;
721
- const struct zep_wpa_supp_dev_ops * dev_ops = NULL ;
728
+ const struct zep_wpa_supp_dev_ops * dev_ops ;
722
729
struct zep_wpa_supp_dev_callbk_fns callbk_fns ;
723
730
const struct device * device ;
724
731
struct net_if * iface ;
@@ -741,7 +748,7 @@ static void *wpa_drv_zep_init(void *ctx,
741
748
if_ctx -> dev_ctx = device ;
742
749
if_ctx -> drv_ctx = global_priv ;
743
750
744
- dev_ops = if_ctx -> dev_ctx -> config ;
751
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
745
752
if (!dev_ops -> init ) {
746
753
wpa_printf (MSG_ERROR ,
747
754
"%s: No op registered for init\n" ,
@@ -792,7 +799,7 @@ static void wpa_drv_zep_deinit(void *priv)
792
799
793
800
if_ctx = priv ;
794
801
795
- dev_ops = if_ctx -> dev_ctx -> config ;
802
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
796
803
if (!dev_ops -> deinit ) {
797
804
wpa_printf (MSG_ERROR , "%s: No op registered for deinit\n" , __func__ );
798
805
return ;
@@ -822,7 +829,7 @@ static int wpa_drv_zep_scan2(void *priv, struct wpa_driver_scan_params *params)
822
829
goto out ;
823
830
}
824
831
825
- dev_ops = if_ctx -> dev_ctx -> config ;
832
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
826
833
if (!dev_ops -> scan2 ) {
827
834
wpa_printf (MSG_ERROR , "%s: No op registered for scan2\n" , __func__ );
828
835
goto out ;
@@ -881,7 +888,7 @@ struct wpa_scan_results *wpa_drv_zep_get_scan_results2(void *priv)
881
888
882
889
if_ctx = priv ;
883
890
884
- dev_ops = if_ctx -> dev_ctx -> config ;
891
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
885
892
if (!dev_ops -> get_scan_results2 ) {
886
893
wpa_printf (MSG_ERROR ,
887
894
"%s: No op registered for scan2\n" ,
@@ -943,8 +950,7 @@ static int wpa_drv_zep_deauthenticate(void *priv, const u8 *addr,
943
950
944
951
if_ctx = priv ;
945
952
946
- dev_ops = if_ctx -> dev_ctx -> config ;
947
-
953
+ dev_ops = get_dev_ops (if_ctx -> dev_ctx );
948
954
ret = dev_ops -> deauthenticate (if_ctx -> dev_priv , addr , reason_code );
949
955
if (ret ) {
950
956
wpa_printf (MSG_ERROR , "%s: deauthenticate op failed\n" , __func__ );
@@ -972,7 +978,7 @@ static int wpa_drv_zep_authenticate(void *priv,
972
978
973
979
if_ctx = priv ;
974
980
975
- dev_ops = if_ctx -> dev_ctx -> config ;
981
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
976
982
977
983
os_memcpy (if_ctx -> ssid , params -> ssid , params -> ssid_len );
978
984
@@ -1011,7 +1017,7 @@ static int wpa_drv_zep_associate(void *priv,
1011
1017
1012
1018
if_ctx = priv ;
1013
1019
1014
- dev_ops = if_ctx -> dev_ctx -> config ;
1020
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1015
1021
1016
1022
ret = dev_ops -> associate (if_ctx -> dev_priv , params );
1017
1023
if (ret ) {
@@ -1052,7 +1058,7 @@ static int _wpa_drv_zep_set_key(void *priv,
1052
1058
}
1053
1059
1054
1060
if_ctx = priv ;
1055
- dev_ops = if_ctx -> dev_ctx -> config ;
1061
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1056
1062
1057
1063
wpa_printf (MSG_DEBUG , "%s: priv:%p alg %d addr %p key_idx %d set_tx %d seq %p "
1058
1064
"seq_len %d key %p key_len %d\n" ,
@@ -1114,7 +1120,7 @@ static int wpa_drv_zep_get_capa(void *priv, struct wpa_driver_capa *capa)
1114
1120
}
1115
1121
1116
1122
if_ctx = priv ;
1117
- dev_ops = if_ctx -> dev_ctx -> config ;
1123
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1118
1124
1119
1125
if (!dev_ops -> get_capa ) {
1120
1126
wpa_printf (MSG_ERROR , "%s: get_capa op not supported\n" , __func__ );
@@ -1174,7 +1180,7 @@ static int wpa_drv_zep_set_supp_port(void *priv,
1174
1180
1175
1181
if_ctx = priv ;
1176
1182
1177
- dev_ops = if_ctx -> dev_ctx -> config ;
1183
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1178
1184
1179
1185
iface = net_if_lookup_by_dev (if_ctx -> dev_ctx );
1180
1186
@@ -1209,7 +1215,7 @@ static int wpa_drv_zep_signal_poll(void *priv, struct wpa_signal_info *si)
1209
1215
}
1210
1216
1211
1217
if_ctx = priv ;
1212
- dev_ops = if_ctx -> dev_ctx -> config ;
1218
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1213
1219
1214
1220
os_memset (si , 0 , sizeof (* si ));
1215
1221
@@ -1242,7 +1248,7 @@ static int wpa_drv_zep_send_action(void *priv, unsigned int freq,
1242
1248
struct ieee80211_hdr * hdr ;
1243
1249
1244
1250
if_ctx = priv ;
1245
- dev_ops = if_ctx -> dev_ctx -> config ;
1251
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1246
1252
1247
1253
wpa_printf (MSG_DEBUG , "wpa_supp: Send Action frame ("
1248
1254
"freq=%u MHz wait=%d ms no_cck=%d)" ,
@@ -1299,7 +1305,7 @@ static int wpa_drv_zep_get_conn_info(void *priv, struct wpa_conn_info *ci)
1299
1305
}
1300
1306
1301
1307
if_ctx = priv ;
1302
- dev_ops = if_ctx -> dev_ctx -> config ;
1308
+ dev_ops = get_dev_ops ( if_ctx -> dev_ctx ) ;
1303
1309
1304
1310
if (!dev_ops ) {
1305
1311
wpa_printf (MSG_ERROR , "%s:Failed to get config handle\n" , __func__ );
0 commit comments