Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Arnd Bergmann and committed by
Jens Axboe
9c552e1d c94efe36

+16 -18
+16 -18
drivers/block/DAC960.c
··· 6411 6411 .ScatterGatherSegments[0] 6412 6412 .SegmentByteCount = 6413 6413 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 + } 6420 6420 DAC960_UserCritical("Discovery Completed\n", Controller); 6421 6421 } 6422 6422 } ··· 7035 7035 ErrorCode = -EFAULT; 7036 7036 break; 7037 7037 } 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 + } 7050 7048 if (copy_to_user(GetHealthStatus.HealthStatusBuffer, 7051 7049 Controller->V2.HealthStatusBuffer, 7052 7050 sizeof(DAC960_V2_HealthStatusBuffer_T)))