Commit 860708d9 authored by Jason Cooper's avatar Jason Cooper Committed by Greg Kroah-Hartman

staging: brcm80211: remove kernel_thread() for dhd_watchdog_thread.

Replaced kernel_thread() with kthread_run().  Used kthread_should_stop()
in place of watchdog_exited completion.  Replaced watchdog_pid with
struct task_struct.

watchdog_tsk is NULL when the task is not running.
Signed-off-by: default avatarJason Cooper <jason@lakedaemon.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 839fad99
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -239,9 +240,8 @@ typedef struct dhd_info { ...@@ -239,9 +240,8 @@ typedef struct dhd_info {
/* Thread based operation */ /* Thread based operation */
bool threads_only; bool threads_only;
struct semaphore sdsem; struct semaphore sdsem;
long watchdog_pid; struct task_struct *watchdog_tsk;
struct semaphore watchdog_sem; struct semaphore watchdog_sem;
struct completion watchdog_exited;
long dpc_pid; long dpc_pid;
struct semaphore dpc_sem; struct semaphore dpc_sem;
struct completion dpc_exited; struct completion dpc_exited;
...@@ -1306,10 +1306,10 @@ static int dhd_watchdog_thread(void *data) ...@@ -1306,10 +1306,10 @@ static int dhd_watchdog_thread(void *data)
} }
#endif /* DHD_SCHED */ #endif /* DHD_SCHED */
DAEMONIZE("dhd_watchdog");
/* Run until signal received */ /* Run until signal received */
while (1) { while (1) {
if (kthread_should_stop())
break;
if (down_interruptible(&dhd->watchdog_sem) == 0) { if (down_interruptible(&dhd->watchdog_sem) == 0) {
if (dhd->pub.dongle_reset == FALSE) { if (dhd->pub.dongle_reset == FALSE) {
WAKE_LOCK(&dhd->pub, WAKE_LOCK_WATCHDOG); WAKE_LOCK(&dhd->pub, WAKE_LOCK_WATCHDOG);
...@@ -1324,14 +1324,14 @@ static int dhd_watchdog_thread(void *data) ...@@ -1324,14 +1324,14 @@ static int dhd_watchdog_thread(void *data)
} }
WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_WATCHDOG); WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_WATCHDOG);
complete_and_exit(&dhd->watchdog_exited, 0); return 0;
} }
static void dhd_watchdog(unsigned long data) static void dhd_watchdog(unsigned long data)
{ {
dhd_info_t *dhd = (dhd_info_t *) data; dhd_info_t *dhd = (dhd_info_t *) data;
if (dhd->watchdog_pid >= 0) { if (dhd->watchdog_tsk) {
up(&dhd->watchdog_sem); up(&dhd->watchdog_sem);
/* Reschedule the watchdog */ /* Reschedule the watchdog */
...@@ -2004,10 +2004,15 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) ...@@ -2004,10 +2004,15 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
if (dhd_dpc_prio >= 0) { if (dhd_dpc_prio >= 0) {
/* Initialize watchdog thread */ /* Initialize watchdog thread */
sema_init(&dhd->watchdog_sem, 0); sema_init(&dhd->watchdog_sem, 0);
init_completion(&dhd->watchdog_exited); dhd->watchdog_tsk = kthread_run(dhd_watchdog_thread, dhd,
dhd->watchdog_pid = kernel_thread(dhd_watchdog_thread, dhd, 0); "dhd_watchdog");
if (IS_ERR(dhd->watchdog_tsk)) {
printk(KERN_WARNING
"dhd_watchdog thread failed to start\n");
dhd->watchdog_tsk = NULL;
}
} else { } else {
dhd->watchdog_pid = -1; dhd->watchdog_tsk = NULL;
} }
/* Set up the bottom half handler */ /* Set up the bottom half handler */
...@@ -2334,9 +2339,9 @@ void dhd_detach(dhd_pub_t *dhdp) ...@@ -2334,9 +2339,9 @@ void dhd_detach(dhd_pub_t *dhdp)
unregister_netdev(ifp->net); unregister_netdev(ifp->net);
} }
if (dhd->watchdog_pid >= 0) { if (dhd->watchdog_tsk) {
KILL_PROC(dhd->watchdog_pid, SIGTERM); kthread_stop(dhd->watchdog_tsk);
wait_for_completion(&dhd->watchdog_exited); dhd->watchdog_tsk = NULL;
} }
if (dhd->dpc_pid >= 0) { if (dhd->dpc_pid >= 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment