Commit e4039bb2 authored by Robert Love's avatar Robert Love Committed by Trond Myklebust

[PATCH] spinlock.h cleanup

 - cleanup #defines: I do not follow the rationale behind the
   odd line-wrapped defines at the beginning of the file.  If
   we have to use multiple lines, then we might as well do so
   cleanly and according to normal practice...

 - Remove a level of indirection: do not have spin_lock_foo
   use spin_lock - just explicitly call what is needed.

 - we do not need to define the spin_lock functions twice, once
   for CONFIG_PREEMPT and once for !CONFIG_PREEMPT.  Defining
   them once with the preempt macros will optimize away fine.

 - cleanup preempt.h too

 - other misc. cleanup, improved comments, reordering, etc.
parent 1edfa642
#ifndef __LINUX_PREEMPT_H
#define __LINUX_PREEMPT_H
/*
* include/linux/preempt.h - macros for accessing and manipulating
* preempt_count (used for kernel preemption, interrupt count, etc.)
*/
#include <linux/config.h>
#define preempt_count() (current_thread_info()->preempt_count)
#define preempt_count() (current_thread_info()->preempt_count)
#define inc_preempt_count() \
do { \
......@@ -31,17 +36,16 @@ do { \
barrier(); \
} while (0)
#define preempt_enable() \
#define preempt_check_resched() \
do { \
preempt_enable_no_resched(); \
if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
preempt_schedule(); \
} while (0)
#define preempt_check_resched() \
#define preempt_enable() \
do { \
if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
preempt_schedule(); \
preempt_enable_no_resched(); \
preempt_check_resched(); \
} while (0)
#define inc_preempt_count_non_preempt() do { } while (0)
......@@ -50,7 +54,7 @@ do { \
#else
#define preempt_disable() do { } while (0)
#define preempt_enable_no_resched() do {} while(0)
#define preempt_enable_no_resched() do { } while (0)
#define preempt_enable() do { } while (0)
#define preempt_check_resched() do { } while (0)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment