diff options
Diffstat (limited to 'drivers/staging/csr/oska/mutex.h')
-rw-r--r-- | drivers/staging/csr/oska/mutex.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/staging/csr/oska/mutex.h b/drivers/staging/csr/oska/mutex.h new file mode 100644 index 0000000..9138b28 --- /dev/null +++ b/drivers/staging/csr/oska/mutex.h @@ -0,0 +1,42 @@ +/* + * OSKA Linux implementation -- mutexes + * + * Copyright (C) 2007 Cambridge Silicon Radio Ltd. + * + * Refer to LICENSE.txt included with this source code for details on + * the license terms. + */ +#ifndef __OSKA_LINUX_MUTEX_H +#define __OSKA_LINUX_MUTEX_H + +#include <linux/kernel.h> +#include <linux/mutex.h> + +#include "kernel-compat.h" + +/* Real mutexes were only added to 2.6.16 so use semaphores + instead. */ +typedef struct semaphore os_mutex_t; + +static inline void os_mutex_init(os_mutex_t *mutex) +{ + //init_MUTEX(mutex); + sema_init(mutex, 1); +} + +static inline void os_mutex_destroy(os_mutex_t *mutex) +{ + /* no op */ +} + +static inline void os_mutex_lock(os_mutex_t *mutex) +{ + down(mutex); +} + +static inline void os_mutex_unlock(os_mutex_t *mutex) +{ + up(mutex); +} + +#endif /* __OSKA_LINUX_MUTEX_H */ |