Skip to contentSkip to conversation

usb: ehci-brcm: fix sleep during atomic

PATCH Superseded [email protected] 3 participants 6 messages Mar 12 – Mar 20

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 usb: ehci-brcm: fix sleep during atomic

From: Justin Chen <[email protected]>

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")
---
 drivers/usb/host/ehci-brcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-brcm.c +2 -2
index 888e8f6670d2..5e3156f94cc6 100644
@@ -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);
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On 3/12/26 12:08, [email protected] wrote:

From: Justin Chen <[email protected]>

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")
Signature · 1 line
Florian
maintainer
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Thu, Mar 12, 2026 at 12:08:25PM -0700, [email protected] wrote:

From: Justin Chen <[email protected]>

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

maintainer
#3 lore raw
In reply to [email protected]
Quoted 31 lines · On Thu, Mar 12, 2026 at 12:08:25PM -0700, [email protected] wrote:

From: Justin Chen <[email protected]>

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")
---
 drivers/usb/host/ehci-brcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-brcm.c +2 -2
index 888e8f6670d2..5e3156f94cc6 100644
@@ -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);
Signature · 1 line
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

author maintainer
#4 lore raw
Quoted 20 lines · Greg KH
Quoted 19 lines · On Thu, Mar 12, 2026 at 12:08:25PM -0700, [email protected] wrote:

From: Justin Chen <[email protected]>

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")
---
  drivers/usb/host/ehci-brcm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-brcm.c +0 -0
index 888e8f6670d2..5e3156f94cc6 100644
@@ -31,8 +31,8 @@ static inline void ehci_brcm_wait_for_sof(struct ehci_hcd *ehci, u32 delay)
  	int res;
 
Quoted 16 lines
Quoted 12 lines
drivers/usb/host/ehci-brcm.c +2 -2
  	/* 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);
Signature · 1 line
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

Quoted 3 lines

thanks,

greg k-h

#5 lore raw
Quoted 40 lines · Justin Chen
Quoted 27 lines · Greg KH
Quoted 26 lines · On Thu, Mar 12, 2026 at 12:08:25PM -0700, [email protected] wrote:

From: Justin Chen <[email protected]>

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")

---
  drivers/usb/host/ehci-brcm.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-brcm.c +2 -2
index 888e8f6670d2..5e3156f94cc6 100644
@@ -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");
Quoted 9 lines
Quoted 5 lines
drivers/usb/host/ehci-brcm.c +0 -0
       udelay(delay);
Signature · 1 line
2.34.1

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

Quoted 3 lines

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.

Signature · 1 line
Florian