[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240921122113.30009-2-dominik.karol.piatkowski@protonmail.com>
Date: Sat, 21 Sep 2024 12:22:15 +0000
From: Dominik Karol Piątkowski <dominik.karol.piatkowski@...tonmail.com>
To: gregkh@...uxfoundation.org, tdavies@...kphysics.net, philipp.g.hortmann@...il.com, dan.carpenter@...aro.org
Cc: linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org, Dominik Karol Piątkowski <dominik.karol.piatkowski@...tonmail.com>
Subject: [PATCH 1/2] staging: rtl8192e: Use MSR_LINK_* macros
There were two seemingly not used macros defined in r8192E_hw.h:
MSR_LINK_ADHOC and MSR_LINK_MASTER.
There is one function explicitly updating MSR (Media Status Register):
_rtl92e_update_msr - only MSR_LINK_MASK and MSR_LINK_MANAGED are used
there. However, in rtl92e_set_reg, inside HW_VAR_MEDIA_STATUS section,
MSR is also updated - covering more than MSR_LINK_MANAGED case.
This patch makes use of appropriate MSR_LINK_* macros in rtl92e_set_reg
and removes duplicated MSR_* macros.
Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@...tonmail.com>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 10 +++++-----
drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h | 6 +-----
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 2672b1ddf88e..675e0e263697 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -54,23 +54,23 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val)
enum rt_op_mode op_mode = *((enum rt_op_mode *)(val));
u8 btMsr = rtl92e_readb(dev, MSR);
- btMsr &= 0xfc;
+ btMsr &= ~MSR_LINK_MASK;
switch (op_mode) {
case RT_OP_MODE_INFRASTRUCTURE:
- btMsr |= MSR_INFRA;
+ btMsr |= MSR_LINK_MANAGED;
break;
case RT_OP_MODE_IBSS:
- btMsr |= MSR_ADHOC;
+ btMsr |= MSR_LINK_ADHOC;
break;
case RT_OP_MODE_AP:
- btMsr |= MSR_AP;
+ btMsr |= MSR_LINK_MASTER;
break;
default:
- btMsr |= MSR_NOLINK;
+ btMsr |= MSR_LINK_NONE;
break;
}
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
index e507593b939c..743c15da84c8 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
@@ -166,11 +166,7 @@ enum _RTL8192PCI_HW {
#define MSR_LINK_MANAGED 2
#define MSR_LINK_ADHOC 1
#define MSR_LINK_MASTER 3
-
-#define MSR_NOLINK 0x00
-#define MSR_ADHOC 0x01
-#define MSR_INFRA 0x02
-#define MSR_AP 0x03
+#define MSR_LINK_NONE 0
RETRY_LIMIT = 0x304,
#define RETRY_LIMIT_SHORT_SHIFT 8
--
2.34.1
Powered by blists - more mailing lists