From: David Laight <david.laight.linux@gmail.com>
To: Anders Roxell <anders.roxell@linaro.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
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: Sat, 14 Jun 2025 09:21:17 +0100 [thread overview]
Message-ID: <20250614092117.355e45c7@pumpkin> (raw)
In-Reply-To: <aEsrmH7sDVvsmgLs@monster>
On Thu, 12 Jun 2025 21:33:44 +0200
Anders Roxell <anders.roxell@linaro.org> wrote:
> 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));
I would always indent the 'continued' part of an arithmetic expression.
Otherwise it looks (in this case) like another argument to FIELD_PREP().
(Not helped by the coding style requiring the '&' on the end of the line
rather than the start of the continuation line.)
David
> control_flags |= u32_encode_bits(rb_size, IWL_CTXT_INFO_RB_SIZE);
> ctxt_info->control.control_flags = cpu_to_le32(control_flags);
>
>
> Cheers,
> Anders
>
prev parent reply other threads:[~2025-06-14 8:21 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
2025-06-12 19:46 ` Johannes Berg
2025-06-12 19:48 ` Arnd Bergmann
2025-06-14 8:21 ` David Laight [this message]
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=20250614092117.355e45c7@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=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