Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 162186
b: refs/heads/master
c: c8a429a
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Sep 15, 2009
1 parent 8411b99 commit 4c128cd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 81 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bfc30aae73b6be57528059a9e03ce8674320e67b
refs/heads/master: c8a429a465f9aaabe7fc7ddf5f34ff6dd188a68f
17 changes: 8 additions & 9 deletions trunk/drivers/staging/hv/Channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ VmbusChannelClose(

/* Stop callback and cancel the timer asap */
Channel->OnChannelCallback = NULL;
osd_TimerStop(Channel->PollTimer);
del_timer(&Channel->poll_timer);

/* Send a closing message */
info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL);
Expand Down Expand Up @@ -1154,9 +1154,10 @@ VmbusChannelOnChannelEvent(
DumpVmbusChannel(Channel);
ASSERT(Channel->OnChannelCallback);
#ifdef ENABLE_POLLING
osd_TimerStop(Channel->PollTimer);
del_timer(&Channel->poll_timer);
Channel->OnChannelCallback(Channel->ChannelCallbackContext);
osd_TimerStart(Channel->PollTimer, 100 /* 100us */);
channel->poll_timer.expires(jiffies + usecs_to_jiffies(100);
add_timer(&channel->poll_timer);
#else
Channel->OnChannelCallback(Channel->ChannelCallbackContext);
#endif
Expand All @@ -1171,18 +1172,16 @@ VmbusChannelOnChannelEvent(
Timer event callback
--*/
static void
VmbusChannelOnTimer(
void *Context
)
static void VmbusChannelOnTimer(unsigned long data)
{
VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)Context;
VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)data;

if (channel->OnChannelCallback)
{
channel->OnChannelCallback(channel->ChannelCallbackContext);
#ifdef ENABLE_POLLING
osd_TimerStart(channel->PollTimer, 100 /* 100us */);
channel->poll_timer.expires(jiffies + usecs_to_jiffies(100);
add_timer(&channel->poll_timer);
#endif
}
}
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/staging/hv/Channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,5 @@ VmbusChannelGetDebugInfo(
VMBUS_CHANNEL_DEBUG_INFO *DebugInfo
);

static void
VmbusChannelOnTimer(
void *Context
);
static void VmbusChannelOnTimer(unsigned long data);
#endif /* _CHANNEL_H_ */
12 changes: 4 additions & 8 deletions trunk/drivers/staging/hv/ChannelMgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,14 @@ static VMBUS_CHANNEL* AllocVmbusChannel(void)

spin_lock_init(&channel->inbound_lock);

channel->PollTimer = osd_TimerCreate(VmbusChannelOnTimer, channel);
if (!channel->PollTimer)
{
kfree(channel);
return NULL;
}
init_timer(&channel->poll_timer);
channel->poll_timer.data = (unsigned long)channel;
channel->poll_timer.function = VmbusChannelOnTimer;

/* channel->dataWorkQueue = WorkQueueCreate("data"); */
channel->ControlWQ = create_workqueue("hv_vmbus_ctl");
if (!channel->ControlWQ)
{
osd_TimerClose(channel->PollTimer);
kfree(channel);
return NULL;
}
Expand Down Expand Up @@ -195,7 +191,7 @@ static inline void ReleaseVmbusChannel(void* Context)
--*/
static void FreeVmbusChannel(VMBUS_CHANNEL* Channel)
{
osd_TimerClose(Channel->PollTimer);
del_timer(&Channel->poll_timer);

/* We have to release the channel's workqueue/thread in the vmbus's workqueue/thread context */
/* ie we can't destroy ourselves. */
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/hv/ChannelMgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef struct _VMBUS_CHANNEL {

struct hv_device *DeviceObject;

struct osd_timer *PollTimer; /* SA-111 workaround */
struct timer_list poll_timer; /* SA-111 workaround */

VMBUS_CHANNEL_STATE State;

Expand Down
15 changes: 0 additions & 15 deletions trunk/drivers/staging/hv/include/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ typedef struct _DLIST_ENTRY {

/* typedef unsigned char GUID[16]; */

typedef void (*PFN_TIMER_CALLBACK)(void* context);


typedef struct {
unsigned char Data[16];
} GUID;
Expand All @@ -59,25 +56,13 @@ struct osd_waitevent {
wait_queue_head_t event;
};

struct osd_timer {
struct timer_list timer;
PFN_TIMER_CALLBACK callback;
void* context;
};


/* Osd routines */

extern void *osd_VirtualAllocExec(unsigned int size);

extern void *osd_PageAlloc(unsigned int count);
extern void osd_PageFree(void* page, unsigned int count);

extern struct osd_timer *osd_TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context);
extern void osd_TimerClose(struct osd_timer *t);
extern int osd_TimerStop(struct osd_timer *t);
extern void osd_TimerStart(struct osd_timer *t, u32 expirationInUs);

extern struct osd_waitevent *osd_WaitEventCreate(void);
extern void osd_WaitEventSet(struct osd_waitevent *waitEvent);
extern int osd_WaitEventWait(struct osd_waitevent *waitEvent);
Expand Down
43 changes: 0 additions & 43 deletions trunk/drivers/staging/hv/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
#include <linux/delay.h>
#include <linux/time.h>
Expand Down Expand Up @@ -88,48 +87,6 @@ void osd_PageFree(void* page, unsigned int count)
__free_page(p);*/
}

static void TimerCallback(unsigned long data)
{
struct osd_timer *t = (struct osd_timer *) data;

t->callback(t->context);
}

struct osd_timer *osd_TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context)
{
struct osd_timer *t = kmalloc(sizeof(struct osd_timer), GFP_KERNEL);
if (!t)
{
return NULL;
}

t->callback = pfnTimerCB;
t->context = context;

init_timer(&t->timer);
t->timer.data = (unsigned long)t;
t->timer.function = TimerCallback;

return t;
}

void osd_TimerStart(struct osd_timer *t, u32 expirationInUs)
{
t->timer.expires = jiffies + usecs_to_jiffies(expirationInUs);
add_timer(&t->timer);
}

int osd_TimerStop(struct osd_timer *t)
{
return del_timer(&t->timer);
}

void osd_TimerClose(struct osd_timer *t)
{
del_timer(&t->timer);
kfree(t);
}

struct osd_waitevent *osd_WaitEventCreate(void)
{
struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent), GFP_KERNEL);
Expand Down

0 comments on commit 4c128cd

Please sign in to comment.