diff options
Diffstat (limited to 'include/acpi/platform/aclinux.h')
-rw-r--r-- | include/acpi/platform/aclinux.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 103f08aca764..2ce1be9f6291 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2010, Intel Corp. | 8 | * Copyright (C) 2000 - 2011, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -75,7 +75,6 @@ | |||
75 | #define acpi_cache_t struct kmem_cache | 75 | #define acpi_cache_t struct kmem_cache |
76 | #define acpi_spinlock spinlock_t * | 76 | #define acpi_spinlock spinlock_t * |
77 | #define acpi_cpu_flags unsigned long | 77 | #define acpi_cpu_flags unsigned long |
78 | #define acpi_thread_id struct task_struct * | ||
79 | 78 | ||
80 | #else /* !__KERNEL__ */ | 79 | #else /* !__KERNEL__ */ |
81 | 80 | ||
@@ -88,7 +87,7 @@ | |||
88 | /* Host-dependent types and defines for user-space ACPICA */ | 87 | /* Host-dependent types and defines for user-space ACPICA */ |
89 | 88 | ||
90 | #define ACPI_FLUSH_CPU_CACHE() | 89 | #define ACPI_FLUSH_CPU_CACHE() |
91 | #define acpi_thread_id pthread_t | 90 | #define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) |
92 | 91 | ||
93 | #if defined(__ia64__) || defined(__x86_64__) | 92 | #if defined(__ia64__) || defined(__x86_64__) |
94 | #define ACPI_MACHINE_WIDTH 64 | 93 | #define ACPI_MACHINE_WIDTH 64 |
@@ -113,12 +112,13 @@ | |||
113 | 112 | ||
114 | 113 | ||
115 | #ifdef __KERNEL__ | 114 | #ifdef __KERNEL__ |
115 | #include <acpi/actypes.h> | ||
116 | /* | 116 | /* |
117 | * Overrides for in-kernel ACPICA | 117 | * Overrides for in-kernel ACPICA |
118 | */ | 118 | */ |
119 | static inline acpi_thread_id acpi_os_get_thread_id(void) | 119 | static inline acpi_thread_id acpi_os_get_thread_id(void) |
120 | { | 120 | { |
121 | return current; | 121 | return (acpi_thread_id)(unsigned long)current; |
122 | } | 122 | } |
123 | 123 | ||
124 | /* | 124 | /* |
@@ -127,7 +127,6 @@ static inline acpi_thread_id acpi_os_get_thread_id(void) | |||
127 | * However, boot has (system_state != SYSTEM_RUNNING) | 127 | * However, boot has (system_state != SYSTEM_RUNNING) |
128 | * to quiet __might_sleep() in kmalloc() and resume does not. | 128 | * to quiet __might_sleep() in kmalloc() and resume does not. |
129 | */ | 129 | */ |
130 | #include <acpi/actypes.h> | ||
131 | static inline void *acpi_os_allocate(acpi_size size) | 130 | static inline void *acpi_os_allocate(acpi_size size) |
132 | { | 131 | { |
133 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); | 132 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); |
@@ -160,6 +159,24 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | |||
160 | } while (0) | 159 | } while (0) |
161 | #endif | 160 | #endif |
162 | 161 | ||
162 | /* | ||
163 | * When lockdep is enabled, the spin_lock_init() macro stringifies it's | ||
164 | * argument and uses that as a name for the lock in debugging. | ||
165 | * By executing spin_lock_init() in a macro the key changes from "lock" for | ||
166 | * all locks to the name of the argument of acpi_os_create_lock(), which | ||
167 | * prevents lockdep from reporting false positives for ACPICA locks. | ||
168 | */ | ||
169 | #define acpi_os_create_lock(__handle) \ | ||
170 | ({ \ | ||
171 | spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ | ||
172 | \ | ||
173 | if (lock) { \ | ||
174 | *(__handle) = lock; \ | ||
175 | spin_lock_init(*(__handle)); \ | ||
176 | } \ | ||
177 | lock ? AE_OK : AE_NO_MEMORY; \ | ||
178 | }) | ||
179 | |||
163 | #endif /* __KERNEL__ */ | 180 | #endif /* __KERNEL__ */ |
164 | 181 | ||
165 | #endif /* __ACLINUX_H__ */ | 182 | #endif /* __ACLINUX_H__ */ |