| From 02b8e0f5fecda5c255c965cae062b35fa77e236a Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Tue, 20 Jan 2026 12:07:54 -0800 |
| Subject: usb: bdc: fix sleep during atomic |
| |
| From: Justin Chen <justin.chen@broadcom.com> |
| |
| [ Upstream commit f1195ca3b4bbd001d3f1264dce91f83dec7777f5 ] |
| |
| bdc_run() can be ran during atomic context leading to a sleep during |
| atomic warning. Fix this by replacing read_poll_timeout() with |
| read_poll_timeout_atomic(). |
| |
| Fixes: 75ae051efc9b ("usb: gadget: bdc: use readl_poll_timeout() to simplify code") |
| Signed-off-by: Justin Chen <justin.chen@broadcom.com> |
| Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> |
| Link: https://patch.msgid.link/20260120200754.2488765-1-justin.chen@broadcom.com |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/usb/gadget/udc/bdc/bdc_core.c | 4 ++-- |
| 1 file changed, 2 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c |
| index fa1a3908ec3bb..69d11b703c8d0 100644 |
| --- a/drivers/usb/gadget/udc/bdc/bdc_core.c |
| +++ b/drivers/usb/gadget/udc/bdc/bdc_core.c |
| @@ -35,8 +35,8 @@ static int poll_oip(struct bdc *bdc, u32 usec) |
| u32 status; |
| int ret; |
| |
| - ret = readl_poll_timeout(bdc->regs + BDC_BDCSC, status, |
| - (BDC_CSTS(status) != BDC_OIP), 10, usec); |
| + ret = readl_poll_timeout_atomic(bdc->regs + BDC_BDCSC, status, |
| + (BDC_CSTS(status) != BDC_OIP), 10, usec); |
| if (ret) |
| dev_err(bdc->dev, "operation timedout BDCSC: 0x%08x\n", status); |
| else |
| -- |
| 2.51.0 |
| |