Commit 517b358f authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: simplify wfx_tx_queue_mask_get()

It is far simpler to return a pointer instead of an error. Thus, it is
no more necessary to pass a pointer reference as argument.
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200401110405.80282-12-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent abaef537
...@@ -382,8 +382,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask) ...@@ -382,8 +382,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask)
return winner; return winner;
} }
static int wfx_tx_queue_mask_get(struct wfx_vif *wvif, static struct wfx_queue *wfx_tx_queue_mask_get(struct wfx_vif *wvif,
struct wfx_queue **queue_p,
u32 *tx_allowed_mask_p) u32 *tx_allowed_mask_p)
{ {
int idx; int idx;
...@@ -398,11 +397,10 @@ static int wfx_tx_queue_mask_get(struct wfx_vif *wvif, ...@@ -398,11 +397,10 @@ static int wfx_tx_queue_mask_get(struct wfx_vif *wvif,
tx_allowed_mask |= BIT(WFX_LINK_ID_AFTER_DTIM); tx_allowed_mask |= BIT(WFX_LINK_ID_AFTER_DTIM);
idx = wfx_get_prio_queue(wvif, tx_allowed_mask); idx = wfx_get_prio_queue(wvif, tx_allowed_mask);
if (idx < 0) if (idx < 0)
return -ENOENT; return NULL;
*queue_p = &wvif->wdev->tx_queue[idx];
*tx_allowed_mask_p = tx_allowed_mask; *tx_allowed_mask_p = tx_allowed_mask;
return 0; return &wvif->wdev->tx_queue[idx];
} }
struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif) struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif)
...@@ -434,7 +432,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) ...@@ -434,7 +432,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
u32 tx_allowed_mask = 0; u32 tx_allowed_mask = 0;
u32 vif_tx_allowed_mask = 0; u32 vif_tx_allowed_mask = 0;
struct wfx_vif *wvif; struct wfx_vif *wvif;
int not_found;
int i; int i;
if (atomic_read(&wdev->tx_lock)) if (atomic_read(&wdev->tx_lock))
...@@ -469,12 +466,12 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) ...@@ -469,12 +466,12 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
spin_lock_bh(&wvif->ps_state_lock); spin_lock_bh(&wvif->ps_state_lock);
not_found = wfx_tx_queue_mask_get(wvif, &vif_queue, vif_queue = wfx_tx_queue_mask_get(wvif,
&vif_tx_allowed_mask); &vif_tx_allowed_mask);
spin_unlock_bh(&wvif->ps_state_lock); spin_unlock_bh(&wvif->ps_state_lock);
if (!not_found) { if (vif_queue) {
if (queue && queue != vif_queue) if (queue && queue != vif_queue)
dev_info(wdev->dev, "vifs disagree about queue priority\n"); dev_info(wdev->dev, "vifs disagree about queue priority\n");
tx_allowed_mask |= vif_tx_allowed_mask; tx_allowed_mask |= vif_tx_allowed_mask;
......
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