Skip to content

Commit

Permalink
virtio_scsi: Remove unused fExpectsInterrupt and its spinlock.
Browse files Browse the repository at this point in the history
The value is never actually checked. The use of a condition variable
makes it redundant since it will already either have a waiting entry,
or not.

Change-Id: Iafaecb7f9e56a2cf8932e05b82aad2b350fbce1f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1812
Reviewed-by: Jérôme Duval <[email protected]>
  • Loading branch information
mmlr authored and waddlesplash committed Sep 2, 2019
1 parent d2fecac commit 85fbdab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
13 changes: 1 addition & 12 deletions src/add-ons/kernel/busses/scsi/virtio/VirtioSCSIController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ VirtioSCSIController::VirtioSCSIController(device_node *node)
{
CALLED();

B_INITIALIZE_SPINLOCK(&fInterruptLock);
fInterruptCondition.Init(this, "virtio scsi transfer");

if (gSCSI->alloc_dpc(&fEventDPC) != B_OK)
Expand Down Expand Up @@ -231,23 +230,14 @@ VirtioSCSIController::ExecuteRequest(scsi_ccb *ccb)
}
fRequest->FillRequest(inCount, outCount, entries);

{
InterruptsSpinLocker locker(fInterruptLock);
fExpectsInterrupt = true;
fInterruptCondition.Add(&fInterruptConditionEntry);
}
fInterruptCondition.Add(&fInterruptConditionEntry);

fVirtio->queue_request_v(fRequestVirtioQueue, entries,
outCount, inCount, NULL);

result = fInterruptConditionEntry.Wait(B_RELATIVE_TIMEOUT,
fRequest->Timeout());

{
InterruptsSpinLocker locker(fInterruptLock);
fExpectsInterrupt = false;
}

if (result != B_OK)
return result;

Expand Down Expand Up @@ -295,7 +285,6 @@ VirtioSCSIController::_RequestCallback(void* driverCookie, void* cookie)
void
VirtioSCSIController::_RequestInterrupt()
{
SpinLocker locker(fInterruptLock);
fInterruptCondition.NotifyAll();
}

Expand Down
2 changes: 0 additions & 2 deletions src/add-ons/kernel/busses/scsi/virtio/VirtioSCSIPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ class VirtioSCSIController {

VirtioSCSIRequest* fRequest;

spinlock fInterruptLock;
ConditionVariable fInterruptCondition;
ConditionVariableEntry fInterruptConditionEntry;
bool fExpectsInterrupt;

scsi_dpc_cookie fEventDPC;
struct virtio_scsi_event fEventBuffers[VIRTIO_SCSI_NUM_EVENTS];
Expand Down

0 comments on commit 85fbdab

Please sign in to comment.