Commit c8a429a4 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: remove timer wrapper functions

Use a real timer (there's only one in the code), no wrapper is needed,
it just increases the complexity for no reason.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bfc30aae
...@@ -696,7 +696,7 @@ VmbusChannelClose( ...@@ -696,7 +696,7 @@ VmbusChannelClose(
/* Stop callback and cancel the timer asap */ /* Stop callback and cancel the timer asap */
Channel->OnChannelCallback = NULL; Channel->OnChannelCallback = NULL;
osd_TimerStop(Channel->PollTimer); del_timer(&Channel->poll_timer);
/* Send a closing message */ /* Send a closing message */
info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL); info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL);
...@@ -1154,9 +1154,10 @@ VmbusChannelOnChannelEvent( ...@@ -1154,9 +1154,10 @@ VmbusChannelOnChannelEvent(
DumpVmbusChannel(Channel); DumpVmbusChannel(Channel);
ASSERT(Channel->OnChannelCallback); ASSERT(Channel->OnChannelCallback);
#ifdef ENABLE_POLLING #ifdef ENABLE_POLLING
osd_TimerStop(Channel->PollTimer); del_timer(&Channel->poll_timer);
Channel->OnChannelCallback(Channel->ChannelCallbackContext); 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 #else
Channel->OnChannelCallback(Channel->ChannelCallbackContext); Channel->OnChannelCallback(Channel->ChannelCallbackContext);
#endif #endif
...@@ -1171,18 +1172,16 @@ VmbusChannelOnChannelEvent( ...@@ -1171,18 +1172,16 @@ VmbusChannelOnChannelEvent(
Timer event callback Timer event callback
--*/ --*/
static void static void VmbusChannelOnTimer(unsigned long data)
VmbusChannelOnTimer(
void *Context
)
{ {
VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)Context; VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)data;
if (channel->OnChannelCallback) if (channel->OnChannelCallback)
{ {
channel->OnChannelCallback(channel->ChannelCallbackContext); channel->OnChannelCallback(channel->ChannelCallbackContext);
#ifdef ENABLE_POLLING #ifdef ENABLE_POLLING
osd_TimerStart(channel->PollTimer, 100 /* 100us */); channel->poll_timer.expires(jiffies + usecs_to_jiffies(100);
add_timer(&channel->poll_timer);
#endif #endif
} }
} }
......
...@@ -150,8 +150,5 @@ VmbusChannelGetDebugInfo( ...@@ -150,8 +150,5 @@ VmbusChannelGetDebugInfo(
VMBUS_CHANNEL_DEBUG_INFO *DebugInfo VMBUS_CHANNEL_DEBUG_INFO *DebugInfo
); );
static void static void VmbusChannelOnTimer(unsigned long data);
VmbusChannelOnTimer(
void *Context
);
#endif /* _CHANNEL_H_ */ #endif /* _CHANNEL_H_ */
...@@ -141,18 +141,14 @@ static VMBUS_CHANNEL* AllocVmbusChannel(void) ...@@ -141,18 +141,14 @@ static VMBUS_CHANNEL* AllocVmbusChannel(void)
spin_lock_init(&channel->inbound_lock); spin_lock_init(&channel->inbound_lock);
channel->PollTimer = osd_TimerCreate(VmbusChannelOnTimer, channel); init_timer(&channel->poll_timer);
if (!channel->PollTimer) channel->poll_timer.data = (unsigned long)channel;
{ channel->poll_timer.function = VmbusChannelOnTimer;
kfree(channel);
return NULL;
}
/* channel->dataWorkQueue = WorkQueueCreate("data"); */ /* channel->dataWorkQueue = WorkQueueCreate("data"); */
channel->ControlWQ = create_workqueue("hv_vmbus_ctl"); channel->ControlWQ = create_workqueue("hv_vmbus_ctl");
if (!channel->ControlWQ) if (!channel->ControlWQ)
{ {
osd_TimerClose(channel->PollTimer);
kfree(channel); kfree(channel);
return NULL; return NULL;
} }
...@@ -195,7 +191,7 @@ static inline void ReleaseVmbusChannel(void* Context) ...@@ -195,7 +191,7 @@ static inline void ReleaseVmbusChannel(void* Context)
--*/ --*/
static void FreeVmbusChannel(VMBUS_CHANNEL* Channel) 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 */ /* We have to release the channel's workqueue/thread in the vmbus's workqueue/thread context */
/* ie we can't destroy ourselves. */ /* ie we can't destroy ourselves. */
......
...@@ -47,7 +47,7 @@ typedef struct _VMBUS_CHANNEL { ...@@ -47,7 +47,7 @@ typedef struct _VMBUS_CHANNEL {
struct hv_device *DeviceObject; struct hv_device *DeviceObject;
struct osd_timer *PollTimer; /* SA-111 workaround */ struct timer_list poll_timer; /* SA-111 workaround */
VMBUS_CHANNEL_STATE State; VMBUS_CHANNEL_STATE State;
......
...@@ -47,9 +47,6 @@ typedef struct _DLIST_ENTRY { ...@@ -47,9 +47,6 @@ typedef struct _DLIST_ENTRY {
/* typedef unsigned char GUID[16]; */ /* typedef unsigned char GUID[16]; */
typedef void (*PFN_TIMER_CALLBACK)(void* context);
typedef struct { typedef struct {
unsigned char Data[16]; unsigned char Data[16];
} GUID; } GUID;
...@@ -59,13 +56,6 @@ struct osd_waitevent { ...@@ -59,13 +56,6 @@ struct osd_waitevent {
wait_queue_head_t event; wait_queue_head_t event;
}; };
struct osd_timer {
struct timer_list timer;
PFN_TIMER_CALLBACK callback;
void* context;
};
/* Osd routines */ /* Osd routines */
extern void *osd_VirtualAllocExec(unsigned int size); extern void *osd_VirtualAllocExec(unsigned int size);
...@@ -73,11 +63,6 @@ extern void *osd_VirtualAllocExec(unsigned int size); ...@@ -73,11 +63,6 @@ extern void *osd_VirtualAllocExec(unsigned int size);
extern void *osd_PageAlloc(unsigned int count); extern void *osd_PageAlloc(unsigned int count);
extern void osd_PageFree(void* page, 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 struct osd_waitevent *osd_WaitEventCreate(void);
extern void osd_WaitEventSet(struct osd_waitevent *waitEvent); extern void osd_WaitEventSet(struct osd_waitevent *waitEvent);
extern int osd_WaitEventWait(struct osd_waitevent *waitEvent); extern int osd_WaitEventWait(struct osd_waitevent *waitEvent);
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/time.h> #include <linux/time.h>
...@@ -88,48 +87,6 @@ void osd_PageFree(void* page, unsigned int count) ...@@ -88,48 +87,6 @@ void osd_PageFree(void* page, unsigned int count)
__free_page(p);*/ __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 *osd_WaitEventCreate(void)
{ {
struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent), GFP_KERNEL); struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent), GFP_KERNEL);
......
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