OSDN Git Service

iio: adc: ina2xx: Make use of the helper macro kthread_run()
authorCai Huoqing <caihuoqing@baidu.com>
Thu, 21 Oct 2021 12:42:53 +0000 (20:42 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 17 Nov 2021 17:51:34 +0000 (17:51 +0000)
Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20211021124254.3247-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ina2xx-adc.c

index a4b2ff9..360d7a0 100644 (file)
@@ -842,15 +842,14 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev)
        dev_dbg(&indio_dev->dev, "Async readout mode: %d\n",
                chip->allow_async_readout);
 
-       task = kthread_create(ina2xx_capture_thread, (void *)indio_dev,
-                             "%s:%d-%uus", indio_dev->name,
-                             iio_device_id(indio_dev),
-                             sampling_us);
+       task = kthread_run(ina2xx_capture_thread, (void *)indio_dev,
+                          "%s:%d-%uus", indio_dev->name,
+                          iio_device_id(indio_dev),
+                          sampling_us);
        if (IS_ERR(task))
                return PTR_ERR(task);
 
        get_task_struct(task);
-       wake_up_process(task);
        chip->task = task;
 
        return 0;