Skip to contentSkip to conversation

hwmon: (adt7470) No need for additional synchronization on kthread_stop()

PATCH Applied Daniel Wagner 2 participants 2 messages Sep 16, 2016 – Sep 18, 2016 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (adt7470) No need for additional synchronization on kthread_stop()

From: Daniel Wagner <[email protected]>

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").

Cc Darrick J. Wong <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>
---
 drivers/hwmon/adt7470.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/hwmon/adt7470.c +0 -4
index f5da39a..f5d618c 100644
@@ -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;
 }
 
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 5 lines · Daniel Wagner

From: Daniel Wagner <[email protected]>

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

Quoted 8 lines

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

Cc Darrick J. Wong <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>

Applied.

Thanks,
Guenter

Quoted 41 lines
---
 drivers/hwmon/adt7470.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/hwmon/adt7470.c +0 -4
index f5da39a..f5d618c 100644
@@ -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;
 }