Skip to contentSkip to conversation

staging: rtl8723bs: replace yield() with cond_resched()

PATCH In review Akhmad 2 participants 3 messages Jul 25 – Jul 28 1 message not in the archive Staging

lore
Share & tools
lore

Akhmad

author
#0 lore raw

PATCH 1/1 staging: rtl8723bs: replace yield() with cond_resched()

From: Akhmad Zubairugadzhiev <[email protected]>

Replace deprecated yield() calls with cond_resched() in rtl8723b_hal_init.c. The yield() function is considered wrong practice in kernel code as it can lead to unexpected behavior. cond_resched() is the recommended replacement for conditional rescheduling in polling loops.

---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +2 -2
index bcaf63b28..6fc3774d2 100644
@@ -191,7 +191,7 @@ static s32 polling_fwdl_chksum(
 		value32 = rtw_read32(adapter, REG_MCUFWDL);
 		if (value32 & FWDL_ChkSum_rpt || adapter->bSurpriseRemoved || adapter->bDriverStopped)
 			break;
-		yield();
+		cond_resched();
 	} while (jiffies_to_msecs(jiffies-start) < timeout_ms || cnt < min_cnt);
 
 	if (!(value32 & FWDL_ChkSum_rpt)) {
@@ -232,7 +232,7 @@ static s32 _FWFreeToGo(struct adapter *adapter, u32 min_cnt, u32 timeout_ms)
 		value32 = rtw_read32(adapter, REG_MCUFWDL);
 		if (value32 & WINTINI_RDY || adapter->bSurpriseRemoved || adapter->bDriverStopped)
 			break;
-		yield();
+		cond_resched();
 	} while (jiffies_to_msecs(jiffies - start) < timeout_ms || cnt < min_cnt);
 
 	if (!(value32 & WINTINI_RDY)) {
Signature · 1 line
2.37.1 (Apple Git-137.1)
maintainer
#1 lore raw
Quoted 7 lines · Akhmad

From: Akhmad Zubairugadzhiev <[email protected]>

Replace deprecated yield() calls with cond_resched() in rtl8723b_hal_init.c. The yield() function is considered wrong practice in kernel code as it can lead to unexpected behavior. cond_resched() is the recommended replacement for conditional rescheduling in polling loops.

What "unexpected behavior" can happen here?

Quoted 11 lines
---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0 -0
index bcaf63b28..6fc3774d2 100644

drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c static s32 polling_fwdl_chksum( · line 194

Quoted 5 lines
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +1 -1
@@ -191,7 +191,7 @@ static s32 polling_fwdl_chksum(
 		value32 = rtw_read32(adapter, REG_MCUFWDL);
 		if (value32 & FWDL_ChkSum_rpt || adapter->bSurpriseRemoved || adapter->bDriverStopped)
 			break;
-		yield();
+		cond_resched();

Are you sure this is correct?

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CACCSLCqsJM81O1=zq-GrQEd625JBFOAoPHvqeYRJ35u4YD=mAw@mail.gmail.com

maintainer
#3 lore raw
Quoted 1 line · Ахмад Зубайругаджиев

Hi Greg,

Oops, again you top-posted and sent html email :(