|
33 | 33 | #include <linux/kernel.h> |
34 | 34 | #include <linux/errno.h> |
35 | 35 | #include <linux/slab.h> |
36 | | -#include <linux/smp_lock.h> |
| 36 | +#include <linux/mutex.h> |
37 | 37 | #include <linux/string.h> |
38 | 38 | #include <linux/miscdevice.h> |
39 | 39 | #include <linux/init.h> |
@@ -61,6 +61,7 @@ typedef struct openprom_private_data |
61 | 61 | } DATA; |
62 | 62 |
|
63 | 63 | /* ID of the PROM node containing all of the EEPROM options. */ |
| 64 | +static DEFINE_MUTEX(openprom_mutex); |
64 | 65 | static struct device_node *options_node; |
65 | 66 |
|
66 | 67 | /* |
@@ -316,7 +317,7 @@ static long openprom_sunos_ioctl(struct file * file, |
316 | 317 | if (bufsize < 0) |
317 | 318 | return bufsize; |
318 | 319 |
|
319 | | - lock_kernel(); |
| 320 | + mutex_lock(&openprom_mutex); |
320 | 321 |
|
321 | 322 | switch (cmd) { |
322 | 323 | case OPROMGETOPT: |
@@ -367,7 +368,7 @@ static long openprom_sunos_ioctl(struct file * file, |
367 | 368 | } |
368 | 369 |
|
369 | 370 | kfree(opp); |
370 | | - unlock_kernel(); |
| 371 | + mutex_unlock(&openprom_mutex); |
371 | 372 |
|
372 | 373 | return error; |
373 | 374 | } |
@@ -558,7 +559,7 @@ static int openprom_bsd_ioctl(struct file * file, |
558 | 559 | void __user *argp = (void __user *)arg; |
559 | 560 | int err; |
560 | 561 |
|
561 | | - lock_kernel(); |
| 562 | + mutex_lock(&openprom_mutex); |
562 | 563 | switch (cmd) { |
563 | 564 | case OPIOCGET: |
564 | 565 | err = opiocget(argp, data); |
@@ -589,7 +590,7 @@ static int openprom_bsd_ioctl(struct file * file, |
589 | 590 | err = -EINVAL; |
590 | 591 | break; |
591 | 592 | }; |
592 | | - unlock_kernel(); |
| 593 | + mutex_unlock(&openprom_mutex); |
593 | 594 |
|
594 | 595 | return err; |
595 | 596 | } |
@@ -697,11 +698,11 @@ static int openprom_open(struct inode * inode, struct file * file) |
697 | 698 | if (!data) |
698 | 699 | return -ENOMEM; |
699 | 700 |
|
700 | | - lock_kernel(); |
| 701 | + mutex_lock(&openprom_mutex); |
701 | 702 | data->current_node = of_find_node_by_path("/"); |
702 | 703 | data->lastnode = data->current_node; |
703 | 704 | file->private_data = (void *) data; |
704 | | - unlock_kernel(); |
| 705 | + mutex_unlock(&openprom_mutex); |
705 | 706 |
|
706 | 707 | return 0; |
707 | 708 | } |
|
0 commit comments