drm/radeon/kms: memset the allocated framebuffer before using it.
[linux-2.6/mini2440.git] / include / linux / semaphore.h
blob7415839ac890f538b88611f7843b5b770e73292f
1 /*
2 * Copyright (c) 2008 Intel Corporation
3 * Author: Matthew Wilcox <willy@linux.intel.com>
5 * Distributed under the terms of the GNU GPL, version 2
7 * Please see kernel/semaphore.c for documentation of these functions
8 */
9 #ifndef __LINUX_SEMAPHORE_H
10 #define __LINUX_SEMAPHORE_H
12 #include <linux/list.h>
13 #include <linux/spinlock.h>
15 /* Please don't access any members of this structure directly */
16 struct semaphore {
17 spinlock_t lock;
18 unsigned int count;
19 struct list_head wait_list;
22 #define __SEMAPHORE_INITIALIZER(name, n) \
23 { \
24 .lock = __SPIN_LOCK_UNLOCKED((name).lock), \
25 .count = n, \
26 .wait_list = LIST_HEAD_INIT((name).wait_list), \
29 #define DECLARE_MUTEX(name) \
30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
32 static inline void sema_init(struct semaphore *sem, int val)
34 static struct lock_class_key __key;
35 *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
36 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
39 #define init_MUTEX(sem) sema_init(sem, 1)
40 #define init_MUTEX_LOCKED(sem) sema_init(sem, 0)
42 extern void down(struct semaphore *sem);
43 extern int __must_check down_interruptible(struct semaphore *sem);
44 extern int __must_check down_killable(struct semaphore *sem);
45 extern int __must_check down_trylock(struct semaphore *sem);
46 extern int __must_check down_timeout(struct semaphore *sem, long jiffies);
47 extern void up(struct semaphore *sem);
49 #endif /* __LINUX_SEMAPHORE_H */