#include <linux/miscdevice.h>
#include <linux/ioport.h> /* request_region */
#include <linux/slab.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <asm/atomic.h>
#define DRIVER_NAME "d7s"
#define PFX DRIVER_NAME ": "
+static DEFINE_MUTEX(d7s_mutex);
static int sol_compat = 0; /* Solaris compatibility mode */
/* Solaris compatibility flag -
{
if (D7S_MINOR != iminor(inode))
return -ENODEV;
- cycle_kernel_lock();
atomic_inc(&d7s_users);
return 0;
}
if (D7S_MINOR != iminor(file->f_path.dentry->d_inode))
return -ENODEV;
- lock_kernel();
+ mutex_lock(&d7s_mutex);
switch (cmd) {
case D7SIOCWR:
/* assign device register values we mask-out D7S_FLIP
writeb(regs, p->regs);
break;
};
- unlock_kernel();
+ mutex_unlock(&d7s_mutex);
return error;
}
#include <linux/kmod.h>
#include <linux/reboot.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
#include <linux/of.h>
#include <linux/of_device.h>
static int
envctrl_open(struct inode *inode, struct file *file)
{
- cycle_kernel_lock();
file->private_data = NULL;
return 0;
}
#include <linux/fcntl.h>
#include <linux/poll.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/of.h>
#include <asm/io.h>
#include <asm/upa.h>
+static DEFINE_MUTEX(flash_mutex);
static DEFINE_SPINLOCK(flash_lock);
static struct {
unsigned long read_base; /* Physical read address */
static long long
flash_llseek(struct file *file, long long offset, int origin)
{
- lock_kernel();
+ mutex_lock(&flash_mutex);
switch (origin) {
case 0:
file->f_pos = offset;
file->f_pos = flash.read_size;
break;
default:
- unlock_kernel();
+ mutex_unlock(&flash_mutex);
return -EINVAL;
}
- unlock_kernel();
+ mutex_unlock(&flash_mutex);
return file->f_pos;
}
static int
flash_open(struct inode *inode, struct file *file)
{
- lock_kernel();
+ mutex_lock(&flash_mutex);
if (test_and_set_bit(0, (void *)&flash.busy) != 0) {
- unlock_kernel();
+ mutex_unlock(&flash_mutex);
return -EBUSY;
}
- unlock_kernel();
+ mutex_unlock(&flash_mutex);
return 0;
}
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <linux/string.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
} DATA;
/* ID of the PROM node containing all of the EEPROM options. */
+static DEFINE_MUTEX(openprom_mutex);
static struct device_node *options_node;
/*
if (bufsize < 0)
return bufsize;
- lock_kernel();
+ mutex_lock(&openprom_mutex);
switch (cmd) {
case OPROMGETOPT:
}
kfree(opp);
- unlock_kernel();
+ mutex_unlock(&openprom_mutex);
return error;
}
void __user *argp = (void __user *)arg;
int err;
- lock_kernel();
+ mutex_lock(&openprom_mutex);
switch (cmd) {
case OPIOCGET:
err = opiocget(argp, data);
err = -EINVAL;
break;
};
- unlock_kernel();
+ mutex_unlock(&openprom_mutex);
return err;
}
if (!data)
return -ENOMEM;
- lock_kernel();
+ mutex_lock(&openprom_mutex);
data->current_node = of_find_node_by_path("/");
data->lastnode = data->current_node;
file->private_data = (void *) data;
- unlock_kernel();
+ mutex_unlock(&openprom_mutex);
return 0;
}
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
#define UCTRL_STAT_RXNE_STA 0x04 /* receive FIFO not empty status */
#define UCTRL_STAT_RXO_STA 0x08 /* receive FIFO overflow status */
+static DEFINE_MUTEX(uctrl_mutex);
static const char *uctrl_extstatus[16] = {
"main power available",
"internal battery attached",
static int
uctrl_open(struct inode *inode, struct file *file)
{
- lock_kernel();
+ mutex_lock(&uctrl_mutex);
uctrl_get_event_status(global_driver);
uctrl_get_external_status(global_driver);
- unlock_kernel();
+ mutex_unlock(&uctrl_mutex);
return 0;
}