Commit a15032a6 authored by Thomas Gleixner's avatar Thomas Gleixner

semaphore: Remove mutex emulation

Semaphores used as mutexes have been deprecated for years. Now that
all users are either converted to real semaphores or to mutexes remove
the cruft.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 2e272570
...@@ -29,9 +29,6 @@ struct semaphore { ...@@ -29,9 +29,6 @@ struct semaphore {
#define DEFINE_SEMAPHORE(name) \ #define DEFINE_SEMAPHORE(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
#define DECLARE_MUTEX(name) \
struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
static inline void sema_init(struct semaphore *sem, int val) static inline void sema_init(struct semaphore *sem, int val)
{ {
static struct lock_class_key __key; static struct lock_class_key __key;
...@@ -53,9 +50,6 @@ static inline void __deprecated semaphore_init_locked(struct semaphore *sem) ...@@ -53,9 +50,6 @@ static inline void __deprecated semaphore_init_locked(struct semaphore *sem)
sema_init(sem, 0); sema_init(sem, 0);
} }
#define init_MUTEX(sem) sema_init(sem, 1)
#define init_MUTEX_LOCKED(sem) sema_init(sem, 0)
extern void down(struct semaphore *sem); extern void down(struct semaphore *sem);
extern int __must_check down_interruptible(struct semaphore *sem); extern int __must_check down_interruptible(struct semaphore *sem);
extern int __must_check down_killable(struct semaphore *sem); extern int __must_check down_killable(struct semaphore *sem);
......
...@@ -2512,14 +2512,11 @@ sub process { ...@@ -2512,14 +2512,11 @@ sub process {
WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
} }
# check for semaphores used as mutexes # check for semaphores initialized locked
if ($line =~ /^.\s*(DECLARE_MUTEX|init_MUTEX)\s*\(/) { if ($line =~ /^.\s*semaphore_init_locked\s*\(/) {
WARN("mutexes are preferred for single holder semaphores\n" . $herecurr);
}
# check for semaphores used as mutexes
if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) {
WARN("consider using a completion\n" . $herecurr); WARN("consider using a completion\n" . $herecurr);
} }
# recommend strict_strto* over simple_strto* # recommend strict_strto* over simple_strto*
if ($line =~ /\bsimple_(strto.*?)\s*\(/) { if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
WARN("consider using strict_$1 in preference to simple_$1\n" . $herecurr); WARN("consider using strict_$1 in preference to simple_$1\n" . $herecurr);
......
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