ia64/xen-unstable

view unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @ 12460:22e58b2b0b45

[IA64] warning fix

These are pulled in through the ACPI header now

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Sun Oct 29 09:27:26 2006 -0700 (2006-10-29)
parents 9f0b88aaf170
children c242b6d6a64a
line source
1 #include <linux/config.h>
2 #include <linux/version.h>
4 #include <linux/mm.h>
5 #include <linux/module.h>
6 #include <linux/sched.h>
7 #include <linux/slab.h>
9 #include <xen/platform-compat.h>
11 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
12 static int system_state = 1;
13 EXPORT_SYMBOL(system_state);
14 #endif
16 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
17 size_t strcspn(const char *s, const char *reject)
18 {
19 const char *p;
20 const char *r;
21 size_t count = 0;
23 for (p = s; *p != '\0'; ++p) {
24 for (r = reject; *r != '\0'; ++r) {
25 if (*p == *r)
26 return count;
27 }
28 ++count;
29 }
31 return count;
32 }
33 EXPORT_SYMBOL(strcspn);
34 #endif
36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
37 /*
38 * Map a vmalloc()-space virtual address to the physical page frame number.
39 */
40 unsigned long vmalloc_to_pfn(void * vmalloc_addr)
41 {
42 return page_to_pfn(vmalloc_to_page(vmalloc_addr));
43 }
44 EXPORT_SYMBOL(vmalloc_to_pfn);
45 #endif
47 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
48 unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout)
49 {
50 might_sleep();
52 spin_lock_irq(&x->wait.lock);
53 if (!x->done) {
54 DECLARE_WAITQUEUE(wait, current);
56 wait.flags |= WQ_FLAG_EXCLUSIVE;
57 __add_wait_queue_tail(&x->wait, &wait);
58 do {
59 __set_current_state(TASK_UNINTERRUPTIBLE);
60 spin_unlock_irq(&x->wait.lock);
61 timeout = schedule_timeout(timeout);
62 spin_lock_irq(&x->wait.lock);
63 if (!timeout) {
64 __remove_wait_queue(&x->wait, &wait);
65 goto out;
66 }
67 } while (!x->done);
68 __remove_wait_queue(&x->wait, &wait);
69 }
70 x->done--;
71 out:
72 spin_unlock_irq(&x->wait.lock);
73 return timeout;
74 }
75 EXPORT_SYMBOL(wait_for_completion_timeout);
76 #endif
78 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
79 /*
80 fake do_exit using complete_and_exit
81 */
82 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
83 asmlinkage NORET_TYPE void do_exit(long code)
84 #else
85 fastcall NORET_TYPE void do_exit(long code)
86 #endif
87 {
88 complete_and_exit(NULL, code);
89 }
90 EXPORT_SYMBOL_GPL(do_exit);
91 #endif
93 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
94 signed long schedule_timeout_interruptible(signed long timeout)
95 {
96 __set_current_state(TASK_INTERRUPTIBLE);
97 return schedule_timeout(timeout);
98 }
99 EXPORT_SYMBOL(schedule_timeout_interruptible);
100 #endif
102 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
103 /**
104 * kzalloc - allocate memory. The memory is set to zero.
105 * @size: how many bytes of memory are required.
106 * @flags: the type of memory to allocate.
107 */
108 void *kzalloc(size_t size, int flags)
109 {
110 void *ret = kmalloc(size, flags);
111 if (ret)
112 memset(ret, 0, size);
113 return ret;
114 }
115 EXPORT_SYMBOL(kzalloc);
116 #endif