All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Revert "char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol"
@ 2022-11-28  5:39 Duoming Zhou
  2022-12-18 11:43 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Duoming Zhou @ 2022-11-28  5:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: laforge, arnd, gregkh, linux, baijiaju1990, Duoming Zhou

This reverts commit be826ada52f1fcabed5b5217c94609ebf5967211.

The function monitor_card() is a timer handler that runs in an
atomic context, but it calls usleep_range() that can sleep.
As a result, the sleep-in-atomic-context bugs will happen.
The process is shown below:

    (atomic context)
monitor_card()
  set_protocol()
    usleep_range() //sleep

The origin commit c1986ee9bea3 ("[PATCH] New Omnikey Cardman
4000 driver") works fine.

Fixes: be826ada52f1 ("char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
---
 drivers/char/pcmcia/cm4000_cs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index adaec8fd4b1..7125f89531f 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -529,7 +529,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
 			DEBUGP(5, dev, "NumRecBytes is valid\n");
 			break;
 		}
-		usleep_range(10000, 11000);
+		mdelay(10);
 	}
 	if (i == 100) {
 		DEBUGP(5, dev, "Timeout waiting for NumRecBytes getting "
@@ -549,7 +549,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
 			}
 			break;
 		}
-		usleep_range(10000, 11000);
+		mdelay(10);
 	}
 
 	/* check whether it is a short PTS reply? */
-- 
2.17.1


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

end of thread, other threads:[~2022-12-18 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-28  5:39 [PATCH] Revert "char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol" Duoming Zhou
2022-12-18 11:43 ` Greg KH
2022-12-18 13:11   ` duoming

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.