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

Andy Shevchenko
2026-04-28T07:10:33Z

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?

> }

...

> 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...

--
With Best Regards,
Andy Shevchenko