]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/macintosh/via-pmu.c
nilfs2: fix problems of memory allocation in ioctl
[linux-2.6-omap-h63xx.git] / drivers / macintosh / via-pmu.c
index d6365a9f0637407f020b901423dd1d06d851edeb..b40fb9b6c862c3bdecd5b21ebbd5ef20e1fd7434 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 #include <stdarg.h>
+#include <linux/smp_lock.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -1813,7 +1814,7 @@ static int powerbook_sleep_grackle(void)
                _set_L2CR(save_l2cr);
        
        /* Restore userland MMU context */
-       set_context(current->active_mm->context.id, current->active_mm->pgd);
+       switch_mmu_context(NULL, current->active_mm);
 
        /* Power things up */
        pmu_unlock();
@@ -1902,7 +1903,7 @@ powerbook_sleep_Core99(void)
                _set_L3CR(save_l3cr);
        
        /* Restore userland MMU context */
-       set_context(current->active_mm->context.id, current->active_mm->pgd);
+       switch_mmu_context(NULL, current->active_mm);
 
        /* Tell PMU we are ready */
        pmu_unlock();
@@ -2047,6 +2048,7 @@ pmu_open(struct inode *inode, struct file *file)
        pp->rb_get = pp->rb_put = 0;
        spin_lock_init(&pp->lock);
        init_waitqueue_head(&pp->wait);
+       lock_kernel();
        spin_lock_irqsave(&all_pvt_lock, flags);
 #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
        pp->backlight_locker = 0;
@@ -2054,6 +2056,7 @@ pmu_open(struct inode *inode, struct file *file)
        list_add(&pp->list, &all_pmu_pvt);
        spin_unlock_irqrestore(&all_pvt_lock, flags);
        file->private_data = pp;
+       unlock_kernel();
        return 0;
 }