Commit 9644032e authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtlwifi: access skb->data to get C2H data by macro

The format of C2H data is ID(1 byte) + Length(1 byte) + value, and it is
more readable to use macros to access C2H data.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9ae6ed27
......@@ -2288,10 +2288,10 @@ static void rtl_c2h_content_parsing(struct ieee80211_hw *hw,
u8 cmd_id, cmd_seq, cmd_len;
u8 *cmd_buf = NULL;
cmd_id = skb->data[0];
cmd_seq = skb->data[1];
cmd_len = skb->len - 2;
cmd_buf = skb->data + 2;
cmd_id = GET_C2H_CMD_ID(skb->data);
cmd_seq = GET_C2H_SEQ(skb->data);
cmd_len = skb->len - C2H_DATA_OFFSET;
cmd_buf = GET_C2H_DATA_PTR(skb->data);
switch (cmd_id) {
case C2H_DBG:
......
......@@ -177,6 +177,11 @@ enum rtl_c2h_evt_v2 {
C2H_V2_CCX_RPT = 0x0F,
};
#define GET_C2H_CMD_ID(c2h) ({u8 *__c2h = c2h; __c2h[0]; })
#define GET_C2H_SEQ(c2h) ({u8 *__c2h = c2h; __c2h[1]; })
#define C2H_DATA_OFFSET 2
#define GET_C2H_DATA_PTR(c2h) ({u8 *__c2h = c2h; &__c2h[C2H_DATA_OFFSET]; })
#define GET_TX_REPORT_SN_V1(c2h) (c2h[6])
#define GET_TX_REPORT_ST_V1(c2h) (c2h[0] & 0xC0)
#define GET_TX_REPORT_RETRY_V1(c2h) (c2h[2] & 0x3F)
......
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