]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] sem2mutex: kprobes
authorIngo Molnar <mingo@elte.hu>
Thu, 23 Mar 2006 11:00:35 +0000 (03:00 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 23 Mar 2006 15:38:12 +0000 (07:38 -0800)
Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/kprobes.c
arch/powerpc/kernel/kprobes.c
arch/x86_64/kernel/kprobes.c
include/linux/kprobes.h
kernel/kprobes.c

index 694a13997637486eefa48313b1d68c37b113d41e..7a59050242a7ca58f5786ba11e4cd5c83077a51a 100644 (file)
@@ -84,9 +84,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
 
 void __kprobes arch_remove_kprobe(struct kprobe *p)
 {
-       down(&kprobe_mutex);
+       mutex_lock(&kprobe_mutex);
        free_insn_slot(p->ainsn.insn);
-       up(&kprobe_mutex);
+       mutex_unlock(&kprobe_mutex);
 }
 
 static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
index 258039fb301642d70057192f0ca443fbc9621e48..cb1fe5878e8b73724ef86056962e2d5dc37e58fe 100644 (file)
@@ -81,9 +81,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
 
 void __kprobes arch_remove_kprobe(struct kprobe *p)
 {
-       down(&kprobe_mutex);
+       mutex_lock(&kprobe_mutex);
        free_insn_slot(p->ainsn.insn);
-       up(&kprobe_mutex);
+       mutex_unlock(&kprobe_mutex);
 }
 
 static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
index 8b866a8572cfab92546ff539b185799d695c07dc..14f0ced613b683706f6d360c8ef835b2b9243d08 100644 (file)
@@ -222,9 +222,9 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
 
 void __kprobes arch_remove_kprobe(struct kprobe *p)
 {
-       down(&kprobe_mutex);
+       mutex_lock(&kprobe_mutex);
        free_insn_slot(p->ainsn.insn);
-       up(&kprobe_mutex);
+       mutex_unlock(&kprobe_mutex);
 }
 
 static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
index 669756bc20a220faebad33b63c268f5ca6add844..778adc0fa640ea9c2d3a9d819af5b505ab4dc63f 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/percpu.h>
 #include <linux/spinlock.h>
 #include <linux/rcupdate.h>
+#include <linux/mutex.h>
 
 #ifdef CONFIG_KPROBES
 #include <asm/kprobes.h>
@@ -152,7 +153,7 @@ struct kretprobe_instance {
 };
 
 extern spinlock_t kretprobe_lock;
-extern struct semaphore kprobe_mutex;
+extern struct mutex kprobe_mutex;
 extern int arch_prepare_kprobe(struct kprobe *p);
 extern void arch_arm_kprobe(struct kprobe *p);
 extern void arch_disarm_kprobe(struct kprobe *p);
index fef1af8a73ce07818862eb434c29b62468e99323..1fb9f753ef6071c636701f6e0921f103e9f6aafc 100644 (file)
@@ -48,7 +48,7 @@
 static struct hlist_head kprobe_table[KPROBE_TABLE_SIZE];
 static struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE];
 
-DECLARE_MUTEX(kprobe_mutex);           /* Protects kprobe_table */
+DEFINE_MUTEX(kprobe_mutex);            /* Protects kprobe_table */
 DEFINE_SPINLOCK(kretprobe_lock);       /* Protects kretprobe_inst_table */
 static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL;
 
@@ -460,7 +460,7 @@ static int __kprobes __register_kprobe(struct kprobe *p,
        }
 
        p->nmissed = 0;
-       down(&kprobe_mutex);
+       mutex_lock(&kprobe_mutex);
        old_p = get_kprobe(p->addr);
        if (old_p) {
                ret = register_aggr_kprobe(old_p, p);
@@ -477,7 +477,7 @@ static int __kprobes __register_kprobe(struct kprobe *p,
        arch_arm_kprobe(p);
 
 out:
-       up(&kprobe_mutex);
+       mutex_unlock(&kprobe_mutex);
 
        if (ret && probed_mod)
                module_put(probed_mod);
@@ -496,10 +496,10 @@ void __kprobes unregister_kprobe(struct kprobe *p)
        struct kprobe *old_p, *list_p;
        int cleanup_p;
 
-       down(&kprobe_mutex);
+       mutex_lock(&kprobe_mutex);
        old_p = get_kprobe(p->addr);
        if (unlikely(!old_p)) {
-               up(&kprobe_mutex);
+               mutex_unlock(&kprobe_mutex);
                return;
        }
        if (p != old_p) {
@@ -507,7 +507,7 @@ void __kprobes unregister_kprobe(struct kprobe *p)
                        if (list_p == p)
                        /* kprobe p is a valid probe */
                                goto valid_p;
-               up(&kprobe_mutex);
+               mutex_unlock(&kprobe_mutex);
                return;
        }
 valid_p:
@@ -523,7 +523,7 @@ valid_p:
                cleanup_p = 0;
        }
 
-       up(&kprobe_mutex);
+       mutex_unlock(&kprobe_mutex);
 
        synchronize_sched();
        if (p->mod_refcounted &&