/* 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);
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
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
}
}
VMBUS_CHANNEL_DEBUG_INFO *DebugInfo
);
-static void
-VmbusChannelOnTimer(
- void *Context
- );
+static void VmbusChannelOnTimer(unsigned long data);
#endif /* _CHANNEL_H_ */
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;
}
--*/
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. */
struct hv_device *DeviceObject;
- struct osd_timer *PollTimer; /* SA-111 workaround */
+ struct timer_list poll_timer; /* SA-111 workaround */
VMBUS_CHANNEL_STATE State;
/* typedef unsigned char GUID[16]; */
-typedef void (*PFN_TIMER_CALLBACK)(void* context);
-
-
typedef struct {
unsigned char Data[16];
} GUID;
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);
#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>
__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);