Skip to content

Commit 9c552e1

Browse files
arndbaxboe
authored andcommitted
DAC960: remove sleep_on usage
sleep_on and its variants are going away. The use of sleep_on() in DAC960_V2_ExecuteUserCommand seems to be bogus because the command by the time we get there, the command has completed already and we just enter the timeout. Based on this interpretation, I concluded that we can replace it with a simple msleep(1000) and rearrange the code around it slightly. The interruptible_sleep_on_timeout in DAC960_gam_ioctl seems equivalent to the race-free version using wait_event_interruptible_timeout. I left the driver to return -EINTR rather than -ERESTARTSYS to preserve the timeout behavior. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent c94efe3 commit 9c552e1

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

‎drivers/block/DAC960.c‎

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6411,12 +6411,12 @@ static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
64116411
.ScatterGatherSegments[0]
64126412
.SegmentByteCount =
64136413
CommandMailbox->ControllerInfo.DataTransferSize;
6414-
DAC960_ExecuteCommand(Command);
6415-
while (Controller->V2.NewControllerInformation->PhysicalScanActive)
6416-
{
6417-
DAC960_ExecuteCommand(Command);
6418-
sleep_on_timeout(&Controller->CommandWaitQueue, HZ);
6419-
}
6414+
while (1) {
6415+
DAC960_ExecuteCommand(Command);
6416+
if (!Controller->V2.NewControllerInformation->PhysicalScanActive)
6417+
break;
6418+
msleep(1000);
6419+
}
64206420
DAC960_UserCritical("Discovery Completed\n", Controller);
64216421
}
64226422
}
@@ -7035,18 +7035,16 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
70357035
ErrorCode = -EFAULT;
70367036
break;
70377037
}
7038-
while (Controller->V2.HealthStatusBuffer->StatusChangeCounter
7039-
== HealthStatusBuffer.StatusChangeCounter &&
7040-
Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
7041-
== HealthStatusBuffer.NextEventSequenceNumber)
7042-
{
7043-
interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue,
7044-
DAC960_MonitoringTimerInterval);
7045-
if (signal_pending(current)) {
7046-
ErrorCode = -EINTR;
7047-
break;
7048-
}
7049-
}
7038+
ErrorCode = wait_event_interruptible_timeout(Controller->HealthStatusWaitQueue,
7039+
!(Controller->V2.HealthStatusBuffer->StatusChangeCounter
7040+
== HealthStatusBuffer.StatusChangeCounter &&
7041+
Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
7042+
== HealthStatusBuffer.NextEventSequenceNumber),
7043+
DAC960_MonitoringTimerInterval);
7044+
if (ErrorCode == -ERESTARTSYS) {
7045+
ErrorCode = -EINTR;
7046+
break;
7047+
}
70507048
if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
70517049
Controller->V2.HealthStatusBuffer,
70527050
sizeof(DAC960_V2_HealthStatusBuffer_T)))

0 commit comments

Comments
 (0)