]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/hv/osd.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / staging / hv / osd.c
index 8c3eb278a81f35ead80a477dc101093b1143eac7..b5a3940331b3dad6191d6ad93d5ca9a5ec11be19 100644 (file)
 #include <linux/slab.h>
 #include "osd.h"
 
-struct osd_callback_struct {
-       struct work_struct work;
-       void (*callback)(void *);
-       void *data;
-};
-
-void *osd_VirtualAllocExec(unsigned int size)
+void *osd_virtual_alloc_exec(unsigned int size)
 {
 #ifdef __x86_64__
        return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL_EXEC);
@@ -60,7 +54,7 @@ void *osd_VirtualAllocExec(unsigned int size)
 }
 
 /**
- * osd_PageAlloc() - Allocate pages
+ * osd_page_alloc() - Allocate pages
  * @count:      Total number of Kernel pages you want to allocate
  *
  * Tries to allocate @count number of consecutive free kernel pages.
@@ -68,7 +62,7 @@ void *osd_VirtualAllocExec(unsigned int size)
  * If successfull it will return pointer to the @count pages.
  * Mainly used by Hyper-V drivers.
  */
-void *osd_PageAlloc(unsigned int count)
+void *osd_page_alloc(unsigned int count)
 {
        void *p;
 
@@ -85,26 +79,26 @@ void *osd_PageAlloc(unsigned int count)
        /* if (p) memset(p, 0, PAGE_SIZE); */
        /* return p; */
 }
-EXPORT_SYMBOL_GPL(osd_PageAlloc);
+EXPORT_SYMBOL_GPL(osd_page_alloc);
 
 /**
- * osd_PageFree() - Free pages
+ * osd_page_free() - Free pages
  * @page:       Pointer to the first page to be freed
  * @count:      Total number of Kernel pages you free
  *
- * Frees the pages allocated by osd_PageAlloc()
+ * Frees the pages allocated by osd_page_alloc()
  * Mainly used by Hyper-V drivers.
  */
-void osd_PageFree(void *page, unsigned int count)
+void osd_page_free(void *page, unsigned int count)
 {
        free_pages((unsigned long)page, get_order(count * PAGE_SIZE));
        /*struct page* p = virt_to_page(page);
        __free_page(p);*/
 }
-EXPORT_SYMBOL_GPL(osd_PageFree);
+EXPORT_SYMBOL_GPL(osd_page_free);
 
 /**
- * osd_WaitEventCreate() - Create the event queue
+ * osd_waitevent_create() - Create the event queue
  *
  * Allocates memory for a &struct osd_waitevent. And then calls
  * init_waitqueue_head to set up the wait queue for the event.
@@ -114,7 +108,7 @@ EXPORT_SYMBOL_GPL(osd_PageFree);
  * Returns pointer to &struct osd_waitevent
  * Mainly used by Hyper-V drivers.
  */
-struct osd_waitevent *osd_WaitEventCreate(void)
+struct osd_waitevent *osd_waitevent_create(void)
 {
        struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent),
                                             GFP_KERNEL);
@@ -125,14 +119,14 @@ struct osd_waitevent *osd_WaitEventCreate(void)
        init_waitqueue_head(&wait->event);
        return wait;
 }
-EXPORT_SYMBOL_GPL(osd_WaitEventCreate);
+EXPORT_SYMBOL_GPL(osd_waitevent_create);
 
 
 /**
- * osd_WaitEventSet() - Wake up the process
- * @waitEvent: Structure to event to be woken up
+ * osd_waitevent_set() - Wake up the process
+ * @wait_event: Structure to event to be woken up
  *
- * @waitevent is of type &struct osd_waitevent
+ * @wait_event is of type &struct osd_waitevent
  *
  * Wake up the sleeping process so it can do some work.
  * And set condition indicator in &struct osd_waitevent to indicate
@@ -140,18 +134,18 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate);
  *
  * Only used by Network and Storage Hyper-V drivers.
  */
-void osd_WaitEventSet(struct osd_waitevent *waitEvent)
+void osd_waitevent_set(struct osd_waitevent *wait_event)
 {
-       waitEvent->condition = 1;
-       wake_up_interruptible(&waitEvent->event);
+       wait_event->condition = 1;
+       wake_up_interruptible(&wait_event->event);
 }
-EXPORT_SYMBOL_GPL(osd_WaitEventSet);
+EXPORT_SYMBOL_GPL(osd_waitevent_set);
 
 /**
- * osd_WaitEventWait() - Wait for event till condition is true
- * @waitEvent: Structure to event to be put to sleep
+ * osd_waitevent_wait() - Wait for event till condition is true
+ * @wait_event: Structure to event to be put to sleep
  *
- * @waitevent is of type &struct osd_waitevent
+ * @wait_event is of type &struct osd_waitevent
  *
  * Set up the process to sleep until waitEvent->condition get true.
  * And set condition indicator in &struct osd_waitevent to indicate
@@ -161,25 +155,25 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet);
  *
  * Mainly used by Hyper-V drivers.
  */
-int osd_WaitEventWait(struct osd_waitevent *waitEvent)
+int osd_waitevent_wait(struct osd_waitevent *wait_event)
 {
        int ret = 0;
 
-       ret = wait_event_interruptible(waitEvent->event,
-                                      waitEvent->condition);
-       waitEvent->condition = 0;
+       ret = wait_event_interruptible(wait_event->event,
+                                      wait_event->condition);
+       wait_event->condition = 0;
        return ret;
 }
-EXPORT_SYMBOL_GPL(osd_WaitEventWait);
+EXPORT_SYMBOL_GPL(osd_waitevent_wait);
 
 /**
- * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup
- * @waitEvent: Structure to event to be put to sleep
- * @TimeoutInMs:       Total number of Milliseconds to wait before waking up
+ * osd_waitevent_waitex() - Wait for event or timeout for process wakeup
+ * @wait_event: Structure to event to be put to sleep
+ * @timeout_in_ms:       Total number of Milliseconds to wait before waking up
  *
- * @waitevent is of type &struct osd_waitevent
+ * @wait_event is of type &struct osd_waitevent
  * Set up the process to sleep until @waitEvent->condition get true or
- * @TimeoutInMs (Time out in Milliseconds) has been reached.
+ * @timeout_in_ms (Time out in Milliseconds) has been reached.
  * And set condition indicator in &struct osd_waitevent to indicate
  * the process is in a sleeping state.
  *
@@ -187,42 +181,14 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait);
  *
  * Mainly used by Hyper-V drivers.
  */
-int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs)
+int osd_waitevent_waitex(struct osd_waitevent *wait_event, u32 timeout_in_ms)
 {
        int ret = 0;
 
-       ret = wait_event_interruptible_timeout(waitEvent->event,
-                                              waitEvent->condition,
-                                              msecs_to_jiffies(TimeoutInMs));
-       waitEvent->condition = 0;
+       ret = wait_event_interruptible_timeout(wait_event->event,
+                                              wait_event->condition,
+                                              msecs_to_jiffies(timeout_in_ms));
+       wait_event->condition = 0;
        return ret;
 }
-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);
-       (cb->callback)(cb->data);
-       kfree(cb);
-}
-
-int osd_schedule_callback(struct workqueue_struct *wq,
-                         void (*func)(void *),
-                         void *data)
-{
-       struct osd_callback_struct *cb;
-
-       cb = kmalloc(sizeof(*cb), GFP_KERNEL);
-       if (!cb) {
-               printk(KERN_ERR "unable to allocate memory in osd_schedule_callback\n");
-               return -1;
-       }
-
-       cb->callback = func;
-       cb->data = data;
-       INIT_WORK(&cb->work, osd_callback_work);
-       return queue_work(wq, &cb->work);
-}
-
+EXPORT_SYMBOL_GPL(osd_waitevent_waitex);