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

David Laight
2026-04-28T10:43:46Z

On Tue, 28 Apr 2026 10:10:22 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> 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.

David

>
> > }
>
> ...
>
> > 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);
> > }
>
> Ditto, and it even looks like the same piece repeating twice in different
> compilation units of the same driver...
>