Skip to contentSkip to conversation

w1/w1: remove interruptible_sleep_on_timeout()

PATCH In review Nishanth Aravamudan 1 participant 1 message Feb 2, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/20 w1/w1: remove interruptible_sleep_on_timeout()

Hello,

Please consider applying.

Description: Replace deprecated interruptible_sleep_on_timeout() with direct wait-queue usage. Ideally, I would use wait_event_interruptible_timeout(); however, there is no condition to sleep on here, unless I was to use the try_to_freeze() call as one. That is not the case in the current code, though, and I'm not sure it can/should be. Since timeout is a jiffies-unit variable, change the type to unsigned long. Patch is compile-tested.

drivers/w1/w1.c +11 -3
@@ -32,6 +32,7 @@
 #include <linux/device.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
+#include <linux/wait.h>
 
 #include "w1.h"
 #include "w1_io.h"
@@ -646,10 +647,12 @@ void w1_destroy_master_attributes(struct
 
 int w1_control(void *data)
 {
+	DEFINE_WAIT(wait);
 	struct w1_slave *sl;
 	struct w1_master *dev;
 	struct list_head *ent, *ment, *n, *mn;
-	int err, have_to_wait = 0, timeout;
+	int err, have_to_wait = 0;
+	unsigned long timeout;
 
 	daemonize("w1_control");
 	allow_signal(SIGTERM);
@@ -659,7 +662,9 @@ int w1_control(void *data)
 
 		timeout = w1_timeout*HZ;
 		do {
-			timeout = interruptible_sleep_on_timeout(&w1_control_wait, timeout);
+			prepare_to_wait(&w1_control_wait, &wait, TASK_INTERRUPTIBLE);
+			timeout = schedule_timeout(timeout);
+			finish_wait(&w1_control_wait, &wait);
 			try_to_freeze(PF_FREEZE);
 		} while (!signal_pending(current) && (timeout > 0));
 
@@ -720,6 +725,7 @@ int w1_control(void *data)
 
 int w1_process(void *data)
 {
+	DEFINE_WAIT(wait);
 	struct w1_master *dev = (struct w1_master *) data;
 	unsigned long timeout;
 	struct list_head *ent, *n;
@@ -731,7 +737,9 @@ int w1_process(void *data)
 	while (!dev->need_exit) {
 		timeout = w1_timeout*HZ;
 		do {
-			timeout = interruptible_sleep_on_timeout(&dev->kwait, timeout);
+			prepare_to_wait(&w1_control_wait, &wait, TASK_INTERRUPTIBLE);
+			timeout = schedule_timeout(timeout);
+			finish_wait(&w1_control_wait, &wait);
 			try_to_freeze(PF_FREEZE);
 		} while (!signal_pending(current) && (timeout > 0));
 

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors