All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	Ping-Ke Shih <pkshih@realtek.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>
Subject: Re: [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking
Date: Fri, 21 Oct 2022 22:22:14 +0200	[thread overview]
Message-ID: <d23613213568545ec808599a33c04a2e77ac7889.camel@sipsolutions.net> (raw)
In-Reply-To: <c3540f87-b124-2642-f53e-aa15704a54e8@gmail.com>

On Fri, 2022-10-21 at 21:32 +0300, Bitterblue Smith wrote:
> > 
> > #define XTAL1 GENMASK(22, 17)
> > #define XTAL0 GENMASK(16, 11)
> > 
> > val32 &= ~(XTAL1 | XTAL2)
> > val32 |= FIELD_PREP(XTAL1, crystal_cap) |
> >          FIELD_PREP(XTAL0, crystal_cap);
> > 
> 
> Ah, so that's what FIELD_PREP does.

FWIW, personally, I've come to prefer u32_encode_bits() and friends, or,
in this case perhaps

	u32p_replace_bits(&val32, crystal_cap, XTAL0);
	u32p_replace_bits(&val32, crystal_cap, XTAL1);

or maybe writing that as

val32 &= ~(XTAL0 | XTAL1);
val32 |= u32_encode_bits(crystal_cap, XTAL0);
val32 |= u32_encode_bits(crystal_cap, XTAL1);

instead.

That's partially because there are also le32 variants of it etc. that
are simpler to use with endian-fixed firmware interfaces or similar.


But YMMV (as might that of the maintainers of this driver) :-)

johannes

  reply	other threads:[~2022-10-21 20:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 17:26 [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking Bitterblue Smith
2022-10-16 17:28 ` [PATCH 2/5] wifi: rtl8xxxu: Fix the CCK RSSI calculation Bitterblue Smith
2022-10-16 17:29 ` [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts Bitterblue Smith
2022-10-21  5:31   ` Ping-Ke Shih
2022-10-21 17:36     ` Bitterblue Smith
2022-10-16 17:30 ` [PATCH 4/5] wifi: rtl8xxxu: Set IEEE80211_HW_SUPPORT_FAST_XMIT Bitterblue Smith
2022-10-16 17:31 ` [PATCH 5/5] wifi: rtl8xxxu: Use dev_info instead of pr_info Bitterblue Smith
2022-10-21  5:47 ` [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking Ping-Ke Shih
2022-10-21 18:32   ` Bitterblue Smith
2022-10-21 20:22     ` Johannes Berg [this message]
2022-10-24  1:48     ` Ping-Ke Shih

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=d23613213568545ec808599a33c04a2e77ac7889.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=rtl8821cerfe2@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.