From ea69d9737cfdf42610ad8134b05ecbf9daf1c289 Mon Sep 17 00:00:00 2001 From: Avraham Stern Date: Mon, 15 Feb 2016 16:53:13 +0200 Subject: [PATCH] wpa_supplicant: Share a single get_mode() implementation There is no need to duplicate this helper function in multiple files. Signed-off-by: Avraham Stern --- wpa_supplicant/p2p_supplicant.c | 15 --------------- wpa_supplicant/scan.c | 15 --------------- wpa_supplicant/sme.c | 15 --------------- wpa_supplicant/wpa_supplicant.c | 14 ++++++++++++++ wpa_supplicant/wpa_supplicant_i.h | 3 +++ 5 files changed, 17 insertions(+), 45 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 4c54b46c4..5f5b91b59 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3291,21 +3291,6 @@ static int wpas_p2p_default_channels(struct wpa_supplicant *wpa_s, } -static struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes, - u16 num_modes, - enum hostapd_hw_mode mode) -{ - u16 i; - - for (i = 0; i < num_modes; i++) { - if (modes[i].mode == mode) - return &modes[i]; - } - - return NULL; -} - - enum chan_allowed { NOT_ALLOWED, NO_IR, ALLOWED }; diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 3c3f9e01d..f4f2c20c9 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -521,21 +521,6 @@ static int non_p2p_network_enabled(struct wpa_supplicant *wpa_s) #endif /* CONFIG_P2P */ -static struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes, - u16 num_modes, - enum hostapd_hw_mode mode) -{ - u16 i; - - for (i = 0; i < num_modes; i++) { - if (modes[i].mode == mode) - return &modes[i]; - } - - return NULL; -} - - static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s, enum hostapd_hw_mode band, struct wpa_driver_scan_params *params) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index fd38b9df8..c6b8a58f1 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1322,21 +1322,6 @@ int sme_proc_obss_scan(struct wpa_supplicant *wpa_s) } -static struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes, - u16 num_modes, - enum hostapd_hw_mode mode) -{ - u16 i; - - for (i = 0; i < num_modes; i++) { - if (modes[i].mode == mode) - return &modes[i]; - } - - return NULL; -} - - static void wpa_obss_scan_freqs_list(struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *params) { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 8171b62ae..ba82e50cc 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -6252,3 +6252,17 @@ int wpas_vendor_elem_remove(struct wpa_supplicant *wpa_s, int frame, return -1; } + + +struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes, + u16 num_modes, enum hostapd_hw_mode mode) +{ + u16 i; + + for (i = 0; i < num_modes; i++) { + if (modes[i].mode == mode) + return &modes[i]; + } + + return NULL; +} diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 7b74f383c..874299300 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1206,4 +1206,7 @@ void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s, int wpas_sched_scan_plans_set(struct wpa_supplicant *wpa_s, const char *cmd); +struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes, + u16 num_modes, enum hostapd_hw_mode mode); + #endif /* WPA_SUPPLICANT_I_H */