Commit 53af545b authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

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: default avatarBill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d29274ef
...@@ -247,8 +247,8 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, ...@@ -247,8 +247,8 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
memcpy(openMsg->UserData, UserData, UserDataLen); memcpy(openMsg->UserData, UserData, UserDataLen);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList, list_add_tail(&openInfo->MsgListEntry,
&openInfo->MsgListEntry); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Sending channel open msg..."); DPRINT_DBG(VMBUS, "Sending channel open msg...");
...@@ -271,7 +271,7 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, ...@@ -271,7 +271,7 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
Cleanup: Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
REMOVE_ENTRY_LIST(&openInfo->MsgListEntry); list_del(&openInfo->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(openInfo->WaitEvent); kfree(openInfo->WaitEvent);
...@@ -362,7 +362,7 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, ...@@ -362,7 +362,7 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size,
sizeof(struct gpa_range) + pfnCount * sizeof(u64); sizeof(struct gpa_range) + pfnCount * sizeof(u64);
msgHeader = kzalloc(msgSize, GFP_KERNEL); msgHeader = kzalloc(msgSize, GFP_KERNEL);
INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList); INIT_LIST_HEAD(&msgHeader->SubMsgList);
msgHeader->MessageSize = msgSize; msgHeader->MessageSize = msgSize;
gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg; gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
...@@ -411,8 +411,8 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, ...@@ -411,8 +411,8 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size,
gpadlBody->Pfn[i] = pfn + pfnSum + i; gpadlBody->Pfn[i] = pfn + pfnSum + i;
/* add to msg header */ /* add to msg header */
INSERT_TAIL_LIST(&msgHeader->SubMsgList, list_add_tail(&msgBody->MsgListEntry,
&msgBody->MsgListEntry); &msgHeader->SubMsgList);
pfnSum += pfnCurr; pfnSum += pfnCurr;
pfnLeft -= pfnCurr; pfnLeft -= pfnCurr;
} }
...@@ -457,8 +457,7 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer, ...@@ -457,8 +457,7 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer,
struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_msginfo *subMsgInfo; struct vmbus_channel_msginfo *subMsgInfo;
u32 msgCount; u32 msgCount;
LIST_ENTRY *anchor; struct list_head *curr;
LIST_ENTRY *curr;
u32 nextGpadlHandle; u32 nextGpadlHandle;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -481,10 +480,10 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer, ...@@ -481,10 +480,10 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer,
DumpGpadlHeader(gpadlMsg); DumpGpadlHeader(gpadlMsg);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList, list_add_tail(&msgInfo->MsgListEntry,
&msgInfo->MsgListEntry); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d", DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
Kbuffer, Size, msgCount); Kbuffer, Size, msgCount);
...@@ -499,7 +498,9 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer, ...@@ -499,7 +498,9 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer,
} }
if (msgCount > 1) { if (msgCount > 1) {
ITERATE_LIST_ENTRIES(anchor, curr, &msgInfo->SubMsgList) { list_for_each(curr, &msgInfo->SubMsgList) {
/* FIXME: should this use list_entry() instead ? */
subMsgInfo = (struct vmbus_channel_msginfo *)curr; subMsgInfo = (struct vmbus_channel_msginfo *)curr;
gpadlBody = gpadlBody =
(struct vmbus_channel_gpadl_body *)subMsgInfo->Msg; (struct vmbus_channel_gpadl_body *)subMsgInfo->Msg;
...@@ -532,7 +533,7 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer, ...@@ -532,7 +533,7 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel, void *Kbuffer,
Cleanup: Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry); list_del(&msgInfo->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(msgInfo->WaitEvent); kfree(msgInfo->WaitEvent);
...@@ -570,7 +571,8 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) ...@@ -570,7 +571,8 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
msg->Gpadl = GpadlHandle; msg->Gpadl = GpadlHandle;
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList, &info->MsgListEntry); list_add_tail(&info->MsgListEntry,
&gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
ret = VmbusPostMessage(msg, ret = VmbusPostMessage(msg,
...@@ -584,7 +586,7 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle) ...@@ -584,7 +586,7 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
/* Received a torndown response */ /* Received a torndown response */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
REMOVE_ENTRY_LIST(&info->MsgListEntry); list_del(&info->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(info->WaitEvent); kfree(info->WaitEvent);
...@@ -651,7 +653,7 @@ void VmbusChannelClose(struct vmbus_channel *Channel) ...@@ -651,7 +653,7 @@ void VmbusChannelClose(struct vmbus_channel *Channel)
if (Channel->State == CHANNEL_OPEN_STATE) { if (Channel->State == CHANNEL_OPEN_STATE) {
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
REMOVE_ENTRY_LIST(&Channel->ListEntry); list_del(&Channel->ListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
FreeVmbusChannel(Channel); FreeVmbusChannel(Channel);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/list.h>
#include "osd.h" #include "osd.h"
#include "logging.h" #include "logging.h"
#include "VmbusPrivate.h" #include "VmbusPrivate.h"
...@@ -136,8 +137,6 @@ static void VmbusChannelProcessOffer(void *context) ...@@ -136,8 +137,6 @@ static void VmbusChannelProcessOffer(void *context)
{ {
struct vmbus_channel *newChannel = context; struct vmbus_channel *newChannel = context;
struct vmbus_channel *channel; struct vmbus_channel *channel;
LIST_ENTRY *anchor;
LIST_ENTRY *curr;
bool fNew = true; bool fNew = true;
int ret; int ret;
unsigned long flags; unsigned long flags;
...@@ -147,10 +146,7 @@ static void VmbusChannelProcessOffer(void *context) ...@@ -147,10 +146,7 @@ static void VmbusChannelProcessOffer(void *context)
/* Make sure this is a new offer */ /* Make sure this is a new offer */
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList) { list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) {
channel = CONTAINING_RECORD(curr, struct vmbus_channel,
ListEntry);
if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, if (!memcmp(&channel->OfferMsg.Offer.InterfaceType,
&newChannel->OfferMsg.Offer.InterfaceType, &newChannel->OfferMsg.Offer.InterfaceType,
sizeof(struct hv_guid)) && sizeof(struct hv_guid)) &&
...@@ -163,8 +159,8 @@ static void VmbusChannelProcessOffer(void *context) ...@@ -163,8 +159,8 @@ static void VmbusChannelProcessOffer(void *context)
} }
if (fNew) if (fNew)
INSERT_TAIL_LIST(&gVmbusConnection.ChannelList, list_add_tail(&newChannel->ListEntry,
&newChannel->ListEntry); &gVmbusConnection.ChannelList);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
...@@ -201,7 +197,7 @@ static void VmbusChannelProcessOffer(void *context) ...@@ -201,7 +197,7 @@ static void VmbusChannelProcessOffer(void *context)
newChannel->OfferMsg.ChildRelId); newChannel->OfferMsg.ChildRelId);
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
REMOVE_ENTRY_LIST(&newChannel->ListEntry); list_del(&newChannel->ListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
FreeVmbusChannel(newChannel); FreeVmbusChannel(newChannel);
...@@ -360,8 +356,7 @@ static void VmbusChannelOnOffersDelivered( ...@@ -360,8 +356,7 @@ static void VmbusChannelOnOffersDelivered(
static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr) static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr)
{ {
struct vmbus_channel_open_result *result; struct vmbus_channel_open_result *result;
LIST_ENTRY *anchor; struct list_head *curr;
LIST_ENTRY *curr;
struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_open_channel *openMsg; struct vmbus_channel_open_channel *openMsg;
...@@ -377,7 +372,8 @@ static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr) ...@@ -377,7 +372,8 @@ static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr)
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 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; msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
...@@ -408,8 +404,7 @@ static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr) ...@@ -408,8 +404,7 @@ static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr)
static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr) static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr)
{ {
struct vmbus_channel_gpadl_created *gpadlCreated; struct vmbus_channel_gpadl_created *gpadlCreated;
LIST_ENTRY *anchor; struct list_head *curr;
LIST_ENTRY *curr;
struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_gpadl_header *gpadlHeader; struct vmbus_channel_gpadl_header *gpadlHeader;
...@@ -427,7 +422,8 @@ static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr) ...@@ -427,7 +422,8 @@ static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr)
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 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; msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
...@@ -461,8 +457,7 @@ static void VmbusChannelOnGpadlTorndown( ...@@ -461,8 +457,7 @@ static void VmbusChannelOnGpadlTorndown(
struct vmbus_channel_message_header *hdr) struct vmbus_channel_message_header *hdr)
{ {
struct vmbus_channel_gpadl_torndown *gpadlTorndown; struct vmbus_channel_gpadl_torndown *gpadlTorndown;
LIST_ENTRY *anchor; struct list_head *curr;
LIST_ENTRY *curr;
struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_gpadl_teardown *gpadlTeardown; struct vmbus_channel_gpadl_teardown *gpadlTeardown;
...@@ -477,7 +472,8 @@ static void VmbusChannelOnGpadlTorndown( ...@@ -477,7 +472,8 @@ static void VmbusChannelOnGpadlTorndown(
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 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; msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
...@@ -508,8 +504,7 @@ static void VmbusChannelOnGpadlTorndown( ...@@ -508,8 +504,7 @@ static void VmbusChannelOnGpadlTorndown(
static void VmbusChannelOnVersionResponse( static void VmbusChannelOnVersionResponse(
struct vmbus_channel_message_header *hdr) struct vmbus_channel_message_header *hdr)
{ {
LIST_ENTRY *anchor; struct list_head *curr;
LIST_ENTRY *curr;
struct vmbus_channel_msginfo *msgInfo; struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader; struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_initiate_contact *initiate; struct vmbus_channel_initiate_contact *initiate;
...@@ -521,7 +516,8 @@ static void VmbusChannelOnVersionResponse( ...@@ -521,7 +516,8 @@ static void VmbusChannelOnVersionResponse(
versionResponse = (struct vmbus_channel_version_response *)hdr; versionResponse = (struct vmbus_channel_version_response *)hdr;
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); 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; msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg; requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
...@@ -659,23 +655,19 @@ int VmbusChannelRequestOffers(void) ...@@ -659,23 +655,19 @@ int VmbusChannelRequestOffers(void)
*/ */
void VmbusChannelReleaseUnattachedChannels(void) void VmbusChannelReleaseUnattachedChannels(void)
{ {
LIST_ENTRY *entry; struct vmbus_channel *channel, *pos;
struct vmbus_channel *channel;
struct vmbus_channel *start = NULL; struct vmbus_channel *start = NULL;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
while (!IsListEmpty(&gVmbusConnection.ChannelList)) { list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList,
entry = TOP_LIST_ENTRY(&gVmbusConnection.ChannelList); ListEntry) {
channel = CONTAINING_RECORD(entry, struct vmbus_channel,
ListEntry);
if (channel == start) if (channel == start)
break; break;
if (!channel->DeviceObject->Driver) { if (!channel->DeviceObject->Driver) {
REMOVE_ENTRY_LIST(&channel->ListEntry); list_del(&channel->ListEntry);
DPRINT_INFO(VMBUS, DPRINT_INFO(VMBUS,
"Releasing unattached device object %p", "Releasing unattached device object %p",
channel->DeviceObject); channel->DeviceObject);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef _CHANNEL_MGMT_H_ #ifndef _CHANNEL_MGMT_H_
#define _CHANNEL_MGMT_H_ #define _CHANNEL_MGMT_H_
#include "List.h" #include <linux/list.h>
#include "RingBuffer.h" #include "RingBuffer.h"
#include "VmbusChannelInterface.h" #include "VmbusChannelInterface.h"
#include "VmbusPacketFormat.h" #include "VmbusPacketFormat.h"
...@@ -225,7 +225,7 @@ enum vmbus_channel_state { ...@@ -225,7 +225,7 @@ enum vmbus_channel_state {
}; };
struct vmbus_channel { struct vmbus_channel {
LIST_ENTRY ListEntry; struct list_head ListEntry;
struct hv_device *DeviceObject; struct hv_device *DeviceObject;
...@@ -281,10 +281,10 @@ struct vmbus_channel_debug_info { ...@@ -281,10 +281,10 @@ struct vmbus_channel_debug_info {
*/ */
struct vmbus_channel_msginfo { struct vmbus_channel_msginfo {
/* Bookkeeping stuff */ /* Bookkeeping stuff */
LIST_ENTRY MsgListEntry; struct list_head MsgListEntry;
/* So far, this is only used to handle gpadl body message */ /* So far, this is only used to handle gpadl body message */
LIST_ENTRY SubMsgList; struct list_head SubMsgList;
/* Synchronize the request/response if needed */ /* Synchronize the request/response if needed */
struct osd_waitevent *WaitEvent; struct osd_waitevent *WaitEvent;
......
...@@ -57,10 +57,10 @@ int VmbusConnect(void) ...@@ -57,10 +57,10 @@ int VmbusConnect(void)
goto Cleanup; goto Cleanup;
} }
INITIALIZE_LIST_HEAD(&gVmbusConnection.ChannelMsgList); INIT_LIST_HEAD(&gVmbusConnection.ChannelMsgList);
spin_lock_init(&gVmbusConnection.channelmsg_lock); spin_lock_init(&gVmbusConnection.channelmsg_lock);
INITIALIZE_LIST_HEAD(&gVmbusConnection.ChannelList); INIT_LIST_HEAD(&gVmbusConnection.ChannelList);
spin_lock_init(&gVmbusConnection.channel_lock); spin_lock_init(&gVmbusConnection.channel_lock);
/* /*
...@@ -112,8 +112,9 @@ int VmbusConnect(void) ...@@ -112,8 +112,9 @@ int VmbusConnect(void)
* receive the response before returning from this routine * receive the response before returning from this routine
*/ */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList, list_add_tail(&msgInfo->MsgListEntry,
&msgInfo->MsgListEntry); &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, " DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, "
...@@ -124,14 +125,14 @@ int VmbusConnect(void) ...@@ -124,14 +125,14 @@ int VmbusConnect(void)
ret = VmbusPostMessage(msg, ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_initiate_contact)); sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) { if (ret != 0) {
REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry); list_del(&msgInfo->MsgListEntry);
goto Cleanup; goto Cleanup;
} }
/* Wait for the connection response */ /* Wait for the connection response */
osd_WaitEventWait(msgInfo->WaitEvent); osd_WaitEventWait(msgInfo->WaitEvent);
REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry); list_del(&msgInfo->MsgListEntry);
/* Check if successful */ /* Check if successful */
if (msgInfo->Response.VersionResponse.VersionSupported) { if (msgInfo->Response.VersionResponse.VersionSupported) {
...@@ -223,15 +224,10 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId) ...@@ -223,15 +224,10 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId)
{ {
struct vmbus_channel *channel; struct vmbus_channel *channel;
struct vmbus_channel *foundChannel = NULL; struct vmbus_channel *foundChannel = NULL;
LIST_ENTRY *anchor;
LIST_ENTRY *curr;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList) { list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) {
channel = CONTAINING_RECORD(curr, struct vmbus_channel,
ListEntry);
if (channel->OfferMsg.ChildRelId == relId) { if (channel->OfferMsg.ChildRelId == relId) {
foundChannel = channel; foundChannel = channel;
break; break;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "ChannelMgmt.h" #include "ChannelMgmt.h"
#include "ChannelInterface.h" #include "ChannelInterface.h"
#include "RingBuffer.h" #include "RingBuffer.h"
#include "List.h" #include <linux/list.h>
/* /*
...@@ -76,11 +76,11 @@ struct VMBUS_CONNECTION { ...@@ -76,11 +76,11 @@ struct VMBUS_CONNECTION {
* is child->parent notification * is child->parent notification
*/ */
void *MonitorPages; void *MonitorPages;
LIST_ENTRY ChannelMsgList; struct list_head ChannelMsgList;
spinlock_t channelmsg_lock; spinlock_t channelmsg_lock;
/* List of channels */ /* List of channels */
LIST_ENTRY ChannelList; struct list_head ChannelList;
spinlock_t channel_lock; spinlock_t channel_lock;
struct workqueue_struct *WorkQueue; struct workqueue_struct *WorkQueue;
...@@ -89,7 +89,7 @@ struct VMBUS_CONNECTION { ...@@ -89,7 +89,7 @@ struct VMBUS_CONNECTION {
struct VMBUS_MSGINFO { struct VMBUS_MSGINFO {
/* Bookkeeping stuff */ /* Bookkeeping stuff */
LIST_ENTRY MsgListEntry; struct list_head MsgListEntry;
/* Synchronize the request/response if needed */ /* Synchronize the request/response if needed */
struct osd_waitevent *WaitEvent; struct osd_waitevent *WaitEvent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment