Skip to contentSkip to conversation

wifi: rtw89: use struct to parse firmware header

PATCH In review Ping-Ke Shih 2 participants 2 messages Jun 16, 2023 – Jun 21, 2023 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/1 wifi: rtw89: use struct to parse firmware header

A firmware contains basic header, sections and optional dynamic header. Define them by a struct, so it will be easier to understand the layout, and also simply access these elements.

---
 drivers/net/wireless/realtek/rtw89/core.h |   8 +-
 drivers/net/wireless/realtek/rtw89/fw.c   |  58 +++++++------
 drivers/net/wireless/realtek/rtw89/fw.h   | 101 ++++++++++++----------
 3 files changed, 87 insertions(+), 80 deletions(-)
drivers/net/wireless/realtek/rtw89/core.h +4 -4
index 0f7ca12e4b34f..c085dff3ae35e 100644
@@ -3387,10 +3387,10 @@ struct rtw89_fw_suit {
 			  (mfw_hdr)->ver.idx)
 
 #define RTW89_FW_HDR_VER_CODE(fw_hdr)				\
-	RTW89_FW_VER_CODE(GET_FW_HDR_MAJOR_VERSION(fw_hdr),	\
-			  GET_FW_HDR_MINOR_VERSION(fw_hdr),	\
-			  GET_FW_HDR_SUBVERSION(fw_hdr),	\
-			  GET_FW_HDR_SUBINDEX(fw_hdr))
+	RTW89_FW_VER_CODE(le32_get_bits((fw_hdr)->w1, FW_HDR_W1_MAJOR_VERSION),	\
+			  le32_get_bits((fw_hdr)->w1, FW_HDR_W1_MINOR_VERSION),	\
+			  le32_get_bits((fw_hdr)->w1, FW_HDR_W1_SUBVERSION),	\
+			  le32_get_bits((fw_hdr)->w1, FW_HDR_W1_SUBINDEX))
 
 struct rtw89_fw_req_info {
 	const struct firmware *firmware;
drivers/net/wireless/realtek/rtw89/fw.c +30 -28

99 lines not on this page · raw message

drivers/net/wireless/realtek/rtw89/fw.h +53 -48

119 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Ping-Ke Shih

A firmware contains basic header, sections and optional dynamic header. Define them by a struct, so it will be easier to understand the layout, and also simply access these elements.

Patch applied to wireless-next.git, thanks.

f072eb39e4f2 wifi: rtw89: use struct to parse firmware header

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches