public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: david laight <david.laight@runbox.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Navaneeth K <knavaneeth786@gmail.com>,
	gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] staging: rtl8723bs: replace FIELD_OFFSET usage with offsetof
Date: Mon, 24 Nov 2025 12:13:02 +0000	[thread overview]
Message-ID: <20251124121302.2d1988b6@pumpkin> (raw)
In-Reply-To: <aSQpSiazYpEquYS6@stanley.mountain>

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
> 


  reply	other threads:[~2025-11-24 12:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20251124121302.2d1988b6@pumpkin \
    --to=david.laight@runbox.com \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=knavaneeth786@gmail.com \
    --cc=linux-kernel@vger.kernel.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