diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2009-09-11 21:46:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:02:04 -0700 |
commit | 53af545b277508d6b4829e90546cbd1beef536a9 (patch) | |
tree | 8aebf104347e90679873a18799900e8dddb1f5d7 /drivers/staging/hv/ChannelMgmt.c | |
parent | d29274efb73735c6a94f20214b1e4ea994da8848 (diff) | |
download | op-kernel-dev-53af545b277508d6b4829e90546cbd1beef536a9.zip op-kernel-dev-53af545b277508d6b4829e90546cbd1beef536a9.tar.gz |
Staging: hv: remove more usages of internal list routines
The hv driver has it's own linked list routines. This removes them
from more places in hv.
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
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/ChannelMgmt.c')
-rw-r--r-- | drivers/staging/hv/ChannelMgmt.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/drivers/staging/hv/ChannelMgmt.c b/drivers/staging/hv/ChannelMgmt.c index 4a014ea..3db62ca 100644 --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -20,6 +20,7 @@ */ #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/list.h> #include "osd.h" #include "logging.h" #include "VmbusPrivate.h" @@ -136,8 +137,6 @@ static void VmbusChannelProcessOffer(void *context) { struct vmbus_channel *newChannel = context; struct vmbus_channel *channel; - LIST_ENTRY *anchor; - LIST_ENTRY *curr; bool fNew = true; int ret; unsigned long flags; @@ -147,10 +146,7 @@ static void VmbusChannelProcessOffer(void *context) /* Make sure this is a new offer */ spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList) { - channel = CONTAINING_RECORD(curr, struct vmbus_channel, - ListEntry); - + list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, &newChannel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)) && @@ -163,8 +159,8 @@ static void VmbusChannelProcessOffer(void *context) } if (fNew) - INSERT_TAIL_LIST(&gVmbusConnection.ChannelList, - &newChannel->ListEntry); + list_add_tail(&newChannel->ListEntry, + &gVmbusConnection.ChannelList); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); @@ -201,7 +197,7 @@ static void VmbusChannelProcessOffer(void *context) newChannel->OfferMsg.ChildRelId); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - REMOVE_ENTRY_LIST(&newChannel->ListEntry); + list_del(&newChannel->ListEntry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); FreeVmbusChannel(newChannel); @@ -360,8 +356,7 @@ static void VmbusChannelOnOffersDelivered( static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr) { struct vmbus_channel_open_result *result; - LIST_ENTRY *anchor; - LIST_ENTRY *curr; + struct list_head *curr; struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_open_channel *openMsg; @@ -377,7 +372,8 @@ static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr) */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) { + list_for_each(curr, &gVmbusConnection.ChannelMsgList) { +/* FIXME: this should probably use list_entry() instead */ msgInfo = (struct vmbus_channel_msginfo *)curr; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; @@ -408,8 +404,7 @@ static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr) static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr) { struct vmbus_channel_gpadl_created *gpadlCreated; - LIST_ENTRY *anchor; - LIST_ENTRY *curr; + struct list_head *curr; struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_gpadl_header *gpadlHeader; @@ -427,7 +422,8 @@ static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr) */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) { + list_for_each(curr, &gVmbusConnection.ChannelMsgList) { +/* FIXME: this should probably use list_entry() instead */ msgInfo = (struct vmbus_channel_msginfo *)curr; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; @@ -461,8 +457,7 @@ static void VmbusChannelOnGpadlTorndown( struct vmbus_channel_message_header *hdr) { struct vmbus_channel_gpadl_torndown *gpadlTorndown; - LIST_ENTRY *anchor; - LIST_ENTRY *curr; + struct list_head *curr; struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_gpadl_teardown *gpadlTeardown; @@ -477,7 +472,8 @@ static void VmbusChannelOnGpadlTorndown( */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) { + list_for_each(curr, &gVmbusConnection.ChannelMsgList) { +/* FIXME: this should probably use list_entry() instead */ msgInfo = (struct vmbus_channel_msginfo *)curr; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; @@ -508,8 +504,7 @@ static void VmbusChannelOnGpadlTorndown( static void VmbusChannelOnVersionResponse( struct vmbus_channel_message_header *hdr) { - LIST_ENTRY *anchor; - LIST_ENTRY *curr; + struct list_head *curr; struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_initiate_contact *initiate; @@ -521,7 +516,8 @@ static void VmbusChannelOnVersionResponse( versionResponse = (struct vmbus_channel_version_response *)hdr; spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) { + list_for_each(curr, &gVmbusConnection.ChannelMsgList) { +/* FIXME: this should probably use list_entry() instead */ msgInfo = (struct vmbus_channel_msginfo *)curr; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; @@ -659,23 +655,19 @@ Cleanup: */ void VmbusChannelReleaseUnattachedChannels(void) { - LIST_ENTRY *entry; - struct vmbus_channel *channel; + struct vmbus_channel *channel, *pos; struct vmbus_channel *start = NULL; unsigned long flags; spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - while (!IsListEmpty(&gVmbusConnection.ChannelList)) { - entry = TOP_LIST_ENTRY(&gVmbusConnection.ChannelList); - channel = CONTAINING_RECORD(entry, struct vmbus_channel, - ListEntry); - + list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, + ListEntry) { if (channel == start) break; if (!channel->DeviceObject->Driver) { - REMOVE_ENTRY_LIST(&channel->ListEntry); + list_del(&channel->ListEntry); DPRINT_INFO(VMBUS, "Releasing unattached device object %p", channel->DeviceObject); |