Commit 9c552e1d authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jens Axboe

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: default avatarArnd Bergmann <arnd@arndb.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c94efe36
...@@ -6411,12 +6411,12 @@ static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller, ...@@ -6411,12 +6411,12 @@ static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller,
.ScatterGatherSegments[0] .ScatterGatherSegments[0]
.SegmentByteCount = .SegmentByteCount =
CommandMailbox->ControllerInfo.DataTransferSize; CommandMailbox->ControllerInfo.DataTransferSize;
DAC960_ExecuteCommand(Command); while (1) {
while (Controller->V2.NewControllerInformation->PhysicalScanActive) DAC960_ExecuteCommand(Command);
{ if (!Controller->V2.NewControllerInformation->PhysicalScanActive)
DAC960_ExecuteCommand(Command); break;
sleep_on_timeout(&Controller->CommandWaitQueue, HZ); msleep(1000);
} }
DAC960_UserCritical("Discovery Completed\n", Controller); DAC960_UserCritical("Discovery Completed\n", Controller);
} }
} }
...@@ -7035,18 +7035,16 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request, ...@@ -7035,18 +7035,16 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
ErrorCode = -EFAULT; ErrorCode = -EFAULT;
break; break;
} }
while (Controller->V2.HealthStatusBuffer->StatusChangeCounter ErrorCode = wait_event_interruptible_timeout(Controller->HealthStatusWaitQueue,
== HealthStatusBuffer.StatusChangeCounter && !(Controller->V2.HealthStatusBuffer->StatusChangeCounter
Controller->V2.HealthStatusBuffer->NextEventSequenceNumber == HealthStatusBuffer.StatusChangeCounter &&
== HealthStatusBuffer.NextEventSequenceNumber) Controller->V2.HealthStatusBuffer->NextEventSequenceNumber
{ == HealthStatusBuffer.NextEventSequenceNumber),
interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue, DAC960_MonitoringTimerInterval);
DAC960_MonitoringTimerInterval); if (ErrorCode == -ERESTARTSYS) {
if (signal_pending(current)) { ErrorCode = -EINTR;
ErrorCode = -EINTR; break;
break; }
}
}
if (copy_to_user(GetHealthStatus.HealthStatusBuffer, if (copy_to_user(GetHealthStatus.HealthStatusBuffer,
Controller->V2.HealthStatusBuffer, Controller->V2.HealthStatusBuffer,
sizeof(DAC960_V2_HealthStatusBuffer_T))) sizeof(DAC960_V2_HealthStatusBuffer_T)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment