From: Rishik Yechuri <epicrishik@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Rishik Yechuri <rishik.yechuri.code@gmail.com>
Subject: [PATCH rtw-next 4/6] wifi: rtlwifi: rtl8192se: use ALIGN() for the H2C command length
Date: Tue, 10 Nov 2026 12:44:07 -0600 [thread overview]
Message-ID: <20261110184409.42205-5-rishik.yechuri.code@gmail.com> (raw)
In-Reply-To: <20261110184409.42205-1-rishik.yechuri.code@gmail.com>
_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@gmail.com>
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
next prev parent reply other threads:[~2026-11-10 18:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 18:44 [PATCH rtw-next 0/6] wifi: rtlwifi: replace the 802.11 header helper macros with kernel ones Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 1/6] wifi: rtlwifi: use struct ieee80211_pspoll for the PS Poll reserved page Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 2/6] wifi: rtlwifi: use struct ieee80211_hdr for the reserved page headers Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 3/6] wifi: rtlwifi: call msecs_to_jiffies() directly Rishik Yechuri
2026-11-10 18:44 ` Rishik Yechuri [this message]
2026-11-10 18:44 ` [PATCH rtw-next 5/6] wifi: rtlwifi: use ieee80211_is_ctl() instead of WLAN_FC_GET_TYPE() Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 6/6] wifi: rtlwifi: remove byte(), packet_get_type() and FILL_OCTET_STRING() Rishik Yechuri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261110184409.42205-5-rishik.yechuri.code@gmail.com \
--to=epicrishik@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=rishik.yechuri.code@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®