RE: [PATCH v2 7/9] wifi: rtw89: switch to using FIELD_GET_SIGNED()

From: Ping-Ke Shih

Date: Tue Apr 28 2026 - 20:42:32 EST


David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> On Tue, 28 Apr 2026 10:10:22 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
>
> > On Mon, Apr 27, 2026 at 05:41:24PM -0400, Yury Norov wrote:
> > > Switch from sign_extend32(FIELD_GET()) to the dedicated
> > > FIELD_GET_SIGNED() and don't calculate the fields length explicitly.
> >
> > ...
> >
> > > for (i = 0; i < ADDC_T_AVG; i++) {
> > > tmp = rtw89_phy_read32_mask(rtwdev, R_DBG32_D, MASKDWORD);
> > > - dc_re += sign_extend32(FIELD_GET(0xfff000, tmp), 11);
> > > - dc_im += sign_extend32(FIELD_GET(0xfff, tmp), 11);
> > > + dc_re += FIELD_GET_SIGNED(0xfff000, tmp);
> > > + dc_im += FIELD_GET_SIGNED(0xfff, tmp);
> >
> > In the same driver the GENMASK() is being used, why not doing it here while at it?
>
> To me those bit masks look more readable than the GENMASK() calls would be.

Either way is fine to me. As we rewrite these into rtw89, using GENMASK()
can be easier to check if vendor driver defines the masks correctly, no
overlap.

Ping-Ke