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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux