Skip to contentSkip to conversation

: block/DAC960: remove sleep_on*() usage

PATCH In review [email protected] 1 participant 1 message Mar 5, 2005 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 13/15 : block/DAC960: remove sleep_on*() usage

Quoted 6 lines · Nishanth Aravamudan

Hi,

Quoted 1 line

Description: Use wait_event_interruptible_timeout() instead of the deprecated interruptible_sleep_on_timeout(). The existing code is complicated in the conditional and so is the new code. Patch is compile-tested.

The following patch should be considered instead, as it removes completely callers of sleep_on*().

Thanks,
Nish

Use wait_event_interruptible_timeout() instead of the deprecated interruptible_sleep_on_timeout(). The existing code is complicated in the conditional and so is the new code. Also replace sleep_on_timeout() with direct wait-queue usage. Patch is compile-tested.

---

 kj-domen/drivers/block/DAC960.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
drivers/block/DAC960.c renamed from drivers/block/DAC960.c~wait_event_int_timeout-drivers_block_DAC960 +12 -10
diff -puN drivers/block/DAC960.c~wait_event_int_timeout-drivers_block_DAC960 drivers/block/DAC960.c
@@ -40,6 +40,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/wait.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include "DAC960.h"
@@ -6127,6 +6128,7 @@ static boolean DAC960_V2_TranslatePhysic
 static boolean DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
 					    unsigned char *UserCommand)
 {
+  DEFINE_WAIT(wait);
   DAC960_Command_T *Command;
   DAC960_V2_CommandMailbox_T *CommandMailbox;
   unsigned long flags;
@@ -6317,7 +6319,9 @@ static boolean DAC960_V2_ExecuteUserComm
 	  while (Controller->V2.NewControllerInformation->PhysicalScanActive)
 	    {
 	      DAC960_ExecuteCommand(Command);
-	      sleep_on_timeout(&Controller->CommandWaitQueue, HZ);
+	      prepare_to_wait(&Controller->CommandWaitQueue, &wait, TASK_UNINTERRUPTIBLE);
+	      schedule_timeout(HZ);
+	      finish_wait(&Controller->CommandWaitQueue, &wait);
 	    }
 	  DAC960_UserCritical("Discovery Completed\n", Controller);
  	}
@@ -6917,15 +6921,13 @@ static int DAC960_gam_ioctl(struct inode
 			   GetHealthStatus.HealthStatusBuffer,
 			   sizeof(DAC960_V2_HealthStatusBuffer_T)))
 		return -EFAULT;
-	while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
-	       == HealthStatusBuffer.StatusChangeCounter &&
-	       Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
-	       == HealthStatusBuffer.NextEventSequenceNumber)
-	  {
-	    interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
-					   DAC960_MonitoringTimerInterval);
-	    if (signal_pending(current)) return -EINTR;
-	  }
+	wait_event_interruptible_timeout(Controller->HealthStatusWaitQueue,
+			(Controller->V2.HealthStatusBuffer->StatusChangeCounter
+			 != HealthStatusBuffer.StatusChangeCounter ||
+			 Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
+			 != HealthStatusBuffer.NextEventSequenceNumber),
+			 DAC960_MonitoringTimerInterval);
+	if (signal_pending(current)) return -EINTR;
 	if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
 			 Controller->V2.HealthStatusBuffer,
 			 sizeof(DAC960_V2_HealthStatusBuffer_T)))

_