usb: ehci-brcm: fix sleep during atomic
Subsystems (3)
[email protected]
maintainerPATCH 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.
--- drivers/usb/host/ehci-brcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-brcm.c +2 -2
@@ -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
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 inehci_brcm_hub_control(). Use the atomic version ofpoll_timeoutto fix the warning.Fixes ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")Signed-off-by Justin Chen <[email protected]>
Signature · 1 line
Florian
Greg KH
maintainerQuoted 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 inehci_brcm_hub_control(). Use the atomic version ofpoll_timeoutto 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
Greg KH
maintainerQuoted 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 inehci_brcm_hub_control(). Use the atomic version ofpoll_timeoutto fix the warning.Fixes ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")Signed-off-by Justin Chen <[email protected]>--- drivers/usb/host/ehci-brcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/ehci-brcm.c +2
-2@@ -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
Justin Chen
maintainerQuoted 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 inehci_brcm_hub_control(). Use the atomic version ofpoll_timeoutto fix the warning.Fixes ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")Signed-off-by Justin Chen <[email protected]>--- drivers/usb/host/ehci-brcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/ehci-brcm.c +0
-0@@ -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.1Why 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
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 inehci_brcm_hub_control(). Use the atomic version ofpoll_timeoutto fix the warning.Fixes ("9df231511bd6 usb: ehci: Add new EHCI driver for Broadcom STB SoC's")Signed-off-by Justin Chen <[email protected]>---
drivers/usb/host/ehci-brcm.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/host/ehci-brcm.c +2
-2@@ -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
-0udelay(delay);Signature · 1 line
2.34.1Why 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