diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-15 14:48:32 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:01:48 -0700 |
commit | 54411c425fe0f5f8a5fcc1f3098693419ae87306 (patch) | |
tree | 9a230b556dd3e5390f0cd1e4397e3b63e415ede3 /drivers/staging/hv/Channel.c | |
parent | 8c69f52ab3d918be9d91c8202e5321421876ea50 (diff) |
Staging: hv: make Channel->InboundLock a real spinlock
Don't use the wrapper functions for this lock, make it a real
lock so that we know what is going on.
I don't think we really want to be doing a irqsave for this code, but I
left it alone to preserve the original codepath. It should be reviewed
later.
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv/Channel.c')
-rw-r--r-- | drivers/staging/hv/Channel.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index de6d2cfa824..757aba60fd6 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -991,18 +991,19 @@ VmbusChannelRecvPacket( u32 packetLen; u32 userLen; int ret; + unsigned long flags; DPRINT_ENTER(VMBUS); *BufferActualLen = 0; *RequestId = 0; - SpinlockAcquire(Channel->InboundLock); + spin_lock_irqsave(&Channel->inbound_lock, flags); ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(VMPACKET_DESCRIPTOR)); if (ret != 0) { - SpinlockRelease(Channel->InboundLock); + spin_unlock_irqrestore(&Channel->inbound_lock, flags); //DPRINT_DBG(VMBUS, "nothing to read!!"); DPRINT_EXIT(VMBUS); @@ -1026,7 +1027,7 @@ VmbusChannelRecvPacket( if (userLen > BufferLen) { - SpinlockRelease(Channel->InboundLock); + spin_unlock_irqrestore(&Channel->inbound_lock, flags); DPRINT_ERR(VMBUS, "buffer too small - got %d needs %d", BufferLen, userLen); DPRINT_EXIT(VMBUS); @@ -1039,7 +1040,7 @@ VmbusChannelRecvPacket( // Copy over the packet to the user buffer ret = RingBufferRead(&Channel->Inbound, Buffer, userLen, (desc.DataOffset8 << 3)); - SpinlockRelease(Channel->InboundLock); + spin_unlock_irqrestore(&Channel->inbound_lock, flags); DPRINT_EXIT(VMBUS); @@ -1068,18 +1069,19 @@ VmbusChannelRecvPacketRaw( u32 packetLen; u32 userLen; int ret; + unsigned long flags; DPRINT_ENTER(VMBUS); *BufferActualLen = 0; *RequestId = 0; - SpinlockAcquire(Channel->InboundLock); + spin_lock_irqsave(&Channel->inbound_lock, flags); ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(VMPACKET_DESCRIPTOR)); if (ret != 0) { - SpinlockRelease(Channel->InboundLock); + spin_unlock_irqrestore(&Channel->inbound_lock, flags); //DPRINT_DBG(VMBUS, "nothing to read!!"); DPRINT_EXIT(VMBUS); @@ -1102,7 +1104,7 @@ VmbusChannelRecvPacketRaw( if (packetLen > BufferLen) { - SpinlockRelease(Channel->InboundLock); + spin_unlock_irqrestore(&Channel->inbound_lock, flags); DPRINT_ERR(VMBUS, "buffer too small - needed %d bytes but got space for only %d bytes", packetLen, BufferLen); DPRINT_EXIT(VMBUS); @@ -1114,7 +1116,7 @@ VmbusChannelRecvPacketRaw( // Copy over the entire packet to the user buffer ret = RingBufferRead(&Channel->Inbound, Buffer, packetLen, 0); - SpinlockRelease(Channel->InboundLock); + spin_unlock_irqrestore(&Channel->inbound_lock, flags); DPRINT_EXIT(VMBUS); |