[PATCH 3/9] staging: brcm80211: remove kernel_thread() for dhd_watchdog_thread.

Jiri Slaby jirislaby at gmail.com
Thu Oct 7 09:42:00 UTC 2010


On 10/06/2010 11:40 PM, Jason Cooper wrote:
> --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
> +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
...
> @@ -2020,7 +2022,14 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
>  		/* Initialize watchdog thread */
>  		sema_init(&dhd->watchdog_sem, 0);
>  		init_completion(&dhd->watchdog_exited);
> -		dhd->watchdog_pid = kernel_thread(dhd_watchdog_thread, dhd, 0);
> +		tsk = kthread_run(dhd_watchdog_thread, dhd, "dhd_watchdog");

Great, so you should remove the daemonize crap now too.

> +		if (IS_ERR(tsk)) {
> +			printk(KERN_WARNING
> +				"dhd_watchdog thread failed to start\n");
> +			dhd->watchdog_pid = -1;
> +		} else {
> +			dhd->watchdog_pid = (long)get_pid(task_pid(tsk));

This looks very wrong:
1) you leak a pid reference,
2) you shouldn't need pid at all, you should use kthread_stop with
kthread_should_stop instead

And then you need no watchdog_exited completion.

regards,
-- 
js



More information about the devel mailing list