]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/parisc/kernel/perf.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6
[linux-2.6-omap-h63xx.git] / arch / parisc / kernel / perf.c
index 89d6d5ad44b5258f4ff61ae487c8ed1020bf115b..75099efb3bf37bc4c2695611b5f04162b4eb67de 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/miscdevice.h>
+#include <linux/smp_lock.h>
 #include <linux/spinlock.h>
 
 #include <asm/uaccess.h>
@@ -260,13 +261,16 @@ printk("Preparing to start counters\n");
  */
 static int perf_open(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        spin_lock(&perf_lock);
        if (perf_enabled) {
                spin_unlock(&perf_lock);
+               unlock_kernel();
                return -EBUSY;
        }
        perf_enabled = 1;
        spin_unlock(&perf_lock);
+       unlock_kernel();
 
        return 0;
 }
@@ -537,9 +541,9 @@ static int __init perf_init(void)
        spin_lock_init(&perf_lock);
 
        /* TODO: this only lets us access the first cpu.. what to do for SMP? */
-       cpu_device = cpu_data[0].dev;
+       cpu_device = per_cpu(cpu_data, 0).dev;
        printk("Performance monitoring counters enabled for %s\n",
-               cpu_data[0].dev->name);
+               per_cpu(cpu_data, 0).dev->name);
 
        return 0;
 }