Skip to content

Commit 878bb77

Browse files
ajaykathatnoglitch
authored andcommitted
wilc1000: use wait_for_completion_interruptible_timeout for completion
The default driver implementation blocks the TXQ task until the upper layer posts Tx packet. If the interface is idle, the thread will be in waiting state forever which makes the kernel to think that the task is hung. Use wait_for_completion_interruptible_timeout() inplace of wait_for_completion_timeout() to solve this issue. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Sripad Balwadgi <Sripad.Balwadgi@microchip.com>
1 parent 86433d9 commit 878bb77

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

drivers/staging/wilc1000/netdev.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,23 @@ static int debug_thread(void *arg)
3737

3838
while (1) {
3939
int srcu_idx;
40+
int ret;
4041

4142
if (!wl->initialized && !kthread_should_stop()) {
4243
msleep(1000);
4344
continue;
4445
} else if (!wl->initialized) {
4546
break;
4647
}
47-
48-
if (wait_for_completion_timeout(&wl->debug_thread_started,
49-
msecs_to_jiffies(6000))) {
48+
ret = wait_for_completion_interruptible_timeout(
49+
&wl->debug_thread_started, msecs_to_jiffies(6000));
50+
if (ret > 0) {
5051
while (!kthread_should_stop())
5152
schedule();
5253
pr_info("Exit debug thread\n");
5354
return 0;
5455
}
55-
if (!debug_running)
56+
if (!debug_running || ret == -ERESTARTSYS)
5657
continue;
5758

5859
pr_debug("%s *** Debug Thread Running ***cnt[%d]\n", __func__,
@@ -393,7 +394,8 @@ static int wilc_txq_task(void *vp)
393394
struct net_device *ndev = vif->ndev;
394395

395396
PRINT_INFO(ndev, TX_DBG, "txq_task Taking a nap\n");
396-
wait_for_completion(&wl->txq_event);
397+
if (wait_for_completion_interruptible(&wl->txq_event))
398+
continue;
397399
PRINT_INFO(ndev, TX_DBG, "txq_task Who waked me up\n");
398400
if (wl->close) {
399401
complete(&wl->txq_thread_started);

0 commit comments

Comments
 (0)