diff options
author | Jérôme Pouiller <jerome.pouiller@silabs.com> | 2020-01-15 13:54:09 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-16 20:59:45 +0100 |
commit | c360f1ccdcf9532a8d8cee0f0976b28b6cb4e35b (patch) | |
tree | d0345ff64a3d2acceefa3c686649330f9b4fcee4 /drivers/staging/wfx/hif_tx_mib.h | |
parent | 9ab564653abb9dade6ca8530a3e3a2f622dcd7f5 (diff) |
staging: wfx: simplify hif_set_tx_rate_retry_policy() usage
The structure hif_mib_set_tx_rate_retry_policy come from hardware
API. It is not intended to be manipulated in upper layers of the driver.
So, this patch relocate handling of this structure to
hif_set_tx_rate_retry_policy() (the low level function).
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-6-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx/hif_tx_mib.h')
-rw-r--r-- | drivers/staging/wfx/hif_tx_mib.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index b1eeda2a3ab3..ef033a409381 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -181,13 +181,26 @@ static inline int hif_set_association_mode(struct wfx_vif *wvif, } static inline int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, - struct hif_mib_set_tx_rate_retry_policy *arg) + int policy_index, uint8_t *rates) { - size_t size = struct_size(arg, tx_rate_retry_policy, - arg->num_tx_rate_policies); + struct hif_mib_set_tx_rate_retry_policy *arg; + size_t size = struct_size(arg, tx_rate_retry_policy, 1); + int ret; - return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); + arg = kzalloc(size, GFP_KERNEL); + arg->num_tx_rate_policies = 1; + arg->tx_rate_retry_policy[0].policy_index = policy_index; + arg->tx_rate_retry_policy[0].short_retry_count = 255; + arg->tx_rate_retry_policy[0].long_retry_count = 255; + arg->tx_rate_retry_policy[0].first_rate_sel = 1; + arg->tx_rate_retry_policy[0].terminate = 1; + arg->tx_rate_retry_policy[0].count_init = 1; + memcpy(&arg->tx_rate_retry_policy[0].rates, rates, + sizeof(arg->tx_rate_retry_policy[0].rates)); + ret = hif_write_mib(wvif->wdev, wvif->id, + HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); + kfree(arg); + return ret; } static inline int hif_set_mac_addr_condition(struct wfx_vif *wvif, |