ia64/xen-unstable

view unmodified_drivers/linux-2.6/platform-pci/platform-compat.c @ 15342:1623f5f5094f

[IA64] Don't try to save nvram on PV domains

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Thu Jun 14 15:32:22 2007 -0600 (2007-06-14)
parents 6e7ef794cdbc
children 0b8c6c91c5a4
line source
1 #include <linux/version.h>
3 #include <linux/mm.h>
4 #include <linux/module.h>
5 #include <linux/sched.h>
6 #include <linux/slab.h>
8 #include <xen/platform-compat.h>
10 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
11 static int system_state = 1;
12 EXPORT_SYMBOL(system_state);
13 #endif
15 void ctrl_alt_del(void)
16 {
17 kill_proc(1, SIGINT, 1); /* interrupt init */
18 }
20 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
21 size_t strcspn(const char *s, const char *reject)
22 {
23 const char *p;
24 const char *r;
25 size_t count = 0;
27 for (p = s; *p != '\0'; ++p) {
28 for (r = reject; *r != '\0'; ++r) {
29 if (*p == *r)
30 return count;
31 }
32 ++count;
33 }
35 return count;
36 }
37 EXPORT_SYMBOL(strcspn);
38 #endif
40 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
41 /*
42 * Map a vmalloc()-space virtual address to the physical page frame number.
43 */
44 unsigned long vmalloc_to_pfn(void * vmalloc_addr)
45 {
46 return page_to_pfn(vmalloc_to_page(vmalloc_addr));
47 }
48 EXPORT_SYMBOL(vmalloc_to_pfn);
49 #endif
51 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
52 unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout)
53 {
54 might_sleep();
56 spin_lock_irq(&x->wait.lock);
57 if (!x->done) {
58 DECLARE_WAITQUEUE(wait, current);
60 wait.flags |= WQ_FLAG_EXCLUSIVE;
61 __add_wait_queue_tail(&x->wait, &wait);
62 do {
63 __set_current_state(TASK_UNINTERRUPTIBLE);
64 spin_unlock_irq(&x->wait.lock);
65 timeout = schedule_timeout(timeout);
66 spin_lock_irq(&x->wait.lock);
67 if (!timeout) {
68 __remove_wait_queue(&x->wait, &wait);
69 goto out;
70 }
71 } while (!x->done);
72 __remove_wait_queue(&x->wait, &wait);
73 }
74 x->done--;
75 out:
76 spin_unlock_irq(&x->wait.lock);
77 return timeout;
78 }
79 EXPORT_SYMBOL(wait_for_completion_timeout);
80 #endif
82 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
83 /*
84 fake do_exit using complete_and_exit
85 */
86 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
87 asmlinkage NORET_TYPE void do_exit(long code)
88 #else
89 fastcall NORET_TYPE void do_exit(long code)
90 #endif
91 {
92 complete_and_exit(NULL, code);
93 }
94 EXPORT_SYMBOL_GPL(do_exit);
95 #endif
97 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
98 signed long schedule_timeout_interruptible(signed long timeout)
99 {
100 __set_current_state(TASK_INTERRUPTIBLE);
101 return schedule_timeout(timeout);
102 }
103 EXPORT_SYMBOL(schedule_timeout_interruptible);
104 #endif
106 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
107 /**
108 * kzalloc - allocate memory. The memory is set to zero.
109 * @size: how many bytes of memory are required.
110 * @flags: the type of memory to allocate.
111 */
112 void *kzalloc(size_t size, int flags)
113 {
114 void *ret = kmalloc(size, flags);
115 if (ret)
116 memset(ret, 0, size);
117 return ret;
118 }
119 EXPORT_SYMBOL(kzalloc);
120 #endif
122 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
123 /* Simplified asprintf. */
124 char *kasprintf(gfp_t gfp, const char *fmt, ...)
125 {
126 va_list ap;
127 unsigned int len;
128 char *p, dummy[1];
130 va_start(ap, fmt);
131 len = vsnprintf(dummy, 0, fmt, ap);
132 va_end(ap);
134 p = kmalloc(len + 1, gfp);
135 if (!p)
136 return NULL;
137 va_start(ap, fmt);
138 vsprintf(p, fmt, ap);
139 va_end(ap);
140 return p;
141 }
142 EXPORT_SYMBOL(kasprintf);
143 #endif