From 114387ad727be6daddc3c06a4013af499133a1d3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 19 Aug 2009 16:19:23 -0700 Subject: [PATCH] --- yaml --- r: 162209 b: refs/heads/master c: 93b5c9e17ab2285cc0f6527a8444e157069364a4 h: refs/heads/master i: 162207: 7c607e3aee0799952af2743468427f302ddcb90e v: v3 --- [refs] | 2 +- trunk/drivers/staging/hv/osd.c | 40 ++++++++++++++-------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/[refs] b/[refs] index 0e06265bf84d..0910fe6b2026 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: daaa8cc31fbd2b7356a0d67dd9ca6d336507f118 +refs/heads/master: 93b5c9e17ab2285cc0f6527a8444e157069364a4 diff --git a/trunk/drivers/staging/hv/osd.c b/trunk/drivers/staging/hv/osd.c index 3b142ce96616..8fe543bd9910 100644 --- a/trunk/drivers/staging/hv/osd.c +++ b/trunk/drivers/staging/hv/osd.c @@ -37,18 +37,10 @@ #include #include #include - -#include -#include -#include -#include - +#include +#include #include "osd.h" - -/* Data types */ - - struct osd_callback_struct { struct work_struct work; void (*callback)(void *); @@ -60,15 +52,18 @@ void *osd_VirtualAllocExec(unsigned int size) #ifdef __x86_64__ return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL_EXEC); #else - return __vmalloc(size, GFP_KERNEL, __pgprot(__PAGE_KERNEL & (~_PAGE_NX))); + return __vmalloc(size, GFP_KERNEL, + __pgprot(__PAGE_KERNEL & (~_PAGE_NX))); #endif } void *osd_PageAlloc(unsigned int count) { void *p; + p = (void *)__get_free_pages(GFP_KERNEL, get_order(count * PAGE_SIZE)); - if (p) memset(p, 0, count * PAGE_SIZE); + if (p) + memset(p, 0, count * PAGE_SIZE); return p; /* struct page* page = alloc_page(GFP_KERNEL|__GFP_ZERO); */ @@ -81,7 +76,7 @@ void *osd_PageAlloc(unsigned int count) } EXPORT_SYMBOL_GPL(osd_PageAlloc); -void osd_PageFree(void* page, unsigned int count) +void osd_PageFree(void *page, unsigned int count) { free_pages((unsigned long)page, get_order(count * PAGE_SIZE)); /*struct page* p = virt_to_page(page); @@ -91,11 +86,10 @@ EXPORT_SYMBOL_GPL(osd_PageFree); 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); if (!wait) - { return NULL; - } wait->condition = 0; init_waitqueue_head(&wait->event); @@ -112,7 +106,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); int osd_WaitEventWait(struct osd_waitevent *waitEvent) { - int ret=0; + int ret = 0; ret = wait_event_interruptible(waitEvent->event, waitEvent->condition); @@ -123,7 +117,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs) { - int ret=0; + int ret = 0; ret = wait_event_interruptible_timeout(waitEvent->event, waitEvent->condition, @@ -136,10 +130,9 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); static void osd_callback_work(struct work_struct *work) { struct osd_callback_struct *cb = container_of(work, - struct osd_callback_struct, - work); + struct osd_callback_struct, + work); (cb->callback)(cb->data); - kfree(cb); } @@ -150,9 +143,8 @@ int osd_schedule_callback(struct workqueue_struct *wq, struct osd_callback_struct *cb; cb = kmalloc(sizeof(*cb), GFP_KERNEL); - if (!cb) - { - printk(KERN_ERR "unable to allocate memory in osd_schedule_callback"); + if (!cb) { + printk(KERN_ERR "unable to allocate memory in osd_schedule_callback\n"); return -1; }