From 4c7a5bb3885732bf4cd094bf7b7aefde30fe6c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Tue, 16 Dec 2014 13:35:53 +0100 Subject: [PATCH] wifi_drv: call schedule() in sleep functions The jiffies are only updated on each round of scheduling the runnable tasks. We have to schedule the current task that executes the sleep call to update the jiffies count and thereby preventing the task from entering an endless loop when using a statement like 'while (!time_after(jiffies, now + timeout)) { msleep(1); }'. Related to #1326. --- repos/dde_linux/src/lib/wifi/lxcc_emul.cc | 27 ++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc index 0ef7d26f1..e3487835d 100644 --- a/repos/dde_linux/src/lib/wifi/lxcc_emul.cc +++ b/repos/dde_linux/src/lib/wifi/lxcc_emul.cc @@ -1048,9 +1048,30 @@ int strict_strtoul(const char *s, unsigned int base, unsigned long *res) static Timer::Connection _timer; -void udelay(unsigned long usecs) { _timer.usleep(usecs); } -void usleep_range(unsigned long min, unsigned long max) { _timer.usleep(min); } -void msleep(unsigned int msecs) { _timer.msleep(msecs); } +void udelay(unsigned long usecs) +{ + _timer.usleep(usecs); + + Lx::scheduler().current()->schedule(); +} + + +void usleep_range(unsigned long min, unsigned long max) +{ + _timer.usleep(min); + + Lx::scheduler().current()->schedule(); +} + + +void msleep(unsigned int msecs) +{ + _timer.msleep(msecs); + + Lx::scheduler().current()->schedule(); +} + + void mdelay(unsigned long msecs) { msleep(msecs); }