RE: [PATCH v2 7/9] wifi: rtw89: switch to using FIELD_GET_SIGNED()
From: Ping-Ke Shih <pkshih@realtek.com>
Date: 2026-04-29 00:41:46
Also in:
linux-iio, linux-rtc, linux-wireless, lkml
From: Ping-Ke Shih <pkshih@realtek.com>
Date: 2026-04-29 00:41:46
Also in:
linux-iio, linux-rtc, linux-wireless, lkml
David Laight [off-list ref] wrote:
On Tue, 28 Apr 2026 10:10:22 +0300 Andy Shevchenko [off-list ref] wrote:quoted
On Mon, Apr 27, 2026 at 05:41:24PM -0400, Yury Norov wrote:quoted
Switch from sign_extend32(FIELD_GET()) to the dedicated FIELD_GET_SIGNED() and don't calculate the fields length explicitly....quoted
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