Skip to content

Commit b653174

Browse files
Malcolm Priestleygregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8902ecd commit b653174

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

drivers/staging/vt6656/device.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,15 @@ struct vnt_rx_header {
213213
u16 pay_load_len;
214214
} __packed;
215215

216+
struct vnt_rx_tail {
217+
__le64 tsf_time;
218+
u8 sq;
219+
u8 new_rsr;
220+
u8 rssi;
221+
u8 rsr;
222+
u8 sq_3;
223+
} __packed;
224+
216225
/* RCB (Receive Control Block) */
217226
struct vnt_rcb {
218227
void *priv;

drivers/staging/vt6656/dpc.c

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,10 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
3232
struct ieee80211_rx_status *rx_status;
3333
struct ieee80211_hdr *hdr;
3434
struct vnt_rx_header *head;
35+
struct vnt_rx_tail *tail;
3536
__le16 fc;
36-
u8 *rsr, *new_rsr, *rssi;
37-
__le64 *tsf_time;
3837
u32 frame_size;
3938
int ii;
40-
u8 *sq, *sq_3;
41-
u8 *skb_data;
4239
u16 rx_bitrate, pay_load_with_padding;
4340
u8 rate_idx = 0;
4441
long rx_dbm;
@@ -62,8 +59,6 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
6259
return false;
6360
}
6461

65-
skb_data = (u8 *)skb->data;
66-
6762
/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
6863
/* -8TSF - 4RSR - 4SQ3 - ?Padding */
6964

@@ -96,26 +91,14 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
9691
pay_load_with_padding = ((head->pay_load_len / 4) +
9792
((head->pay_load_len % 4) ? 1 : 0)) * 4;
9893

99-
tsf_time = (__le64 *)(skb_data + 8 + pay_load_with_padding);
100-
101-
priv->tsf_time = le64_to_cpu(*tsf_time);
102-
103-
if (priv->bb_type == BB_TYPE_11G) {
104-
sq_3 = skb_data + 8 + pay_load_with_padding + 12;
105-
sq = sq_3;
106-
} else {
107-
sq = skb_data + 8 + pay_load_with_padding + 8;
108-
sq_3 = sq;
109-
}
110-
111-
new_rsr = skb_data + 8 + pay_load_with_padding + 9;
112-
rssi = skb_data + 8 + pay_load_with_padding + 10;
94+
tail = (struct vnt_rx_tail *)(skb->data +
95+
sizeof(*head) + pay_load_with_padding);
96+
priv->tsf_time = le64_to_cpu(tail->tsf_time);
11397

114-
rsr = skb_data + 8 + pay_load_with_padding + 11;
115-
if (*rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
98+
if (tail->rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
11699
return false;
117100

118-
vnt_rf_rssi_to_dbm(priv, *rssi, &rx_dbm);
101+
vnt_rf_rssi_to_dbm(priv, tail->rssi, &rx_dbm);
119102

120103
priv->bb_pre_ed_rssi = (u8)rx_dbm + 1;
121104
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,
129112
rx_status->flag = 0;
130113
rx_status->freq = hw->conf.chandef.chan->center_freq;
131114

132-
if (!(*rsr & RSR_CRCOK))
115+
if (!(tail->rsr & RSR_CRCOK))
133116
rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
134117

135118
hdr = (struct ieee80211_hdr *)(skb->data);
@@ -142,7 +125,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
142125
rx_status->flag |= RX_FLAG_DECRYPTED;
143126

144127
/* Drop packet */
145-
if (!(*new_rsr & NEWRSR_DECRYPTOK)) {
128+
if (!(tail->new_rsr & NEWRSR_DECRYPTOK)) {
146129
dev_kfree_skb(skb);
147130
return true;
148131
}

0 commit comments

Comments
 (0)