staging: rtl8723bs: replace yield() with cond_resched()
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
@@ -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)
Greg KH
maintainerQuoted 7 lines · Akhmad
From: Akhmad Zubairugadzhiev <[email protected]>
Replace deprecated
yield()calls withcond_resched()inrtl8723b_hal_init.c. Theyield()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
Signed-off-by Akhmad Zubairugadzhiev <[email protected]>--- 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
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
Greg KH
maintainerQuoted 1 line · Ахмад Зубайругаджиев
Hi Greg,
Oops, again you top-posted and sent html email :(