[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221017171653.12578-1-bpappas@pappasbrent.com>
Date: Mon, 17 Oct 2022 13:16:54 -0400
From: Brent Pappas <bpappas@...pasbrent.com>
To: gregkh@...uxfoundation.org
Cc: linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Brent Pappas <pappasbrent@...il.com>,
Brent Pappas <bpappas@...pasbrent.com>
Subject: [PATCH] staging: rtl8723bs: core: Replace macros RotR1 through Mk16 with static inline functions
From: Brent Pappas <pappasbrent@...il.com>
Replace macros "RotR1", "Lo8", "Hi8", "Lo16", "Hi16", and "Mk16" with
static inline functions to comply with Linux coding style standards.
Signed-off-by: Brent Pappas <bpappas@...pasbrent.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 35 +++++++++++++++----
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index ac731415f733..519e141fb82c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -253,12 +253,35 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod
}
/* macros for extraction/creation of unsigned char/unsigned short values */
-#define RotR1(v16) ((((v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15))
-#define Lo8(v16) ((u8)((v16) & 0x00FF))
-#define Hi8(v16) ((u8)(((v16) >> 8) & 0x00FF))
-#define Lo16(v32) ((u16)((v32) & 0xFFFF))
-#define Hi16(v32) ((u16)(((v32) >> 16) & 0xFFFF))
-#define Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8))
+static inline u16 RotR1(u16 v16)
+{
+ return ((((v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15));
+}
+
+static inline u8 Lo8(u16 v16)
+{
+ return ((u8)((v16) & 0x00FF));
+}
+
+static inline u8 Hi8(u16 v16)
+{
+ return ((u8)(((v16) >> 8) & 0x00FF));
+}
+
+static inline u16 Lo16(u32 v32)
+{
+ return ((u16)((v32) & 0xFFFF));
+}
+
+static inline u32 Hi16(u32 v32)
+{
+ return ((u16)(((v32) >> 16) & 0xFFFF));
+}
+
+static u16 Mk16(u8 hi, u8 lo)
+{
+ return ((lo) ^ (((u16)(hi)) << 8));
+}
/* select the Nth 16-bit word of the temporal key unsigned char array TK[] */
#define TK16(N) Mk16(tk[2*(N)+1], tk[2*(N)])
--
2.34.1
Powered by blists - more mailing lists