All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (adt7470) No need for additional synchronization on kthread_stop()
@ 2016-09-16  8:07 Daniel Wagner
  2016-09-18 17:10 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Wagner @ 2016-09-16  8:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: Daniel Wagner, Darrick J . Wong, Jean Delvare, Guenter Roeck,
	linux-hwmon

From: Daniel Wagner <daniel.wagner@bmw-carit.de>

The kthread_stop() waits for the thread to exit. There is no need for an
additional synchronization needed to join on the kthread.

The completation was added by 89fac11cb3e7 ("adt7470: make automatic fan
control really work").

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
---
 drivers/hwmon/adt7470.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
index f5da39a..f5d618c 100644
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -170,7 +170,6 @@ struct adt7470_data {
 	u8			pwm_auto_temp[ADT7470_PWM_COUNT];
 
 	struct task_struct	*auto_update;
-	struct completion	auto_update_stop;
 	unsigned int		auto_update_interval;
 };
 
@@ -271,7 +270,6 @@ static int adt7470_update_thread(void *p)
 		msleep_interruptible(data->auto_update_interval);
 	}
 
-	complete_all(&data->auto_update_stop);
 	return 0;
 }
 
@@ -1256,7 +1254,6 @@ static int adt7470_probe(struct i2c_client *client,
 	if (IS_ERR(hwmon_dev))
 		return PTR_ERR(hwmon_dev);
 
-	init_completion(&data->auto_update_stop);
 	data->auto_update = kthread_run(adt7470_update_thread, client, "%s",
 					dev_name(hwmon_dev));
 	if (IS_ERR(data->auto_update)) {
@@ -1271,7 +1268,6 @@ static int adt7470_remove(struct i2c_client *client)
 	struct adt7470_data *data = i2c_get_clientdata(client);
 
 	kthread_stop(data->auto_update);
-	wait_for_completion(&data->auto_update_stop);
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: (adt7470) No need for additional synchronization on kthread_stop()
  2016-09-16  8:07 [PATCH] hwmon: (adt7470) No need for additional synchronization on kthread_stop() Daniel Wagner
@ 2016-09-18 17:10 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2016-09-18 17:10 UTC (permalink / raw)
  To: Daniel Wagner, linux-kernel
  Cc: Daniel Wagner, Darrick J . Wong, Jean Delvare, linux-hwmon

On 09/16/2016 01:07 AM, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@bmw-carit.de>
>
> The kthread_stop() waits for the thread to exit. There is no need for an
> additional synchronization needed to join on the kthread.
>
> The completation was added by 89fac11cb3e7 ("adt7470: make automatic fan
> control really work").
>
> Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
> Cc: Darrick J. Wong <djwong@us.ibm.com>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/adt7470.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index f5da39a..f5d618c 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
> @@ -170,7 +170,6 @@ struct adt7470_data {
>  	u8			pwm_auto_temp[ADT7470_PWM_COUNT];
>
>  	struct task_struct	*auto_update;
> -	struct completion	auto_update_stop;
>  	unsigned int		auto_update_interval;
>  };
>
> @@ -271,7 +270,6 @@ static int adt7470_update_thread(void *p)
>  		msleep_interruptible(data->auto_update_interval);
>  	}
>
> -	complete_all(&data->auto_update_stop);
>  	return 0;
>  }
>
> @@ -1256,7 +1254,6 @@ static int adt7470_probe(struct i2c_client *client,
>  	if (IS_ERR(hwmon_dev))
>  		return PTR_ERR(hwmon_dev);
>
> -	init_completion(&data->auto_update_stop);
>  	data->auto_update = kthread_run(adt7470_update_thread, client, "%s",
>  					dev_name(hwmon_dev));
>  	if (IS_ERR(data->auto_update)) {
> @@ -1271,7 +1268,6 @@ static int adt7470_remove(struct i2c_client *client)
>  	struct adt7470_data *data = i2c_get_clientdata(client);
>
>  	kthread_stop(data->auto_update);
> -	wait_for_completion(&data->auto_update_stop);
>  	return 0;
>  }
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-18 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16  8:07 [PATCH] hwmon: (adt7470) No need for additional synchronization on kthread_stop() Daniel Wagner
2016-09-18 17:10 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.