[PATCH 188/641] Staging: hv: osd: remove MemFree wrapper

Greg Kroah-Hartman gregkh at suse.de
Tue Sep 15 19:06:59 UTC 2009


Use the "real" kfree call instead of a wrapper function.

Cc: Hank Janssen <hjanssen at microsoft.com>
Cc: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
---
 drivers/staging/hv/Channel.c     |    8 ++++----
 drivers/staging/hv/ChannelMgmt.c |   14 +++++++-------
 drivers/staging/hv/Connection.c  |    6 +++---
 drivers/staging/hv/Hv.c          |    4 ++--
 drivers/staging/hv/NetVsc.c      |   12 ++++++------
 drivers/staging/hv/RndisFilter.c |    8 ++++----
 drivers/staging/hv/StorVsc.c     |    2 +-
 drivers/staging/hv/include/osd.h |    1 -
 drivers/staging/hv/osd.c         |    5 -----
 9 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c
index 9818ecb..de6d2cf 100644
--- a/drivers/staging/hv/Channel.c
+++ b/drivers/staging/hv/Channel.c
@@ -311,7 +311,7 @@ Cleanup:
 	SpinlockRelease(gVmbusConnection.ChannelMsgLock);
 
 	WaitEventClose(openInfo->WaitEvent);
-	MemFree(openInfo);
+	kfree(openInfo);
 
 	DPRINT_EXIT(VMBUS);
 
@@ -597,7 +597,7 @@ Cleanup:
 	SpinlockRelease(gVmbusConnection.ChannelMsgLock);
 
 	WaitEventClose(msgInfo->WaitEvent);
-	MemFree(msgInfo);
+	kfree(msgInfo);
 
 	DPRINT_EXIT(VMBUS);
 
@@ -658,7 +658,7 @@ VmbusChannelTeardownGpadl(
 	SpinlockRelease(gVmbusConnection.ChannelMsgLock);
 
 	WaitEventClose(info->WaitEvent);
-	MemFree(info);
+	kfree(info);
 
 	DPRINT_EXIT(VMBUS);
 
@@ -720,7 +720,7 @@ VmbusChannelClose(
 
 	PageFree(Channel->RingBufferPages, Channel->RingBufferPageCount);
 
-	MemFree(info);
+	kfree(info);
 
 	// If we are closing the channel during an error path in opening the channel, don't free the channel
 	// since the caller will free the channel
diff --git a/drivers/staging/hv/ChannelMgmt.c b/drivers/staging/hv/ChannelMgmt.c
index 44bc61e..a19ff89 100644
--- a/drivers/staging/hv/ChannelMgmt.c
+++ b/drivers/staging/hv/ChannelMgmt.c
@@ -152,7 +152,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void)
 	channel->InboundLock = SpinlockCreate();
 	if (!channel->InboundLock)
 	{
-		MemFree(channel);
+		kfree(channel);
 		return NULL;
 	}
 
@@ -160,7 +160,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void)
 	if (!channel->PollTimer)
 	{
 		SpinlockClose(channel->InboundLock);
-		MemFree(channel);
+		kfree(channel);
 		return NULL;
 	}
 
@@ -170,7 +170,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void)
 	{
 		TimerClose(channel->PollTimer);
 		SpinlockClose(channel->InboundLock);
-		MemFree(channel);
+		kfree(channel);
 		return NULL;
 	}
 
@@ -196,7 +196,7 @@ static inline void ReleaseVmbusChannel(void* Context)
 	WorkQueueClose(channel->ControlWQ);
 	DPRINT_DBG(VMBUS, "channel released (%p)", channel);
 
-	MemFree(channel);
+	kfree(channel);
 
 	DPRINT_EXIT(VMBUS);
 }
@@ -691,7 +691,7 @@ VmbusOnChannelMessage(
 	{
 		DPRINT_ERR(VMBUS, "Received invalid channel message type %d size %d", hdr->MessageType, size);
 		PrintBytes((unsigned char *)msg->u.Payload, size);
-		MemFree(msg);
+		kfree(msg);
 		return;
 	}
 
@@ -705,7 +705,7 @@ VmbusOnChannelMessage(
 	}
 
 	// Free the msg that was allocated in VmbusOnMsgDPC()
-	MemFree(msg);
+	kfree(msg);
 	DPRINT_EXIT(VMBUS);
 }
 
@@ -764,7 +764,7 @@ Cleanup:
 	if (msgInfo)
 	{
 		WaitEventClose(msgInfo->WaitEvent);
-		MemFree(msgInfo);
+		kfree(msgInfo);
 	}
 
 	DPRINT_EXIT(VMBUS);
diff --git a/drivers/staging/hv/Connection.c b/drivers/staging/hv/Connection.c
index 6a3229b..6f78351 100644
--- a/drivers/staging/hv/Connection.c
+++ b/drivers/staging/hv/Connection.c
@@ -145,7 +145,7 @@ VmbusConnect(
 
 
 	WaitEventClose(msgInfo->WaitEvent);
-	MemFree(msgInfo);
+	kfree(msgInfo);
 	DPRINT_EXIT(VMBUS);
 
 	return 0;
@@ -175,7 +175,7 @@ Cleanup:
 		if (msgInfo->WaitEvent)
 			WaitEventClose(msgInfo->WaitEvent);
 
-		MemFree(msgInfo);
+		kfree(msgInfo);
 	}
 
 	DPRINT_EXIT(VMBUS);
@@ -233,7 +233,7 @@ VmbusDisconnect(
 Cleanup:
 	if (msg)
 	{
-		MemFree(msg);
+		kfree(msg);
 	}
 
 	DPRINT_EXIT(VMBUS);
diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
index 5ac9006..9ef3a02 100644
--- a/drivers/staging/hv/Hv.c
+++ b/drivers/staging/hv/Hv.c
@@ -361,7 +361,7 @@ HvCleanup (
 
 	if (gHvContext.SignalEventBuffer)
 	{
-		MemFree(gHvContext.SignalEventBuffer);
+		kfree(gHvContext.SignalEventBuffer);
 		gHvContext.SignalEventBuffer = NULL;
 		gHvContext.SignalEventParam = NULL;
 	}
@@ -430,7 +430,7 @@ HvPostMessage(
 
 	status = HvDoHypercall(HvCallPostMessage, alignedMsg, 0) & 0xFFFF;
 
-	MemFree((void*)addr);
+	kfree((void*)addr);
 
 	return status;
 }
diff --git a/drivers/staging/hv/NetVsc.c b/drivers/staging/hv/NetVsc.c
index 3fb44cd..a915599 100644
--- a/drivers/staging/hv/NetVsc.c
+++ b/drivers/staging/hv/NetVsc.c
@@ -139,7 +139,7 @@ static inline void FreeNetDevice(NETVSC_DEVICE *Device)
 {
 	ASSERT(Device->RefCount == 0);
 	Device->Device->Extension = NULL;
-	MemFree(Device);
+	kfree(Device);
 }
 
 
@@ -563,7 +563,7 @@ NetVscDestroyReceiveBuffer(
 
 	if (NetDevice->ReceiveSections)
 	{
-		MemFree(NetDevice->ReceiveSections);
+		kfree(NetDevice->ReceiveSections);
 		NetDevice->ReceiveSections = NULL;
 		NetDevice->ReceiveSectionCount = 0;
 	}
@@ -873,7 +873,7 @@ Cleanup:
 		{
 			entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList);
 			packet = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry);
-			MemFree(packet);
+			kfree(packet);
 		}
 
 		SpinlockClose(netDevice->ReceivePacketListLock);
@@ -949,7 +949,7 @@ NetVscOnDeviceRemove(
 		entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList);
 		netvscPacket = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry);
 
-		MemFree(netvscPacket);
+		kfree(netvscPacket);
 	}
 
 	SpinlockClose(netDevice->ReceivePacketListLock);
@@ -1456,7 +1456,7 @@ NetVscOnChannelCallback(
 				// reset
 				if (bufferlen > netPacketSize)
 				{
-					MemFree(buffer);
+					kfree(buffer);
 
 					buffer = packet;
 					bufferlen = netPacketSize;
@@ -1469,7 +1469,7 @@ NetVscOnChannelCallback(
 				// reset
 				if (bufferlen > netPacketSize)
 				{
-					MemFree(buffer);
+					kfree(buffer);
 
 					buffer = packet;
 					bufferlen = netPacketSize;
diff --git a/drivers/staging/hv/RndisFilter.c b/drivers/staging/hv/RndisFilter.c
index ac810e2..bc5557a 100644
--- a/drivers/staging/hv/RndisFilter.c
+++ b/drivers/staging/hv/RndisFilter.c
@@ -219,7 +219,7 @@ static inline RNDIS_DEVICE* GetRndisDevice(void)
 	device->RequestLock = SpinlockCreate();
 	if (!device->RequestLock)
 	{
-		MemFree(device);
+		kfree(device);
 		return NULL;
 	}
 
@@ -233,7 +233,7 @@ static inline RNDIS_DEVICE* GetRndisDevice(void)
 static inline void PutRndisDevice(RNDIS_DEVICE *Device)
 {
 	SpinlockClose(Device->RequestLock);
-	MemFree(Device);
+	kfree(Device);
 }
 
 static inline RNDIS_REQUEST* GetRndisRequest(RNDIS_DEVICE *Device, u32 MessageType, u32 MessageLength)
@@ -251,7 +251,7 @@ static inline RNDIS_REQUEST* GetRndisRequest(RNDIS_DEVICE *Device, u32 MessageTy
 	request->WaitEvent = WaitEventCreate();
 	if (!request->WaitEvent)
 	{
-		MemFree(request);
+		kfree(request);
 		return NULL;
 	}
 
@@ -279,7 +279,7 @@ static inline void PutRndisRequest(RNDIS_DEVICE *Device, RNDIS_REQUEST *Request)
 	SpinlockRelease(Device->RequestLock);
 
 	WaitEventClose(Request->WaitEvent);
-	MemFree(Request);
+	kfree(Request);
 }
 
 static inline void DumpRndisMessage(RNDIS_MESSAGE *RndisMessage)
diff --git a/drivers/staging/hv/StorVsc.c b/drivers/staging/hv/StorVsc.c
index 502d1d2..2cf4963 100644
--- a/drivers/staging/hv/StorVsc.c
+++ b/drivers/staging/hv/StorVsc.c
@@ -164,7 +164,7 @@ static inline STORVSC_DEVICE* AllocStorDevice(DEVICE_OBJECT *Device)
 static inline void FreeStorDevice(STORVSC_DEVICE *Device)
 {
 	ASSERT(Device->RefCount == 0);
-	MemFree(Device);
+	kfree(Device);
 }
 
 // Get the stordevice object iff exists and its refcount > 1
diff --git a/drivers/staging/hv/include/osd.h b/drivers/staging/hv/include/osd.h
index 586e888..1ec7609 100644
--- a/drivers/staging/hv/include/osd.h
+++ b/drivers/staging/hv/include/osd.h
@@ -121,7 +121,6 @@ extern void PageFree(void* page, unsigned int count);
 extern void* MemMapIO(unsigned long phys, unsigned long size);
 extern void MemUnmapIO(void* virt);
 
-extern void MemFree(void* buf);
 extern void MemoryFence(void);
 
 extern HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context);
diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c
index 7a90c37..cdd5300 100644
--- a/drivers/staging/hv/osd.c
+++ b/drivers/staging/hv/osd.c
@@ -189,11 +189,6 @@ void PageUnmapVirtualAddress(void* VirtAddr)
 	kunmap_atomic(VirtAddr, KM_IRQ0);
 }
 
-void MemFree(void* buf)
-{
-	kfree(buf);
-}
-
 void *MemMapIO(unsigned long phys, unsigned long size)
 {
 #if X2V_LINUX
-- 
1.6.4.2




More information about the devel mailing list