]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: wilc1000: simplify remain on channel support
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 26 Oct 2023 14:10:11 +0000 (17:10 +0300)
committerKalle Valo <kvalo@kernel.org>
Mon, 30 Oct 2023 17:23:51 +0000 (19:23 +0200)
For 'struct wilc_remain_ch', drop set but otherwise unused 'duration'
field and adjust 'expired' callback assuming that the only data passed
to it is 'struct wilc_vif *', thus making 'wilc_remain_on_channel()'
a bit simpler as well. Compile tested only.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231026141016.71407-1-dmantipov@yandex.ru
drivers/net/wireless/microchip/wilc1000/cfg80211.c
drivers/net/wireless/microchip/wilc1000/hif.c
drivers/net/wireless/microchip/wilc1000/hif.h

index da52f91693b5bf3481860ddeee803f7b094529d0..bf2a6053350602cd68d73b089547516fd445f7fc 100644 (file)
@@ -1094,9 +1094,8 @@ static void wilc_wfi_mgmt_tx_complete(void *priv, int status)
        kfree(pv_data);
 }
 
-static void wilc_wfi_remain_on_channel_expired(void *data, u64 cookie)
+static void wilc_wfi_remain_on_channel_expired(struct wilc_vif *vif, u64 cookie)
 {
-       struct wilc_vif *vif = data;
        struct wilc_priv *priv = &vif->priv;
        struct wilc_wfi_p2p_listen_params *params = &priv->remain_on_ch_params;
 
@@ -1128,9 +1127,8 @@ static int remain_on_channel(struct wiphy *wiphy,
        if (id == 0)
                id = ++priv->inc_roc_cookie;
 
-       ret = wilc_remain_on_channel(vif, id, duration, chan->hw_value,
-                                    wilc_wfi_remain_on_channel_expired,
-                                    (void *)vif);
+       ret = wilc_remain_on_channel(vif, id, chan->hw_value,
+                                    wilc_wfi_remain_on_channel_expired);
        if (ret)
                return ret;
 
index a28da5938481340101d547e88f639e07d8683ad3..2c42683dd5fb3620ab456469c32bb4211659c1af 100644 (file)
@@ -878,7 +878,7 @@ static int handle_remain_on_chan(struct wilc_vif *vif,
        if (result)
                return -EBUSY;
 
-       hif_drv->remain_on_ch.arg = hif_remain_ch->arg;
+       hif_drv->remain_on_ch.vif = hif_remain_ch->vif;
        hif_drv->remain_on_ch.expired = hif_remain_ch->expired;
        hif_drv->remain_on_ch.ch = hif_remain_ch->ch;
        hif_drv->remain_on_ch.cookie = hif_remain_ch->cookie;
@@ -915,7 +915,7 @@ static int wilc_handle_roc_expired(struct wilc_vif *vif, u64 cookie)
                }
 
                if (hif_drv->remain_on_ch.expired) {
-                       hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg,
+                       hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.vif,
                                                      cookie);
                }
        } else {
@@ -1669,18 +1669,15 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length)
        }
 }
 
-int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie,
-                          u32 duration, u16 chan,
-                          void (*expired)(void *, u64),
-                          void *user_arg)
+int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie, u16 chan,
+                          void (*expired)(struct wilc_vif *, u64))
 {
        struct wilc_remain_ch roc;
        int result;
 
        roc.ch = chan;
        roc.expired = expired;
-       roc.arg = user_arg;
-       roc.duration = duration;
+       roc.vif = vif;
        roc.cookie = cookie;
        result = handle_remain_on_chan(vif, &roc);
        if (result)
index 8e386db72e45883301f47116237361ab5ba39dc9..b0cb35590027faa60094e6b4b0381526710db538 100644 (file)
@@ -118,11 +118,11 @@ struct wilc_conn_info {
        void *param;
 };
 
+struct wilc_vif;
 struct wilc_remain_ch {
        u16 ch;
-       u32 duration;
-       void (*expired)(void *priv, u64 cookie);
-       void *arg;
+       void (*expired)(struct wilc_vif *vif, u64 cookie);
+       struct wilc_vif *vif;
        u64 cookie;
 };
 
@@ -150,7 +150,6 @@ struct host_if_drv {
        u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE];
 };
 
-struct wilc_vif;
 int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
                 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
                 u8 mode, u8 cipher_mode, u8 index);
@@ -192,10 +191,8 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
 int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
                                u8 *mc_list);
-int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie,
-                          u32 duration, u16 chan,
-                          void (*expired)(void *, u64),
-                          void *user_arg);
+int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie, u16 chan,
+                          void (*expired)(struct wilc_vif *, u64));
 int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie);
 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 int wilc_set_operation_mode(struct wilc_vif *vif, int index, u8 mode,