Commit a2fbf9e1 authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Kalle Valo

wifi: wilc1000: simplify wilc_scan()

Simplify 'wilc_scan()' assuming 'struct wilc_priv *' is the only data
passed to '(*scan_result)()' callback and thus avoid typeless 'void *'
pointers in related code, including 'struct wilc_user_scan_req'.
Compile tested only.
Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231031171330.70399-2-dmantipov@yandex.ru
parent 4859b08f
...@@ -105,10 +105,9 @@ struct wilc_ch_list_elem { ...@@ -105,10 +105,9 @@ struct wilc_ch_list_elem {
} __packed; } __packed;
static void cfg_scan_result(enum scan_event scan_event, static void cfg_scan_result(enum scan_event scan_event,
struct wilc_rcvd_net_info *info, void *user_void) struct wilc_rcvd_net_info *info,
struct wilc_priv *priv)
{ {
struct wilc_priv *priv = user_void;
if (!priv->cfg_scanning) if (!priv->cfg_scanning)
return; return;
...@@ -285,9 +284,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) ...@@ -285,9 +284,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
else else
scan_type = WILC_FW_PASSIVE_SCAN; scan_type = WILC_FW_PASSIVE_SCAN;
ret = wilc_scan(vif, WILC_FW_USER_SCAN, scan_type, scan_ch_list, ret = wilc_scan(vif, WILC_FW_USER_SCAN, scan_type,
request->n_channels, cfg_scan_result, (void *)priv, scan_ch_list, cfg_scan_result, request);
request);
if (ret) { if (ret) {
priv->scan_req = NULL; priv->scan_req = NULL;
......
...@@ -144,18 +144,19 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt) ...@@ -144,18 +144,19 @@ static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt)
scan_req = &hif_drv->usr_scan_req; scan_req = &hif_drv->usr_scan_req;
if (scan_req->scan_result) { if (scan_req->scan_result) {
scan_req->scan_result(evt, NULL, scan_req->arg); scan_req->scan_result(evt, NULL, scan_req->priv);
scan_req->scan_result = NULL; scan_req->scan_result = NULL;
} }
return result; return result;
} }
int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, int wilc_scan(struct wilc_vif *vif, u8 scan_source,
u8 *ch_freq_list, u8 ch_list_len, u8 scan_type, u8 *ch_freq_list,
void (*scan_result_fn)(enum scan_event, void (*scan_result_fn)(enum scan_event,
struct wilc_rcvd_net_info *, void *), struct wilc_rcvd_net_info *,
void *user_arg, struct cfg80211_scan_request *request) struct wilc_priv *),
struct cfg80211_scan_request *request)
{ {
int result = 0; int result = 0;
struct wid wid_list[WILC_SCAN_WID_LIST_SIZE]; struct wid wid_list[WILC_SCAN_WID_LIST_SIZE];
...@@ -164,6 +165,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, ...@@ -164,6 +165,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
u8 *buffer; u8 *buffer;
u8 valuesize = 0; u8 valuesize = 0;
u8 *search_ssid_vals = NULL; u8 *search_ssid_vals = NULL;
const u8 ch_list_len = request->n_channels;
struct host_if_drv *hif_drv = vif->hif_drv; struct host_if_drv *hif_drv = vif->hif_drv;
if (hif_drv->hif_state >= HOST_IF_SCANNING && if (hif_drv->hif_state >= HOST_IF_SCANNING &&
...@@ -249,7 +251,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, ...@@ -249,7 +251,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
index++; index++;
hif_drv->usr_scan_req.scan_result = scan_result_fn; hif_drv->usr_scan_req.scan_result = scan_result_fn;
hif_drv->usr_scan_req.arg = user_arg; hif_drv->usr_scan_req.priv = &vif->priv;
result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, index); result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, index);
if (result) { if (result) {
...@@ -546,7 +548,7 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work) ...@@ -546,7 +548,7 @@ static void handle_rcvd_ntwrk_info(struct work_struct *work)
if (scan_req->scan_result) if (scan_req->scan_result)
scan_req->scan_result(SCAN_EVENT_NETWORK_FOUND, rcvd_info, scan_req->scan_result(SCAN_EVENT_NETWORK_FOUND, rcvd_info,
scan_req->arg); scan_req->priv);
done: done:
kfree(rcvd_info->mgmt); kfree(rcvd_info->mgmt);
...@@ -730,7 +732,7 @@ int wilc_disconnect(struct wilc_vif *vif) ...@@ -730,7 +732,7 @@ int wilc_disconnect(struct wilc_vif *vif)
if (scan_req->scan_result) { if (scan_req->scan_result) {
del_timer(&hif_drv->scan_timer); del_timer(&hif_drv->scan_timer);
scan_req->scan_result(SCAN_EVENT_ABORTED, NULL, scan_req->arg); scan_req->scan_result(SCAN_EVENT_ABORTED, NULL, scan_req->priv);
scan_req->scan_result = NULL; scan_req->scan_result = NULL;
} }
...@@ -1539,7 +1541,7 @@ int wilc_deinit(struct wilc_vif *vif) ...@@ -1539,7 +1541,7 @@ int wilc_deinit(struct wilc_vif *vif)
if (hif_drv->usr_scan_req.scan_result) { if (hif_drv->usr_scan_req.scan_result) {
hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL,
hif_drv->usr_scan_req.arg); hif_drv->usr_scan_req.priv);
hif_drv->usr_scan_req.scan_result = NULL; hif_drv->usr_scan_req.scan_result = NULL;
} }
......
...@@ -98,8 +98,9 @@ struct wilc_rcvd_net_info { ...@@ -98,8 +98,9 @@ struct wilc_rcvd_net_info {
struct wilc_priv; struct wilc_priv;
struct wilc_user_scan_req { struct wilc_user_scan_req {
void (*scan_result)(enum scan_event evt, void (*scan_result)(enum scan_event evt,
struct wilc_rcvd_net_info *info, void *priv); struct wilc_rcvd_net_info *info,
void *arg; struct wilc_priv *priv);
struct wilc_priv *priv;
u32 ch_cnt; u32 ch_cnt;
}; };
...@@ -172,11 +173,12 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies, ...@@ -172,11 +173,12 @@ int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies,
int wilc_disconnect(struct wilc_vif *vif); int wilc_disconnect(struct wilc_vif *vif);
int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel); int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level); int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, int wilc_scan(struct wilc_vif *vif, u8 scan_source,
u8 *ch_freq_list, u8 ch_list_len, u8 scan_type, u8 *ch_freq_list,
void (*scan_result_fn)(enum scan_event, void (*scan_result_fn)(enum scan_event,
struct wilc_rcvd_net_info *, void *), struct wilc_rcvd_net_info *,
void *user_arg, struct cfg80211_scan_request *request); struct wilc_priv *),
struct cfg80211_scan_request *request);
int wilc_hif_set_cfg(struct wilc_vif *vif, int wilc_hif_set_cfg(struct wilc_vif *vif,
struct cfg_param_attr *cfg_param); struct cfg_param_attr *cfg_param);
int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler); int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment