Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[sfrench/cifs-2.6.git] / lib / kernel_lock.c
index 99b0ae3d51dded390d221525b2cd2389d845ca8c..e0fdfddb406ec3975673f150f46bd3302bc08599 100644 (file)
@@ -9,67 +9,12 @@
 #include <linux/module.h>
 #include <linux/kallsyms.h>
 
-#if defined(CONFIG_PREEMPT) && defined(__smp_processor_id) && \
-               defined(CONFIG_DEBUG_PREEMPT)
-
-/*
- * Debugging check.
- */
-unsigned int smp_processor_id(void)
-{
-       unsigned long preempt_count = preempt_count();
-       int this_cpu = __smp_processor_id();
-       cpumask_t this_mask;
-
-       if (likely(preempt_count))
-               goto out;
-
-       if (irqs_disabled())
-               goto out;
-
-       /*
-        * Kernel threads bound to a single CPU can safely use
-        * smp_processor_id():
-        */
-       this_mask = cpumask_of_cpu(this_cpu);
-
-       if (cpus_equal(current->cpus_allowed, this_mask))
-               goto out;
-
-       /*
-        * It is valid to assume CPU-locality during early bootup:
-        */
-       if (system_state != SYSTEM_RUNNING)
-               goto out;
-
-       /*
-        * Avoid recursion:
-        */
-       preempt_disable();
-
-       if (!printk_ratelimit())
-               goto out_enable;
-
-       printk(KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n", preempt_count(), current->comm, current->pid);
-       print_symbol("caller is %s\n", (long)__builtin_return_address(0));
-       dump_stack();
-
-out_enable:
-       preempt_enable_no_resched();
-out:
-       return this_cpu;
-}
-
-EXPORT_SYMBOL(smp_processor_id);
-
-#endif /* PREEMPT && __smp_processor_id && DEBUG_PREEMPT */
-
 #ifdef CONFIG_PREEMPT_BKL
 /*
  * The 'big kernel semaphore'
  *
  * This mutex is taken and released recursively by lock_kernel()
- * and unlock_kernel().  It is transparently dropped and reaquired
+ * and unlock_kernel().  It is transparently dropped and reacquired
  * over schedule().  It is used to protect legacy code that hasn't
  * been migrated to a proper locking design yet.
  *
@@ -147,7 +92,7 @@ void __lockfunc unlock_kernel(void)
  * The 'big kernel lock'
  *
  * This spinlock is taken and released recursively by lock_kernel()
- * and unlock_kernel().  It is transparently dropped and reaquired
+ * and unlock_kernel().  It is transparently dropped and reacquired
  * over schedule().  It is used to protect legacy code that hasn't
  * been migrated to a proper locking design yet.
  *
@@ -232,6 +177,10 @@ static inline void __lock_kernel(void)
 
 static inline void __unlock_kernel(void)
 {
+       /*
+        * the BKL is not covered by lockdep, so we open-code the
+        * unlocking sequence (and thus avoid the dep-chain ops):
+        */
        _raw_spin_unlock(&kernel_flag);
        preempt_enable();
 }