diff options
author | Arnd Bergmann <arnd@arndb.de> | 2014-02-26 06:01:43 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-03-13 16:56:38 -0400 |
commit | 9c552e1ddd3658944787d75d90a42e1a2b74b7ea (patch) | |
tree | 98601202f1367d58ec6a345fa24760fc8116e40f /drivers/block/DAC960.c | |
parent | c94efe36e283f2837dd4a21eab4b3f8492e3f325 (diff) |
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>
Diffstat (limited to 'drivers/block/DAC960.c')
-rw-r--r-- | drivers/block/DAC960.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index eb3950113e42..125d84505738 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -6411,12 +6411,12 @@ static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller, | |||
6411 | .ScatterGatherSegments[0] | 6411 | .ScatterGatherSegments[0] |
6412 | .SegmentByteCount = | 6412 | .SegmentByteCount = |
6413 | CommandMailbox->ControllerInfo.DataTransferSize; | 6413 | CommandMailbox->ControllerInfo.DataTransferSize; |
6414 | DAC960_ExecuteCommand(Command); | 6414 | while (1) { |
6415 | while (Controller->V2.NewControllerInformation->PhysicalScanActive) | 6415 | DAC960_ExecuteCommand(Command); |
6416 | { | 6416 | if (!Controller->V2.NewControllerInformation->PhysicalScanActive) |
6417 | DAC960_ExecuteCommand(Command); | 6417 | break; |
6418 | sleep_on_timeout(&Controller->CommandWaitQueue, HZ); | 6418 | msleep(1000); |
6419 | } | 6419 | } |
6420 | DAC960_UserCritical("Discovery Completed\n", Controller); | 6420 | DAC960_UserCritical("Discovery Completed\n", Controller); |
6421 | } | 6421 | } |
6422 | } | 6422 | } |
@@ -7035,18 +7035,16 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request, | |||
7035 | ErrorCode = -EFAULT; | 7035 | ErrorCode = -EFAULT; |
7036 | break; | 7036 | break; |
7037 | } | 7037 | } |
7038 | while (Controller->V2.HealthStatusBuffer->StatusChangeCounter | 7038 | ErrorCode = wait_event_interruptible_timeout(Controller->HealthStatusWaitQueue, |
7039 | == HealthStatusBuffer.StatusChangeCounter && | 7039 | !(Controller->V2.HealthStatusBuffer->StatusChangeCounter |
7040 | Controller->V2.HealthStatusBuffer->NextEventSequenceNumber | 7040 | == HealthStatusBuffer.StatusChangeCounter && |
7041 | == HealthStatusBuffer.NextEventSequenceNumber) | 7041 | Controller->V2.HealthStatusBuffer->NextEventSequenceNumber |
7042 | { | 7042 | == HealthStatusBuffer.NextEventSequenceNumber), |
7043 | interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue, | 7043 | DAC960_MonitoringTimerInterval); |
7044 | DAC960_MonitoringTimerInterval); | 7044 | if (ErrorCode == -ERESTARTSYS) { |
7045 | if (signal_pending(current)) { | 7045 | ErrorCode = -EINTR; |
7046 | ErrorCode = -EINTR; | 7046 | break; |
7047 | break; | 7047 | } |
7048 | } | ||
7049 | } | ||
7050 | if (copy_to_user(GetHealthStatus.HealthStatusBuffer, | 7048 | if (copy_to_user(GetHealthStatus.HealthStatusBuffer, |
7051 | Controller->V2.HealthStatusBuffer, | 7049 | Controller->V2.HealthStatusBuffer, |
7052 | sizeof(DAC960_V2_HealthStatusBuffer_T))) | 7050 | sizeof(DAC960_V2_HealthStatusBuffer_T))) |