Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: ehci-brcm: fix sleep during atomic
@ 2026-03-12 19:08 justin.chen
  2026-03-12 19:58 ` Florian Fainelli
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: justin.chen @ 2026-03-12 19:08 UTC (permalink / raw)
  To: linux-usb; +Cc: bcm-kernel-feedback-list, alcooperx, stern, gregkh, Justin Chen

From: Justin Chen <justin.chen@broadcom.com>

echi_brcm_wait_for_sof() gets called after disabling interrupts
in ehci_brcm_hub_control(). Use the atomic version of poll_timeout
to fix the warning.

Fixes: ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
---
 drivers/usb/host/ehci-brcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-brcm.c b/drivers/usb/host/ehci-brcm.c
index 888e8f6670d2..5e3156f94cc6 100644
--- a/drivers/usb/host/ehci-brcm.c
+++ b/drivers/usb/host/ehci-brcm.c
@@ -31,8 +31,8 @@ static inline void ehci_brcm_wait_for_sof(struct ehci_hcd *ehci, u32 delay)
 	int res;
 
 	/* Wait for next microframe (every 125 usecs) */
-	res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val,
-					 val != frame_idx, 1, 130);
+	res = readl_relaxed_poll_timeout_atomic(&ehci->regs->frame_index,
+						val, val != frame_idx, 1, 130);
 	if (res)
 		ehci_err(ehci, "Error waiting for SOF\n");
 	udelay(delay);
-- 
2.34.1


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

* Re: [PATCH] usb: ehci-brcm: fix sleep during atomic
  2026-03-12 19:08 [PATCH] usb: ehci-brcm: fix sleep during atomic justin.chen
@ 2026-03-12 19:58 ` Florian Fainelli
  2026-03-18 14:13 ` Greg KH
  2026-03-18 14:14 ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2026-03-12 19:58 UTC (permalink / raw)
  To: justin.chen, linux-usb; +Cc: bcm-kernel-feedback-list, alcooperx, stern, gregkh

On 3/12/26 12:08, justin.chen@broadcom.com wrote:
> From: Justin Chen <justin.chen@broadcom.com>
> 
> echi_brcm_wait_for_sof() gets called after disabling interrupts
> in ehci_brcm_hub_control(). Use the atomic version of poll_timeout
> to fix the warning.
> 
> Fixes: ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")
> Signed-off-by: Justin Chen <justin.chen@broadcom.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

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

* Re: [PATCH] usb: ehci-brcm: fix sleep during atomic
  2026-03-12 19:08 [PATCH] usb: ehci-brcm: fix sleep during atomic justin.chen
  2026-03-12 19:58 ` Florian Fainelli
@ 2026-03-18 14:13 ` Greg KH
  2026-03-18 14:14 ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-03-18 14:13 UTC (permalink / raw)
  To: justin.chen; +Cc: linux-usb, bcm-kernel-feedback-list, alcooperx, stern

On Thu, Mar 12, 2026 at 12:08:25PM -0700, justin.chen@broadcom.com wrote:
> From: Justin Chen <justin.chen@broadcom.com>
> 
> echi_brcm_wait_for_sof() gets called after disabling interrupts
> in ehci_brcm_hub_control(). Use the atomic version of poll_timeout
> to fix the warning.
> 
> Fixes: ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")

Can you resend this with the proper format for how Fixes: lines should
be?  It's in the documentation, otherwise our scripts will reject this.

thanks,

greg k-h

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

* Re: [PATCH] usb: ehci-brcm: fix sleep during atomic
  2026-03-12 19:08 [PATCH] usb: ehci-brcm: fix sleep during atomic justin.chen
  2026-03-12 19:58 ` Florian Fainelli
  2026-03-18 14:13 ` Greg KH
@ 2026-03-18 14:14 ` Greg KH
  2026-03-18 16:31   ` Justin Chen
  2 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2026-03-18 14:14 UTC (permalink / raw)
  To: justin.chen; +Cc: linux-usb, bcm-kernel-feedback-list, alcooperx, stern

On Thu, Mar 12, 2026 at 12:08:25PM -0700, justin.chen@broadcom.com wrote:
> From: Justin Chen <justin.chen@broadcom.com>
> 
> echi_brcm_wait_for_sof() gets called after disabling interrupts
> in ehci_brcm_hub_control(). Use the atomic version of poll_timeout
> to fix the warning.
> 
> Fixes: ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")
> Signed-off-by: Justin Chen <justin.chen@broadcom.com>
> ---
>  drivers/usb/host/ehci-brcm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-brcm.c b/drivers/usb/host/ehci-brcm.c
> index 888e8f6670d2..5e3156f94cc6 100644
> --- a/drivers/usb/host/ehci-brcm.c
> +++ b/drivers/usb/host/ehci-brcm.c
> @@ -31,8 +31,8 @@ static inline void ehci_brcm_wait_for_sof(struct ehci_hcd *ehci, u32 delay)
>  	int res;
>  
>  	/* Wait for next microframe (every 125 usecs) */
> -	res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val,
> -					 val != frame_idx, 1, 130);
> +	res = readl_relaxed_poll_timeout_atomic(&ehci->regs->frame_index,
> +						val, val != frame_idx, 1, 130);
>  	if (res)
>  		ehci_err(ehci, "Error waiting for SOF\n");
>  	udelay(delay);
> -- 
> 2.34.1
> 
> 

Why is something that has been around for so long just now suddenly
being seen?  What changed to trigger this?

thanks,

greg k-h

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

* Re: [PATCH] usb: ehci-brcm: fix sleep during atomic
  2026-03-18 14:14 ` Greg KH
@ 2026-03-18 16:31   ` Justin Chen
  2026-03-20 17:27     ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Justin Chen @ 2026-03-18 16:31 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, bcm-kernel-feedback-list, alcooperx, stern



On 3/18/2026 7:14 AM, Greg KH wrote:
> On Thu, Mar 12, 2026 at 12:08:25PM -0700, justin.chen@broadcom.com wrote:
>> From: Justin Chen <justin.chen@broadcom.com>
>>
>> echi_brcm_wait_for_sof() gets called after disabling interrupts
>> in ehci_brcm_hub_control(). Use the atomic version of poll_timeout
>> to fix the warning.
>>
>> Fixes: ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")
>> Signed-off-by: Justin Chen <justin.chen@broadcom.com>
>> ---
>>   drivers/usb/host/ehci-brcm.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-brcm.c b/drivers/usb/host/ehci-brcm.c
>> index 888e8f6670d2..5e3156f94cc6 100644
>> --- a/drivers/usb/host/ehci-brcm.c
>> +++ b/drivers/usb/host/ehci-brcm.c
>> @@ -31,8 +31,8 @@ static inline void ehci_brcm_wait_for_sof(struct ehci_hcd *ehci, u32 delay)
>>   	int res;
>>   
>>   	/* Wait for next microframe (every 125 usecs) */
>> -	res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val,
>> -					 val != frame_idx, 1, 130);
>> +	res = readl_relaxed_poll_timeout_atomic(&ehci->regs->frame_index,
>> +						val, val != frame_idx, 1, 130);
>>   	if (res)
>>   		ehci_err(ehci, "Error waiting for SOF\n");
>>   	udelay(delay);
>> -- 
>> 2.34.1
>>
>>
> 
> Why is something that has been around for so long just now suddenly
> being seen?  What changed to trigger this?
> 

The edge case occurs in rare occasions and predates my time maintaining 
this driver. So we just so happened to run into it recently in our 
tests. Guess in the past we just never hit the edge case with the 
warnings enabled. I had the same question when the warning was reported.

Will fix the Fixes tag in v2.

Thanks,
Justin

> thanks,
> 
> greg k-h


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

* Re: [PATCH] usb: ehci-brcm: fix sleep during atomic
  2026-03-18 16:31   ` Justin Chen
@ 2026-03-20 17:27     ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2026-03-20 17:27 UTC (permalink / raw)
  To: Justin Chen, Greg KH
  Cc: linux-usb, bcm-kernel-feedback-list, alcooperx, stern

On 3/18/26 09:31, Justin Chen wrote:
> 
> 
> On 3/18/2026 7:14 AM, Greg KH wrote:
>> On Thu, Mar 12, 2026 at 12:08:25PM -0700, justin.chen@broadcom.com wrote:
>>> From: Justin Chen <justin.chen@broadcom.com>
>>>
>>> echi_brcm_wait_for_sof() gets called after disabling interrupts
>>> in ehci_brcm_hub_control(). Use the atomic version of poll_timeout
>>> to fix the warning.
>>>
>>> Fixes: ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB 
>>> SoC's")
>>> Signed-off-by: Justin Chen <justin.chen@broadcom.com>
>>> ---
>>>   drivers/usb/host/ehci-brcm.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/usb/host/ehci-brcm.c b/drivers/usb/host/ehci-brcm.c
>>> index 888e8f6670d2..5e3156f94cc6 100644
>>> --- a/drivers/usb/host/ehci-brcm.c
>>> +++ b/drivers/usb/host/ehci-brcm.c
>>> @@ -31,8 +31,8 @@ static inline void ehci_brcm_wait_for_sof(struct 
>>> ehci_hcd *ehci, u32 delay)
>>>       int res;
>>>       /* Wait for next microframe (every 125 usecs) */
>>> -    res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val,
>>> -                     val != frame_idx, 1, 130);
>>> +    res = readl_relaxed_poll_timeout_atomic(&ehci->regs->frame_index,
>>> +                        val, val != frame_idx, 1, 130);
>>>       if (res)
>>>           ehci_err(ehci, "Error waiting for SOF\n");
>>>       udelay(delay);
>>> -- 
>>> 2.34.1
>>>
>>>
>>
>> Why is something that has been around for so long just now suddenly
>> being seen?  What changed to trigger this?
>>
> 
> The edge case occurs in rare occasions and predates my time maintaining 
> this driver. So we just so happened to run into it recently in our 
> tests. Guess in the past we just never hit the edge case with the 
> warnings enabled. I had the same question when the warning was reported.
> 
> Will fix the Fixes tag in v2.

The other thing is that recently enabled CONFIG_DEBUG_SLEEP_ATOMIC in 
our builds which is how this got caught, it was not the case before.
-- 
Florian

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

end of thread, other threads:[~2026-03-20 17:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 19:08 [PATCH] usb: ehci-brcm: fix sleep during atomic justin.chen
2026-03-12 19:58 ` Florian Fainelli
2026-03-18 14:13 ` Greg KH
2026-03-18 14:14 ` Greg KH
2026-03-18 16:31   ` Justin Chen
2026-03-20 17:27     ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox