Commit 06d2e318 authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

Staging: hv remove TIMER typedef

Remove the TIMER typedef and also replace HANDLE types that use
the timer calls.
Signed-off-by: default avatarBill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent aedb444a
...@@ -47,7 +47,7 @@ typedef struct _VMBUS_CHANNEL { ...@@ -47,7 +47,7 @@ typedef struct _VMBUS_CHANNEL {
struct hv_device *DeviceObject; struct hv_device *DeviceObject;
HANDLE PollTimer; /* SA-111 workaround */ struct osd_timer *PollTimer; /* SA-111 workaround */
VMBUS_CHANNEL_STATE State; VMBUS_CHANNEL_STATE State;
......
...@@ -48,6 +48,10 @@ typedef struct _DLIST_ENTRY { ...@@ -48,6 +48,10 @@ typedef struct _DLIST_ENTRY {
/* typedef unsigned char GUID[16]; */ /* typedef unsigned char GUID[16]; */
typedef void* HANDLE; typedef void* HANDLE;
typedef void (*PFN_WORKITEM_CALLBACK)(void* context);
typedef void (*PFN_TIMER_CALLBACK)(void* context);
typedef struct { typedef struct {
unsigned char Data[16]; unsigned char Data[16];
} GUID; } GUID;
...@@ -57,9 +61,12 @@ struct osd_waitevent { ...@@ -57,9 +61,12 @@ 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;
};
typedef void (*PFN_WORKITEM_CALLBACK)(void* context);
typedef void (*PFN_TIMER_CALLBACK)(void* context);
#ifdef __x86_64__ #ifdef __x86_64__
...@@ -123,10 +130,10 @@ extern void PageFree(void* page, unsigned int count); ...@@ -123,10 +130,10 @@ extern void PageFree(void* page, unsigned int count);
extern void* MemMapIO(unsigned long phys, unsigned long size); extern void* MemMapIO(unsigned long phys, unsigned long size);
extern void MemUnmapIO(void* virt); extern void MemUnmapIO(void* virt);
extern HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context); extern struct osd_timer *TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context);
extern void TimerClose(HANDLE hTimer); extern void TimerClose(struct osd_timer *t);
extern int TimerStop(HANDLE hTimer); extern int TimerStop(struct osd_timer *t);
extern void TimerStart(HANDLE hTimer, u32 expirationInUs); extern void TimerStart(struct osd_timer *t, u32 expirationInUs);
extern struct osd_waitevent *WaitEventCreate(void); extern struct osd_waitevent *WaitEventCreate(void);
extern void WaitEventClose(struct osd_waitevent *waitEvent); extern void WaitEventClose(struct osd_waitevent *waitEvent);
......
...@@ -49,11 +49,6 @@ ...@@ -49,11 +49,6 @@
/* Data types */ /* Data types */
typedef struct _TIMER {
struct timer_list timer;
PFN_TIMER_CALLBACK callback;
void* context;
}TIMER;
typedef struct _WORKITEM { typedef struct _WORKITEM {
struct work_struct work; struct work_struct work;
...@@ -168,14 +163,14 @@ void MemUnmapIO(void *virt) ...@@ -168,14 +163,14 @@ void MemUnmapIO(void *virt)
void TimerCallback(unsigned long data) void TimerCallback(unsigned long data)
{ {
TIMER* t = (TIMER*)data; struct osd_timer *t = (struct osd_timer *) data;
t->callback(t->context); t->callback(t->context);
} }
HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context) struct osd_timer *TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context)
{ {
TIMER* t = kmalloc(sizeof(TIMER), GFP_KERNEL); struct osd_timer *t = kmalloc(sizeof(struct osd_timer), GFP_KERNEL);
if (!t) if (!t)
{ {
return NULL; return NULL;
...@@ -191,25 +186,19 @@ HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context) ...@@ -191,25 +186,19 @@ HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context)
return t; return t;
} }
void TimerStart(HANDLE hTimer, u32 expirationInUs) void TimerStart(struct osd_timer *t, u32 expirationInUs)
{ {
TIMER* t = (TIMER* )hTimer;
t->timer.expires = jiffies + usecs_to_jiffies(expirationInUs); t->timer.expires = jiffies + usecs_to_jiffies(expirationInUs);
add_timer(&t->timer); add_timer(&t->timer);
} }
int TimerStop(HANDLE hTimer) int TimerStop(struct osd_timer *t)
{ {
TIMER* t = (TIMER* )hTimer;
return del_timer(&t->timer); return del_timer(&t->timer);
} }
void TimerClose(HANDLE hTimer) void TimerClose(struct osd_timer *t)
{ {
TIMER* t = (TIMER* )hTimer;
del_timer(&t->timer); del_timer(&t->timer);
kfree(t); kfree(t);
} }
......
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