summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2020-01-19 12:03:41 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 09:52:38 +0100
commitb653174327e989cbc97f545ce33d30e1fe9de532 (patch)
treec59769d5e60d754baab8d64df976012bb726bef8 /drivers/staging
parent8902ecd70b3e3f13370af9f9e0134ad16e46fb50 (diff)
staging: vt6656: Use vnt_rx_tail struct for tail variables.
Place tsf_time, sq, new_rsr, rssi, rsr and sq3 packed in the structure. Unused variables are removed along with skb_data and structure is placed beyond vnt_rx_header + pay_load_with_padding on skb->data. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/6ac6eae0-7b71-fefe-9230-da3b345b634b@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/vt6656/device.h9
-rw-r--r--drivers/staging/vt6656/dpc.c33
2 files changed, 17 insertions, 25 deletions
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 84d170420c8a..fe6c11266123 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -213,6 +213,15 @@ struct vnt_rx_header {
u16 pay_load_len;
} __packed;
+struct vnt_rx_tail {
+ __le64 tsf_time;
+ u8 sq;
+ u8 new_rsr;
+ u8 rssi;
+ u8 rsr;
+ u8 sq_3;
+} __packed;
+
/* RCB (Receive Control Block) */
struct vnt_rcb {
void *priv;
diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 8fbb911144c6..981de5687341 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -32,13 +32,10 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
struct ieee80211_rx_status *rx_status;
struct ieee80211_hdr *hdr;
struct vnt_rx_header *head;
+ struct vnt_rx_tail *tail;
__le16 fc;
- u8 *rsr, *new_rsr, *rssi;
- __le64 *tsf_time;
u32 frame_size;
int ii;
- u8 *sq, *sq_3;
- u8 *skb_data;
u16 rx_bitrate, pay_load_with_padding;
u8 rate_idx = 0;
long rx_dbm;
@@ -62,8 +59,6 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
return false;
}
- skb_data = (u8 *)skb->data;
-
/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
/* -8TSF - 4RSR - 4SQ3 - ?Padding */
@@ -96,26 +91,14 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
pay_load_with_padding = ((head->pay_load_len / 4) +
((head->pay_load_len % 4) ? 1 : 0)) * 4;
- tsf_time = (__le64 *)(skb_data + 8 + pay_load_with_padding);
-
- priv->tsf_time = le64_to_cpu(*tsf_time);
-
- if (priv->bb_type == BB_TYPE_11G) {
- sq_3 = skb_data + 8 + pay_load_with_padding + 12;
- sq = sq_3;
- } else {
- sq = skb_data + 8 + pay_load_with_padding + 8;
- sq_3 = sq;
- }
-
- new_rsr = skb_data + 8 + pay_load_with_padding + 9;
- rssi = skb_data + 8 + pay_load_with_padding + 10;
+ tail = (struct vnt_rx_tail *)(skb->data +
+ sizeof(*head) + pay_load_with_padding);
+ priv->tsf_time = le64_to_cpu(tail->tsf_time);
- rsr = skb_data + 8 + pay_load_with_padding + 11;
- if (*rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
+ if (tail->rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
return false;
- vnt_rf_rssi_to_dbm(priv, *rssi, &rx_dbm);
+ vnt_rf_rssi_to_dbm(priv, tail->rssi, &rx_dbm);
priv->bb_pre_ed_rssi = (u8)rx_dbm + 1;
priv->current_rssi = priv->bb_pre_ed_rssi;
@@ -129,7 +112,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
rx_status->flag = 0;
rx_status->freq = hw->conf.chandef.chan->center_freq;
- if (!(*rsr & RSR_CRCOK))
+ if (!(tail->rsr & RSR_CRCOK))
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
hdr = (struct ieee80211_hdr *)(skb->data);
@@ -142,7 +125,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
rx_status->flag |= RX_FLAG_DECRYPTED;
/* Drop packet */
- if (!(*new_rsr & NEWRSR_DECRYPTOK)) {
+ if (!(tail->new_rsr & NEWRSR_DECRYPTOK)) {
dev_kfree_skb(skb);
return true;
}