Revert "char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol"

This reverts commit be826ada52.

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 c1986ee9be ("[PATCH] New Omnikey Cardman
4000 driver") works fine.

Fixes: be826ada52 ("char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20230118141000.5580-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Duoming Zhou 2023-01-18 22:10:00 +08:00 committed by Greg Kroah-Hartman
parent af35dbad4a
commit 70fae37a09

View File

@ -529,7 +529,8 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
DEBUGP(5, dev, "NumRecBytes is valid\n");
break;
}
usleep_range(10000, 11000);
/* can not sleep as this is in atomic context */
mdelay(10);
}
if (i == 100) {
DEBUGP(5, dev, "Timeout waiting for NumRecBytes getting "
@ -549,7 +550,8 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)
}
break;
}
usleep_range(10000, 11000);
/* can not sleep as this is in atomic context */
mdelay(10);
}
/* check whether it is a short PTS reply? */