public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code
@ 2025-11-22 17:45 Navaneeth K
  2025-11-22 17:45 ` [PATCH 1/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro Navaneeth K
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Navaneeth K @ 2025-11-22 17:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Navaneeth K

This series performs cleanup on the rtl8723bs staging driver to align
with kernel coding standards.

The driver defined a custom macro `FIELD_OFFSET` which duplicated the
functionality of the standard `offsetof()` macro. This series replaces
all usages of the custom macro with the standard one and removes the
redundant definition.

Additionally, this series removes dead commented-out code in `odm.c`
that referenced unsupported chips (RTL8723A/RTL8188E).

All patches checkpatch clean.

Navaneeth K (5):
  staging: rtl8723bs: remove custom FIELD_OFFSET macro
  staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  staging: rtl8723bs: use standard offsetof in cfg80211 operations
  staging: rtl8723bs: remove dead code from odm.c
  staging: rtl8723bs: use offsetof in rtw_mlme_ext.c

 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c     | 4 ++--
 drivers/staging/rtl8723bs/hal/odm.c               | 4 ----
 drivers/staging/rtl8723bs/include/basic_types.h   | 3 +--
 drivers/staging/rtl8723bs/include/drv_types.h     | 4 ++--
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
 5 files changed, 7 insertions(+), 11 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro
  2025-11-22 17:45 [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code Navaneeth K
@ 2025-11-22 17:45 ` Navaneeth K
  2025-11-22 17:45 ` [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof Navaneeth K
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Navaneeth K @ 2025-11-22 17:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Navaneeth K

The driver defined a custom macro FIELD_OFFSET which duplicates the
standard functionality of the kernel's offsetof() macro.

Remove the custom definition to clean up the code and rely on
standard kernel macros.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
---
 drivers/staging/rtl8723bs/include/basic_types.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
index 1c2da18e6210..8adb95f9f1e5 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -12,8 +12,7 @@
 #define FAIL	(-1)
 
 #include <linux/types.h>
-
-#define FIELD_OFFSET(s, field)	((__kernel_ssize_t)&((s *)(0))->field)
+#include <linux/stddef.h>
 
 #define SIZE_PTR __kernel_size_t
 #define SSIZE_PTR __kernel_ssize_t
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  2025-11-22 17:45 [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code Navaneeth K
  2025-11-22 17:45 ` [PATCH 1/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro Navaneeth K
@ 2025-11-22 17:45 ` Navaneeth K
  2025-11-24  8:08   ` Dan Carpenter
  2025-11-22 17:45 ` [PATCH 3/5] staging: rtl8723bs: use standard offsetof in cfg80211 operations Navaneeth K
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Navaneeth K @ 2025-11-22 17:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Navaneeth K

Replace usage of the custom FIELD_OFFSET macro with the standard
offsetof() macro in drv_types.h. This improves code readability and
standardization.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
---
 drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index dd9018aa4ee5..47cabf8707f6 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -173,9 +173,9 @@ struct registry_priv {
 
 
 /* For registry parameters */
-#define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
+#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))
 #define RGTRY_SZ(field)   sizeof(((struct registry_priv *)0)->field)
-#define BSSID_OFT(field) ((u32)FIELD_OFFSET(struct wlan_bssid_ex, field))
+#define BSSID_OFT(field) ((u32)offsetof(struct wlan_bssid_ex, field))
 #define BSSID_SZ(field)   sizeof(((struct wlan_bssid_ex *) 0)->field)
 
 #include <drv_types_sdio.h>
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] staging: rtl8723bs: use standard offsetof in cfg80211 operations
  2025-11-22 17:45 [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code Navaneeth K
  2025-11-22 17:45 ` [PATCH 1/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro Navaneeth K
  2025-11-22 17:45 ` [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof Navaneeth K
@ 2025-11-22 17:45 ` Navaneeth K
  2025-11-22 17:45 ` [PATCH 4/5] staging: rtl8723bs: remove dead code from odm.c Navaneeth K
  2025-11-22 17:45 ` [PATCH 5/5] staging: rtl8723bs: use offsetof in rtw_mlme_ext.c Navaneeth K
  4 siblings, 0 replies; 12+ messages in thread
From: Navaneeth K @ 2025-11-22 17:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Navaneeth K

Replace usage of the custom FIELD_OFFSET macro with the standard
offsetof() macro in ioctl_cfg80211.c.

This resolves coding style issues and standardizes
memory offset calculations.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 315bab373729..784c9ebf6f9c 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1712,7 +1712,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
 
 		if (wep_key_len > 0) {
 			wep_key_len = wep_key_len <= 5 ? 5 : 13;
-			wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
+			wep_total_len = wep_key_len +
+					offsetof(struct ndis_802_11_wep, key_material);
 			pwep = rtw_malloc(wep_total_len);
 			if (!pwep) {
 				ret = -ENOMEM;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] staging: rtl8723bs: remove dead code from odm.c
  2025-11-22 17:45 [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code Navaneeth K
                   ` (2 preceding siblings ...)
  2025-11-22 17:45 ` [PATCH 3/5] staging: rtl8723bs: use standard offsetof in cfg80211 operations Navaneeth K
@ 2025-11-22 17:45 ` Navaneeth K
  2025-11-24  8:11   ` Dan Carpenter
  2025-11-22 17:45 ` [PATCH 5/5] staging: rtl8723bs: use offsetof in rtw_mlme_ext.c Navaneeth K
  4 siblings, 1 reply; 12+ messages in thread
From: Navaneeth K @ 2025-11-22 17:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Navaneeth K

Remove commented-out code references to RTL8723A and RTL8188E which
are not supported by this driver. This cleans up the source file and
improves readability.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
---
 drivers/staging/rtl8723bs/hal/odm.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c
index 4b36af47f680..08ed38b2a563 100644
--- a/drivers/staging/rtl8723bs/hal/odm.c
+++ b/drivers/staging/rtl8723bs/hal/odm.c
@@ -610,10 +610,6 @@ void ODM_DMWatchdog(struct dm_odm_t *pDM_Odm)
 	/* NeilChen--2012--08--24-- */
 	/* Fix Leave LPS issue */
 	if ((adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) /*  in LPS mode */
-		/*  */
-		/* (pDM_Odm->SupportICType & (ODM_RTL8723A))|| */
-		/* (pDM_Odm->SupportICType & (ODM_RTL8188E) &&(&&(((pDM_Odm->SupportInterface  == ODM_ITRF_SDIO))) */
-		/*  */
 	) {
 			odm_DIGbyRSSI_LPS(pDM_Odm);
 	} else
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] staging: rtl8723bs: use offsetof in rtw_mlme_ext.c
  2025-11-22 17:45 [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code Navaneeth K
                   ` (3 preceding siblings ...)
  2025-11-22 17:45 ` [PATCH 4/5] staging: rtl8723bs: remove dead code from odm.c Navaneeth K
@ 2025-11-22 17:45 ` Navaneeth K
  4 siblings, 0 replies; 12+ messages in thread
From: Navaneeth K @ 2025-11-22 17:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Navaneeth K

Replace the custom FIELD_OFFSET macro with the standard offsetof()
macro during the BSSID copy operation.

Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index a897c433d2b0..9372b997fc23 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5275,7 +5275,7 @@ u8 createbss_hdl(struct adapter *padapter, u8 *pbuf)
 		/* clear CAM */
 		flush_all_cam_entry(padapter);
 
-		memcpy(pnetwork, pbuf, FIELD_OFFSET(struct wlan_bssid_ex, ie_length));
+		memcpy(pnetwork, pbuf, offsetof(struct wlan_bssid_ex, ie_length));
 		pnetwork->ie_length = ((struct wlan_bssid_ex *)pbuf)->ie_length;
 
 		if (pnetwork->ie_length > MAX_IE_SZ)/* Check pbuf->ie_length */
@@ -5339,7 +5339,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf)
 	/* pmlmeinfo->assoc_AP_vendor = HT_IOT_PEER_MAX; */
 	pmlmeinfo->VHT_enable = 0;
 
-	memcpy(pnetwork, pbuf, FIELD_OFFSET(struct wlan_bssid_ex, ie_length));
+	memcpy(pnetwork, pbuf, offsetof(struct wlan_bssid_ex, ie_length));
 	pnetwork->ie_length = ((struct wlan_bssid_ex *)pbuf)->ie_length;
 
 	if (pnetwork->ie_length > MAX_IE_SZ)/* Check pbuf->ie_length */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  2025-11-22 17:45 ` [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof Navaneeth K
@ 2025-11-24  8:08   ` Dan Carpenter
  2025-11-24  9:17     ` david laight
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Carpenter @ 2025-11-24  8:08 UTC (permalink / raw)
  To: Navaneeth K; +Cc: gregkh, linux-staging, linux-kernel

On Sat, Nov 22, 2025 at 05:45:52PM +0000, Navaneeth K wrote:
> Replace usage of the custom FIELD_OFFSET macro with the standard
> offsetof() macro in drv_types.h. This improves code readability and
> standardization.
> 
> Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
> ---
>  drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> index dd9018aa4ee5..47cabf8707f6 100644
> --- a/drivers/staging/rtl8723bs/include/drv_types.h
> +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> @@ -173,9 +173,9 @@ struct registry_priv {
>  
>  
>  /* For registry parameters */
> -#define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
> +#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))

These casts to u32 are bogus garbage.  Delete them.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/5] staging: rtl8723bs: remove dead code from odm.c
  2025-11-22 17:45 ` [PATCH 4/5] staging: rtl8723bs: remove dead code from odm.c Navaneeth K
@ 2025-11-24  8:11   ` Dan Carpenter
  0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2025-11-24  8:11 UTC (permalink / raw)
  To: Navaneeth K; +Cc: gregkh, linux-staging, linux-kernel

On Sat, Nov 22, 2025 at 05:45:54PM +0000, Navaneeth K wrote:
> Remove commented-out code references to RTL8723A and RTL8188E which
> are not supported by this driver. This cleans up the source file and
> improves readability.
> 
> Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
> ---
>  drivers/staging/rtl8723bs/hal/odm.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/odm.c b/drivers/staging/rtl8723bs/hal/odm.c
> index 4b36af47f680..08ed38b2a563 100644
> --- a/drivers/staging/rtl8723bs/hal/odm.c
> +++ b/drivers/staging/rtl8723bs/hal/odm.c
> @@ -610,10 +610,6 @@ void ODM_DMWatchdog(struct dm_odm_t *pDM_Odm)
>  	/* NeilChen--2012--08--24-- */
>  	/* Fix Leave LPS issue */
>  	if ((adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) /*  in LPS mode */
> -		/*  */
> -		/* (pDM_Odm->SupportICType & (ODM_RTL8723A))|| */
> -		/* (pDM_Odm->SupportICType & (ODM_RTL8188E) &&(&&(((pDM_Odm->SupportInterface  == ODM_ITRF_SDIO))) */
> -		/*  */
>  	) {

When you're breaking things up into One Thing Per Patch, these bits
were part of the condition so it's allowed to move the ") {" to the
earlier line.  It's part of fixing the condition.

regards,
dan carpenter

>  			odm_DIGbyRSSI_LPS(pDM_Odm);
>  	} else
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  2025-11-24  8:08   ` Dan Carpenter
@ 2025-11-24  9:17     ` david laight
  2025-11-24  9:45       ` Dan Carpenter
  0 siblings, 1 reply; 12+ messages in thread
From: david laight @ 2025-11-24  9:17 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Navaneeth K, gregkh, linux-staging, linux-kernel

On Mon, 24 Nov 2025 11:08:35 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> On Sat, Nov 22, 2025 at 05:45:52PM +0000, Navaneeth K wrote:
> > Replace usage of the custom FIELD_OFFSET macro with the standard
> > offsetof() macro in drv_types.h. This improves code readability and
> > standardization.
> > 
> > Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > index dd9018aa4ee5..47cabf8707f6 100644
> > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > @@ -173,9 +173,9 @@ struct registry_priv {
> >  
> >  
> >  /* For registry parameters */
> > -#define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
> > +#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))  
> 
> These casts to u32 are bogus garbage.  Delete them.

Dunno - they might be needed (or have been needed) to stop min()
complaining about type mismatch.
They can also stop expressions being evaluated as 64bit (on 64bit)
which may reduce code size.
But that is a bit subtle...

	David


> 
> regards,
> dan carpenter
> 
> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  2025-11-24  9:17     ` david laight
@ 2025-11-24  9:45       ` Dan Carpenter
  2025-11-24 12:13         ` david laight
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Carpenter @ 2025-11-24  9:45 UTC (permalink / raw)
  To: david laight; +Cc: Navaneeth K, gregkh, linux-staging, linux-kernel

On Mon, Nov 24, 2025 at 09:17:54AM +0000, david laight wrote:
> On Mon, 24 Nov 2025 11:08:35 +0300
> Dan Carpenter <dan.carpenter@linaro.org> wrote:
> 
> > On Sat, Nov 22, 2025 at 05:45:52PM +0000, Navaneeth K wrote:
> > > Replace usage of the custom FIELD_OFFSET macro with the standard
> > > offsetof() macro in drv_types.h. This improves code readability and
> > > standardization.
> > > 
> > > Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
> > > ---
> > >  drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > > index dd9018aa4ee5..47cabf8707f6 100644
> > > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > > @@ -173,9 +173,9 @@ struct registry_priv {
> > >  
> > >  
> > >  /* For registry parameters */
> > > -#define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
> > > +#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))  
> > 
> > These casts to u32 are bogus garbage.  Delete them.
> 
> Dunno - they might be needed (or have been needed) to stop min()
> complaining about type mismatch.
> They can also stop expressions being evaluated as 64bit (on 64bit)
> which may reduce code size.
> But that is a bit subtle...

Actually the macros are unused.  Just delete them entirely.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  2025-11-24  9:45       ` Dan Carpenter
@ 2025-11-24 12:13         ` david laight
  2025-11-24 13:07           ` Navaneeth K
  0 siblings, 1 reply; 12+ messages in thread
From: david laight @ 2025-11-24 12:13 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Navaneeth K, gregkh, linux-staging, linux-kernel

On Mon, 24 Nov 2025 12:45:46 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> On Mon, Nov 24, 2025 at 09:17:54AM +0000, david laight wrote:
> > On Mon, 24 Nov 2025 11:08:35 +0300
> > Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >   
> > > On Sat, Nov 22, 2025 at 05:45:52PM +0000, Navaneeth K wrote:  
> > > > Replace usage of the custom FIELD_OFFSET macro with the standard
> > > > offsetof() macro in drv_types.h. This improves code readability and
> > > > standardization.
> > > > 
> > > > Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
> > > > ---
> > > >  drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > > > index dd9018aa4ee5..47cabf8707f6 100644
> > > > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > > > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > > > @@ -173,9 +173,9 @@ struct registry_priv {
> > > >  
> > > >  
> > > >  /* For registry parameters */
> > > > -#define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
> > > > +#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))    
> > > 
> > > These casts to u32 are bogus garbage.  Delete them.  
> > 
> > Dunno - they might be needed (or have been needed) to stop min()
> > complaining about type mismatch.
> > They can also stop expressions being evaluated as 64bit (on 64bit)
> > which may reduce code size.
> > But that is a bit subtle...  
> 
> Actually the macros are unused.  Just delete them entirely.

Sounds good to me :-)

> 
> regards,
> dan carpenter
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
  2025-11-24 12:13         ` david laight
@ 2025-11-24 13:07           ` Navaneeth K
  0 siblings, 0 replies; 12+ messages in thread
From: Navaneeth K @ 2025-11-24 13:07 UTC (permalink / raw)
  To: david laight, Dan Carpenter; +Cc: gregkh, linux-staging, linux-kernel

Hi Dan, Hi David,

Thanks for the clarification.

I’ll remove the unused macro entirely in v2 instead of adjusting the cast.

Regards,
Navaneeth K

On 24-11-2025 17:43, david laight wrote:
> On Mon, 24 Nov 2025 12:45:46 +0300
> Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
>> On Mon, Nov 24, 2025 at 09:17:54AM +0000, david laight wrote:
>>> On Mon, 24 Nov 2025 11:08:35 +0300
>>> Dan Carpenter <dan.carpenter@linaro.org> wrote:
>>>    
>>>> On Sat, Nov 22, 2025 at 05:45:52PM +0000, Navaneeth K wrote:
>>>>> Replace usage of the custom FIELD_OFFSET macro with the standard
>>>>> offsetof() macro in drv_types.h. This improves code readability and
>>>>> standardization.
>>>>>
>>>>> Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
>>>>> ---
>>>>>   drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
>>>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
>>>>> index dd9018aa4ee5..47cabf8707f6 100644
>>>>> --- a/drivers/staging/rtl8723bs/include/drv_types.h
>>>>> +++ b/drivers/staging/rtl8723bs/include/drv_types.h
>>>>> @@ -173,9 +173,9 @@ struct registry_priv {
>>>>>   
>>>>>   
>>>>>   /* For registry parameters */
>>>>> -#define RGTRY_OFT(field) ((u32)FIELD_OFFSET(struct registry_priv, field))
>>>>> +#define RGTRY_OFT(field) ((u32)offsetof(struct registry_priv, field))
>>>> These casts to u32 are bogus garbage.  Delete them.
>>> Dunno - they might be needed (or have been needed) to stop min()
>>> complaining about type mismatch.
>>> They can also stop expressions being evaluated as 64bit (on 64bit)
>>> which may reduce code size.
>>> But that is a bit subtle...
>> Actually the macros are unused.  Just delete them entirely.
> Sounds good to me :-)
>
>> regards,
>> dan carpenter
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-11-24 13:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22 17:45 [PATCH 0/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro and dead code Navaneeth K
2025-11-22 17:45 ` [PATCH 1/5] staging: rtl8723bs: remove custom FIELD_OFFSET macro Navaneeth K
2025-11-22 17:45 ` [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof Navaneeth K
2025-11-24  8:08   ` Dan Carpenter
2025-11-24  9:17     ` david laight
2025-11-24  9:45       ` Dan Carpenter
2025-11-24 12:13         ` david laight
2025-11-24 13:07           ` Navaneeth K
2025-11-22 17:45 ` [PATCH 3/5] staging: rtl8723bs: use standard offsetof in cfg80211 operations Navaneeth K
2025-11-22 17:45 ` [PATCH 4/5] staging: rtl8723bs: remove dead code from odm.c Navaneeth K
2025-11-24  8:11   ` Dan Carpenter
2025-11-22 17:45 ` [PATCH 5/5] staging: rtl8723bs: use offsetof in rtw_mlme_ext.c Navaneeth K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox