1 /* 2 * Copyright (c) 2006 Cisco Systems. All rights reserved. 3 * 4 * This file is released under the GPLv2. 5 */ 6 7 /* mutex compatibility for pre-2.6.16 kernels */ 8 9 #ifndef __LINUX_MUTEX_H 10 #define __LINUX_MUTEX_H 11 12 #include <linux/version.h> 13 14 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) 15 #error "This version of Linux should not need compat mutex.h" 16 #endif 17 18 #include <linux/version.h> 19 #include <asm/semaphore.h> 20 21 #define mutex semaphore 22 #define DEFINE_MUTEX(foo) DECLARE_MUTEX(foo) 23 #define mutex_init(foo) init_MUTEX(foo) 24 #define mutex_lock(foo) down(foo) 25 #define mutex_lock_interruptible(foo) down_interruptible(foo) 26 /* this function follows the spin_trylock() convention, so * 27 * it is negated to the down_trylock() return values! Be careful */ 28 #define mutex_trylock(foo) !down_trylock(foo) 29 #define mutex_unlock(foo) up(foo) 30 31 #endif /* __LINUX_MUTEX_H */ 32