aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/toshiba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/toshiba.c')
-rw-r--r--drivers/char/toshiba.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index f8bc79f6de34..014c9d90d297 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -68,7 +68,7 @@
68#include <linux/stat.h> 68#include <linux/stat.h>
69#include <linux/proc_fs.h> 69#include <linux/proc_fs.h>
70#include <linux/seq_file.h> 70#include <linux/seq_file.h>
71#include <linux/smp_lock.h> 71#include <linux/mutex.h>
72#include <linux/toshiba.h> 72#include <linux/toshiba.h>
73 73
74#define TOSH_MINOR_DEV 181 74#define TOSH_MINOR_DEV 181
@@ -78,6 +78,7 @@ MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
78MODULE_DESCRIPTION("Toshiba laptop SMM driver"); 78MODULE_DESCRIPTION("Toshiba laptop SMM driver");
79MODULE_SUPPORTED_DEVICE("toshiba"); 79MODULE_SUPPORTED_DEVICE("toshiba");
80 80
81static DEFINE_MUTEX(tosh_mutex);
81static int tosh_fn; 82static int tosh_fn;
82module_param_named(fn, tosh_fn, int, 0); 83module_param_named(fn, tosh_fn, int, 0);
83MODULE_PARM_DESC(fn, "User specified Fn key detection port"); 84MODULE_PARM_DESC(fn, "User specified Fn key detection port");
@@ -95,6 +96,7 @@ static long tosh_ioctl(struct file *, unsigned int,
95static const struct file_operations tosh_fops = { 96static const struct file_operations tosh_fops = {
96 .owner = THIS_MODULE, 97 .owner = THIS_MODULE,
97 .unlocked_ioctl = tosh_ioctl, 98 .unlocked_ioctl = tosh_ioctl,
99 .llseek = noop_llseek,
98}; 100};
99 101
100static struct miscdevice tosh_device = { 102static struct miscdevice tosh_device = {
@@ -274,16 +276,16 @@ static long tosh_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
274 return -EINVAL; 276 return -EINVAL;
275 277
276 /* do we need to emulate the fan ? */ 278 /* do we need to emulate the fan ? */
277 lock_kernel(); 279 mutex_lock(&tosh_mutex);
278 if (tosh_fan==1) { 280 if (tosh_fan==1) {
279 if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { 281 if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) {
280 err = tosh_emulate_fan(&regs); 282 err = tosh_emulate_fan(&regs);
281 unlock_kernel(); 283 mutex_unlock(&tosh_mutex);
282 break; 284 break;
283 } 285 }
284 } 286 }
285 err = tosh_smm(&regs); 287 err = tosh_smm(&regs);
286 unlock_kernel(); 288 mutex_unlock(&tosh_mutex);
287 break; 289 break;
288 default: 290 default:
289 return -EINVAL; 291 return -EINVAL;