Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 #ifndef __LINUX_SPINLOCK_API_UP_H
  2 #define __LINUX_SPINLOCK_API_UP_H
  3 
  4 #ifndef __LINUX_SPINLOCK_H
  5 # error "please don't include this file directly"
  6 #endif
  7 
  8 /*
  9  * include/linux/spinlock_api_up.h
 10  *
 11  * spinlock API implementation on UP-nondebug (inlined implementation)
 12  *
 13  * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
 14  * Released under the General Public License (GPL).
 15  */
 16 
 17 #define in_lock_functions(ADDR)         0
 18 
 19 #define assert_spin_locked(lock)        do { (void)(lock); } while (0)
 20 
 21 /*
 22  * In the UP-nondebug case there's no real locking going on, so the
 23  * only thing we have to do is to keep the preempt counts and irq
 24  * flags straight, to suppress compiler warnings of unused lock
 25  * variables, and to add the proper checker annotations:
 26  */
 27 #define __LOCK(lock) \
 28   do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)
 29 
 30 #define __LOCK_BH(lock) \
 31   do { local_bh_disable(); __LOCK(lock); } while (0)
 32 
 33 #define __LOCK_IRQ(lock) \
 34   do { local_irq_disable(); __LOCK(lock); } while (0)
 35 
 36 #define __LOCK_IRQSAVE(lock) \
 37   ({ unsigned long __flags; local_irq_save(__flags); __LOCK(lock); __flags; })
 38 
 39 #define __TRYLOCK_IRQSAVE(lock, flags) \
 40         ({ local_irq_save(*(flags)); __LOCK(lock); 1; })
 41 
 42 #define __spin_trylock_irqsave(lock, flags)     __TRYLOCK_IRQSAVE(lock, flags)
 43 
 44 #define __write_trylock_irqsave(lock, flags)    __TRYLOCK_IRQSAVE(lock, flags)
 45 
 46 #define __UNLOCK(lock) \
 47   do { preempt_enable(); __release(lock); (void)(lock); } while (0)
 48 
 49 #define __UNLOCK_NO_RESCHED(lock) \
 50   do { __preempt_enable_no_resched(); __release(lock); (void)(lock); } while (0)
 51 
 52 #define __UNLOCK_BH(lock) \
 53   do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)
 54 
 55 #define __UNLOCK_IRQ(lock) \
 56   do { local_irq_enable(); __UNLOCK(lock); } while (0)
 57 
 58 #define __UNLOCK_IRQRESTORE(lock, flags) \
 59   do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
 60 
 61 #define __spin_lock(lock)                       __LOCK(lock)
 62 #define __spin_lock_nested(lock, subclass)      __LOCK(lock)
 63 #define __read_lock(lock)                       __LOCK(lock)
 64 #define __write_lock(lock)                      __LOCK(lock)
 65 #define __spin_lock_bh(lock)                    __LOCK_BH(lock)
 66 #define __read_lock_bh(lock)                    __LOCK_BH(lock)
 67 #define __write_lock_bh(lock)                   __LOCK_BH(lock)
 68 #define __spin_lock_irq(lock)                   __LOCK_IRQ(lock)
 69 #define __read_lock_irq(lock)                   __LOCK_IRQ(lock)
 70 #define __write_lock_irq(lock)                  __LOCK_IRQ(lock)
 71 #define __spin_lock_irqsave(lock)               __LOCK_IRQSAVE(lock)
 72 #define __read_lock_irqsave(lock)               __LOCK_IRQSAVE(lock)
 73 #define __write_lock_irqsave(lock)              __LOCK_IRQSAVE(lock)
 74 #define __spin_trylock(lock)                    ({ __LOCK(lock); 1; })
 75 #define __read_trylock(lock)                    ({ __LOCK(lock); 1; })
 76 #define __write_trylock(lock)                   ({ __LOCK(lock); 1; })
 77 #define __spin_trylock_bh(lock)                 ({ __LOCK_BH(lock); 1; })
 78 #define __spin_trylock_irq(lock)                ({ __LOCK_IRQ(lock); 1; })
 79 #define __spin_unlock(lock)                     __UNLOCK(lock)
 80 #define __spin_unlock_no_resched(lock)          __UNLOCK_NO_RESCHED(lock)
 81 #define __read_unlock(lock)                     __UNLOCK(lock)
 82 #define __write_unlock(lock)                    __UNLOCK(lock)
 83 #define __spin_unlock_bh(lock)                  __UNLOCK_BH(lock)
 84 #define __write_unlock_bh(lock)                 __UNLOCK_BH(lock)
 85 #define __read_unlock_bh(lock)                  __UNLOCK_BH(lock)
 86 #define __spin_unlock_irq(lock)                 __UNLOCK_IRQ(lock)
 87 #define __read_unlock_irq(lock)                 __UNLOCK_IRQ(lock)
 88 #define __write_unlock_irq(lock)                __UNLOCK_IRQ(lock)
 89 #define __spin_unlock_irqrestore(lock, flags)   __UNLOCK_IRQRESTORE(lock, flags)
 90 #define __read_unlock_irqrestore(lock, flags)   __UNLOCK_IRQRESTORE(lock, flags)
 91 #define __write_unlock_irqrestore(lock, flags)  __UNLOCK_IRQRESTORE(lock, flags)
 92 
 93 #endif /* __LINUX_SPINLOCK_API_UP_H */
 94 
  This page was automatically generated by the LXR engine.