Re: [PATCH] iio: adc: ina2xx: Make use of the helper macro kthread_run()

From: Lars-Peter Clausen
Date: Thu Oct 21 2021 - 04:48:39 EST


On 10/21/21 10:39 AM, Cai Huoqing wrote:
Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@xxxxxxxxx>

Hi,

Thanks for the patch, this looks good!

Reviewed-by: Lars-Peter Clausen <lars@xxxxxxxxxx>

---
[...]
if (IS_ERR(task))
return PTR_ERR(task);
get_task_struct(task);

This is unrelated to this patch. But I wonder do we really need the get_task_struct()? The driver calls put_task_struct() right after kthread_stop().

kthread_create()/kthread_run() and kthread_stop() already do reference counting of the task, so we are essentially just double reference counting. Maybe you can send another patch to cleanup the get_task_struct()/put_task_struct() in this driver.

- wake_up_process(task);
chip->task = task;
return 0;