All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace yield() with cond_resched()
@ 2026-07-25 18:18 Akhmad
  2026-07-28  7:34 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Akhmad @ 2026-07-25 18:18 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, Akhmad Zubairugadzhiev

From: Akhmad Zubairugadzhiev <Akhmad100913@gmail.com>

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.

Signed-off-by: Akhmad Zubairugadzhiev <Akhmad100913@gmail.com>
---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index bcaf63b28..6fc3774d2 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -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)) {
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8723bs: replace yield() with cond_resched()
  2026-07-25 18:18 [PATCH] staging: rtl8723bs: replace yield() with cond_resched() Akhmad
@ 2026-07-28  7:34 ` Greg KH
       [not found]   ` <CACCSLCqsJM81O1=zq-GrQEd625JBFOAoPHvqeYRJ35u4YD=mAw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2026-07-28  7:34 UTC (permalink / raw)
  To: Akhmad; +Cc: linux-staging

On Sat, Jul 25, 2026 at 09:18:37PM +0300, Akhmad wrote:
> From: Akhmad Zubairugadzhiev <Akhmad100913@gmail.com>
> 
> 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?

> 
> Signed-off-by: Akhmad Zubairugadzhiev <Akhmad100913@gmail.com>
> ---
>  drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> index bcaf63b28..6fc3774d2 100644
> --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8723bs: replace yield() with cond_resched()
       [not found]   ` <CACCSLCqsJM81O1=zq-GrQEd625JBFOAoPHvqeYRJ35u4YD=mAw@mail.gmail.com>
@ 2026-07-28  8:39     ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-07-28  8:39 UTC (permalink / raw)
  To: Ахмад Зубайругаджиев
  Cc: linux-staging

On Tue, Jul 28, 2026 at 11:22:55AM +0300, Ахмад Зубайругаджиев wrote:
> Hi Greg,

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-28  8:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25 18:18 [PATCH] staging: rtl8723bs: replace yield() with cond_resched() Akhmad
2026-07-28  7:34 ` Greg KH
     [not found]   ` <CACCSLCqsJM81O1=zq-GrQEd625JBFOAoPHvqeYRJ35u4YD=mAw@mail.gmail.com>
2026-07-28  8:39     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.