[PATCH rtw-next 4/6] wifi: rtlwifi: rtl8192se: use ALIGN() for the H2C command length
From: Rishik Yechuri
Date: Tue Nov 10 2026 - 14:07:50 EST
_rtl92s_fill_h2c_cmd() and _rtl92s_get_h2c_cmdlen() round each command
length up to a multiple of 8 with N_BYTE_ALIGMENT() from wifi.h. The
macro spells out the rounding by hand and special cases an alignment
of 1. ALIGN() from <linux/align.h> gives the same result for a power
of two.
Use ALIGN() at both sites and remove the macro together with the
comment block around it, which no longer has anything in it.
No functional change intended.
Signed-off-by: Rishik Yechuri <rishik.yechuri.code@xxxxxxxxx>
Assisted-by: Claude:claude-fable-5-1
---
drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c | 4 ++--
drivers/net/wireless/realtek/rtlwifi/wifi.h | 13 -------------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c
index 579b1789d6d1..0719d0bb2cac 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c
@@ -431,7 +431,7 @@ static u32 _rtl92s_fill_h2c_cmd(struct sk_buff *skb, u32 h2cbufferlen,
do {
/* 8 - Byte alignment */
- len = H2C_TX_CMD_HDR_LEN + N_BYTE_ALIGMENT(pcmd_len[i], 8);
+ len = H2C_TX_CMD_HDR_LEN + ALIGN(pcmd_len[i], 8);
/* Buffer length is not enough */
if (h2cbufferlen < totallen + len + tx_desclen)
@@ -484,7 +484,7 @@ static u32 _rtl92s_get_h2c_cmdlen(u32 h2cbufferlen, u32 cmd_num, u32 *pcmd_len)
do {
/* 8 - Byte alignment */
- len = H2C_TX_CMD_HDR_LEN + N_BYTE_ALIGMENT(pcmd_len[i], 8);
+ len = H2C_TX_CMD_HDR_LEN + ALIGN(pcmd_len[i], 8);
/* Buffer length is not enough */
if (h2cbufferlen < totallen + len + tx_desclen)
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 21a294b80c5b..24c6db867421 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -2806,19 +2806,6 @@ enum bt_radio_shared {
BT_RADIO_INDIVIDUAL = 1,
};
-/****************************************
- * mem access macro define start
- * Call endian free function when
- * 1. Read/write packet content.
- * 2. Before write integer to IO.
- * 3. After read integer from IO.
- ****************************************/
-
-#define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
- (__value) : (((__value + __aligment - 1) / __aligment) * __aligment))
-
-/* mem access macro define end */
-
#define byte(x, n) ((x >> (8 * n)) & 0xff)
#define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)
--
2.43.0