public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Anders Roxell <anders.roxell@linaro.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: miriam.rachel.korenblit@intel.com, dan.carpenter@linaro.org,
	arnd@arndb.de, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linux Kernel Functional Testing <lkft@linaro.org>
Subject: Re: [PATCH] wifi: iwlwifi: pcie: ensure RX_QUEUE_CB_SIZE fits bitfield for gcc-8|9
Date: Thu, 12 Jun 2025 21:33:44 +0200	[thread overview]
Message-ID: <aEsrmH7sDVvsmgLs@monster> (raw)
In-Reply-To: <d2ea3f77ea2737aafc879f4fc291dee097867b61.camel@sipsolutions.net>

On 2025-06-12 17:21, Johannes Berg wrote:
> > 
> > diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
> > index cb36baac14da..1854d071aff2 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
> > @@ -204,9 +204,10 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans,
> >  
> >  	WARN_ON(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)) > 12);
> >  	control_flags = IWL_CTXT_INFO_TFD_FORMAT_LONG;
> > -	control_flags |=
> > -		u32_encode_bits(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)),
> > -				IWL_CTXT_INFO_RB_CB_SIZE);
> > +	/* This should just be u32_encode_bits() but gcc-8 and gcc-9 fail to build */
> > +	control_flags |= FIELD_PREP(IWL_CTXT_INFO_RB_CB_SIZE,
> > +		RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)) &
> > +		FIELD_MAX(IWL_CTXT_INFO_RB_CB_SIZE));
> > 
> 
> The coding style is really confusing now though - what are arguments to
> the macro and all that.

Would it help if I indent like this?

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
index cb36baac14da..5bb81ed7db79 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
@@ -204,9 +204,10 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans,
 
 	WARN_ON(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)) > 12);
 	control_flags = IWL_CTXT_INFO_TFD_FORMAT_LONG;
-	control_flags |=
-		u32_encode_bits(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)),
-				IWL_CTXT_INFO_RB_CB_SIZE);
+	/* This should just be u32_encode_bits() but gcc-8 and gcc-9 fail to build */
+	control_flags |= FIELD_PREP(IWL_CTXT_INFO_RB_CB_SIZE,
+				    RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)) &
+				    FIELD_MAX(IWL_CTXT_INFO_RB_CB_SIZE));
 	control_flags |= u32_encode_bits(rb_size, IWL_CTXT_INFO_RB_SIZE);
 	ctxt_info->control.control_flags = cpu_to_le32(control_flags);
 

Cheers,
Anders

  reply	other threads:[~2025-06-12 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 13:07 [PATCH] wifi: iwlwifi: pcie: ensure RX_QUEUE_CB_SIZE fits bitfield for gcc-8|9 Anders Roxell
2025-06-12 13:17 ` Dan Carpenter
2025-06-12 15:21 ` Johannes Berg
2025-06-12 19:33   ` Anders Roxell [this message]
2025-06-12 19:46     ` Johannes Berg
2025-06-12 19:48     ` Arnd Bergmann
2025-06-14  8:21     ` David Laight

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=aEsrmH7sDVvsmgLs@monster \
    --to=anders.roxell@linaro.org \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@linaro.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lkft@linaro.org \
    --cc=miriam.rachel.korenblit@intel.com \
    /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