aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/i8k.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/i8k.c')
-rw-r--r--drivers/char/i8k.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index fc8cf7ac7f2b..3bc0eef88717 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -23,6 +23,7 @@
23#include <linux/seq_file.h> 23#include <linux/seq_file.h>
24#include <linux/dmi.h> 24#include <linux/dmi.h>
25#include <linux/capability.h> 25#include <linux/capability.h>
26#include <linux/mutex.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
27#include <asm/io.h> 28#include <asm/io.h>
28 29
@@ -55,6 +56,7 @@
55 56
56#define I8K_TEMPERATURE_BUG 1 57#define I8K_TEMPERATURE_BUG 1
57 58
59static DEFINE_MUTEX(i8k_mutex);
58static char bios_version[4]; 60static char bios_version[4];
59 61
60MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); 62MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)");
@@ -82,8 +84,7 @@ module_param(fan_mult, int, 0);
82MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with"); 84MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with");
83 85
84static int i8k_open_fs(struct inode *inode, struct file *file); 86static int i8k_open_fs(struct inode *inode, struct file *file);
85static int i8k_ioctl(struct inode *, struct file *, unsigned int, 87static long i8k_ioctl(struct file *, unsigned int, unsigned long);
86 unsigned long);
87 88
88static const struct file_operations i8k_fops = { 89static const struct file_operations i8k_fops = {
89 .owner = THIS_MODULE, 90 .owner = THIS_MODULE,
@@ -91,7 +92,7 @@ static const struct file_operations i8k_fops = {
91 .read = seq_read, 92 .read = seq_read,
92 .llseek = seq_lseek, 93 .llseek = seq_lseek,
93 .release = single_release, 94 .release = single_release,
94 .ioctl = i8k_ioctl, 95 .unlocked_ioctl = i8k_ioctl,
95}; 96};
96 97
97struct smm_regs { 98struct smm_regs {
@@ -307,8 +308,8 @@ static int i8k_get_dell_signature(int req_fn)
307 return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1; 308 return regs.eax == 1145651527 && regs.edx == 1145392204 ? 0 : -1;
308} 309}
309 310
310static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, 311static int
311 unsigned long arg) 312i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg)
312{ 313{
313 int val = 0; 314 int val = 0;
314 int speed; 315 int speed;
@@ -395,6 +396,17 @@ static int i8k_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
395 return 0; 396 return 0;
396} 397}
397 398
399static long i8k_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
400{
401 long ret;
402
403 mutex_lock(&i8k_mutex);
404 ret = i8k_ioctl_unlocked(fp, cmd, arg);
405 mutex_unlock(&i8k_mutex);
406
407 return ret;
408}
409
398/* 410/*
399 * Print the information for /proc/i8k. 411 * Print the information for /proc/i8k.
400 */ 412 */