Skip to content

Commit

Permalink
carl9170: Convert 'ar9170_qmap' to inline function
Browse files Browse the repository at this point in the history
'ar9170_qmap' is used in some source files which include carl9170.h,
but not all of them.  A 'defined but not used' warning is thrown when
compiling the ones which do not use it.

Fixes the following W=1 kernel build warning(s)

 from drivers/net/wireless/ath/carl9170/carl9170.h:57,
 In file included from drivers/net/wireless/ath/carl9170/carl9170.h:57,
 drivers/net/wireless/ath/carl9170/carl9170.h:71:17: warning: ‘ar9170_qmap’ defined but not used [-Wunused-const-variable=]

 NB: Snipped - lots of these repeat

Cc: Christian Lamparter <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: [email protected]
Cc: [email protected]
Suggested-by: Rasmus Villemoes <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Acked-by: Christian Lamparter <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/20200827093351.GA1627017@dell
  • Loading branch information
Lee Jones authored and Kalle Valo committed Aug 31, 2020
1 parent ea2e3df commit 859228a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion drivers/net/wireless/ath/carl9170/carl9170.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@

#define PAYLOAD_MAX (CARL9170_MAX_CMD_LEN / 4 - 1)

static const u8 ar9170_qmap[__AR9170_NUM_TXQ] = { 3, 2, 1, 0 };
static inline u8 ar9170_qmap(u8 idx)
{
return 3 - idx; /* { 3, 2, 1, 0 } */
}

#define CARL9170_MAX_RX_BUFFER_SIZE 8192

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/carl9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ static int carl9170_op_conf_tx(struct ieee80211_hw *hw,
int ret;

mutex_lock(&ar->mutex);
memcpy(&ar->edcf[ar9170_qmap[queue]], param, sizeof(*param));
memcpy(&ar->edcf[ar9170_qmap(queue)], param, sizeof(*param));
ret = carl9170_set_qos(ar);
mutex_unlock(&ar->mutex);
return ret;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/ath/carl9170/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ static void __carl9170_tx_process_status(struct ar9170 *ar,
unsigned int r, t, q;
bool success = true;

q = ar9170_qmap[info & CARL9170_TX_STATUS_QUEUE];
q = ar9170_qmap(info & CARL9170_TX_STATUS_QUEUE);

skb = carl9170_get_queued_skb(ar, cookie, &ar->tx_status[q]);
if (!skb) {
Expand Down Expand Up @@ -979,7 +979,7 @@ static int carl9170_tx_prepare(struct ar9170 *ar,
((CARL9170_TX_SUPER_MISC_VIF_ID >>
CARL9170_TX_SUPER_MISC_VIF_ID_S) + 1));

hw_queue = ar9170_qmap[carl9170_get_queue(ar, skb)];
hw_queue = ar9170_qmap(carl9170_get_queue(ar, skb));

hdr = (void *)skb->data;
info = IEEE80211_SKB_CB(skb);
Expand Down Expand Up @@ -1279,7 +1279,7 @@ void carl9170_tx_drop(struct ar9170 *ar, struct sk_buff *skb)

super = (void *)skb->data;
SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, q,
ar9170_qmap[carl9170_get_queue(ar, skb)]);
ar9170_qmap(carl9170_get_queue(ar, skb)));
__carl9170_tx_process_status(ar, super->s.cookie, q);
}

Expand Down

0 comments on commit 859228a

Please sign in to comment.