Thread (17 messages) 17 messages, 6 authors, 2026-04-29

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

From: David Laight <hidden>
Date: 2026-04-28 10:43:46
Also in: linux-iio, linux-rtc, linux-wireless, lkml

On Tue, 28 Apr 2026 10:10:22 +0300
Andy Shevchenko [off-list ref] wrote:
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.

	David
quoted
 	}  
...
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);
 	}  
Ditto, and it even looks like the same piece repeating twice in different
compilation units of the same driver...
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help