Search Linux Wireless

Re: [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux