Linux kernel staging patches
 help / color / mirror / Atom feed
From: Akhmad <akhmad100913@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, Akhmad <Akhmad100913@gmail.com>
Subject: [PATCH] staging: rtl8723bs: replace magic numbers with named constants
Date: Sat, 25 Jul 2026 15:53:14 +0300	[thread overview]
Message-ID: <20260725125314.39313-1-Akhmad100913@gmail.com> (raw)

Replace magic numbers 0x6404 and 0x660F in rtl8723b_InitBeaconVariables()
with named constants TBTT_PROHIBIT_INIT_VAL and BCNTCFG_INIT_VAL.

This improves code readability and addresses a TODO comment requesting
the removal of magic numbers from this driver.

Signed-off-by: Akhmad <Akhmad100913@gmail.com>
---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -11,6 +11,9 @@
 #include <rtl8723b_hal.h>
 #include "hal_com_h2c.h"
 
+#define TBTT_PROHIBIT_INIT_VAL 0x6404
+#define BCNTCFG_INIT_VAL       0x660F
+
 static void _FWDownloadEnable(struct adapter *padapter, bool enable)
 {
 	u8 tmp, count = 0;
@@ -878,17 +881,16 @@
 
 	rtw_write16(padapter, REG_BCN_CTRL, val16);
 
-	/*  TODO: Remove these magic number */
-	rtw_write16(padapter, REG_TBTT_PROHIBIT, 0x6404);/*  ms */
+	rtw_write16(padapter, REG_TBTT_PROHIBIT, TBTT_PROHIBIT_INIT_VAL); /* ms */
 	/*  Firmware will control REG_DRVERLYINT when power saving is enable, */
 	/*  so don't set this register on STA mode. */
 	if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == false)
-		rtw_write8(padapter, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME_8723B); /*  5ms */
+		rtw_write8(padapter, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME_8723B); /* 5ms */
 	rtw_write8(padapter, REG_BCNDMATIM, BCN_DMA_ATIME_INT_TIME_8723B); /*  2ms */
 
 	/*  Suggested by designer timchen. Change beacon AIFS to the largest number */
 	/*  because test chip does not contension before sending beacon. by tynli. 2009.11.03 */
-	rtw_write16(padapter, REG_BCNTCFG, 0x660F);
+	rtw_write16(padapter, REG_BCNTCFG, BCNTCFG_INIT_VAL);
 
 	pHalData->RegBcnCtrlVal = rtw_read8(padapter, REG_BCN_CTRL);
 	pHalData->RegTxPause = rtw_read8(padapter, REG_TXPAUSE);
-- 
2.39.0

             reply	other threads:[~2026-07-25 12:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 12:53 Akhmad [this message]
2026-07-28  7:33 ` [PATCH] staging: rtl8723bs: replace magic numbers with named constants Greg KH
     [not found]   ` <CACCSLCopDTUV2G9JG8yCuRnUYaOvCeNY-SHEC+xzv3kOJ3S2eg@mail.gmail.com>
2026-07-28  8:38     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2026-06-03 14:31 Jad Keskes
2026-06-04 14:31 ` Dan Carpenter
2026-06-04 14:34   ` Dan Carpenter
2026-04-11  5:28 Adith-Joshua
2026-04-11  8:07 ` Dan Carpenter
2026-04-11 17:20   ` Luka Gejak
     [not found]   ` <CAFvcH2CjS=HMxt_Dd04eMAELQtxdB5LYmLa_1TLnJeEuKvR6=Q@mail.gmail.com>
2026-04-12 12:57     ` Dan Carpenter
     [not found]       ` <CAFvcH2DQJtB6B9L+SMgg_aPXGe96hw2i6+C1N0uhapHvJQHd2w@mail.gmail.com>
2026-04-13  5:41         ` Dan Carpenter
2026-04-11 17:15 ` Luka Gejak

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=20260725125314.39313-1-Akhmad100913@gmail.com \
    --to=akhmad100913@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-staging@lists.linux.dev \
    /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