diff options
35 files changed, 216 insertions, 190 deletions
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index c397b3ddba9b..bed29cb9e6d9 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
| @@ -162,7 +162,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; | |||
| 162 | #include <linux/pg.h> | 162 | #include <linux/pg.h> |
| 163 | #include <linux/device.h> | 163 | #include <linux/device.h> |
| 164 | #include <linux/sched.h> /* current, TASK_* */ | 164 | #include <linux/sched.h> /* current, TASK_* */ |
| 165 | #include <linux/smp_lock.h> | 165 | #include <linux/mutex.h> |
| 166 | #include <linux/jiffies.h> | 166 | #include <linux/jiffies.h> |
| 167 | 167 | ||
| 168 | #include <asm/uaccess.h> | 168 | #include <asm/uaccess.h> |
| @@ -193,6 +193,7 @@ module_param_array(drive3, int, NULL, 0); | |||
| 193 | 193 | ||
| 194 | #define ATAPI_IDENTIFY 0x12 | 194 | #define ATAPI_IDENTIFY 0x12 |
| 195 | 195 | ||
| 196 | static DEFINE_MUTEX(pg_mutex); | ||
| 196 | static int pg_open(struct inode *inode, struct file *file); | 197 | static int pg_open(struct inode *inode, struct file *file); |
| 197 | static int pg_release(struct inode *inode, struct file *file); | 198 | static int pg_release(struct inode *inode, struct file *file); |
| 198 | static ssize_t pg_read(struct file *filp, char __user *buf, | 199 | static ssize_t pg_read(struct file *filp, char __user *buf, |
| @@ -518,7 +519,7 @@ static int pg_open(struct inode *inode, struct file *file) | |||
| 518 | struct pg *dev = &devices[unit]; | 519 | struct pg *dev = &devices[unit]; |
| 519 | int ret = 0; | 520 | int ret = 0; |
| 520 | 521 | ||
| 521 | lock_kernel(); | 522 | mutex_lock(&pg_mutex); |
| 522 | if ((unit >= PG_UNITS) || (!dev->present)) { | 523 | if ((unit >= PG_UNITS) || (!dev->present)) { |
| 523 | ret = -ENODEV; | 524 | ret = -ENODEV; |
| 524 | goto out; | 525 | goto out; |
| @@ -547,7 +548,7 @@ static int pg_open(struct inode *inode, struct file *file) | |||
| 547 | file->private_data = dev; | 548 | file->private_data = dev; |
| 548 | 549 | ||
| 549 | out: | 550 | out: |
| 550 | unlock_kernel(); | 551 | mutex_unlock(&pg_mutex); |
| 551 | return ret; | 552 | return ret; |
| 552 | } | 553 | } |
| 553 | 554 | ||
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index bc5825fdeaab..e4dda282e0a6 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
| @@ -146,7 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; | |||
| 146 | #include <linux/mtio.h> | 146 | #include <linux/mtio.h> |
| 147 | #include <linux/device.h> | 147 | #include <linux/device.h> |
| 148 | #include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ | 148 | #include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ |
| 149 | #include <linux/smp_lock.h> | 149 | #include <linux/mutex.h> |
| 150 | 150 | ||
| 151 | #include <asm/uaccess.h> | 151 | #include <asm/uaccess.h> |
| 152 | 152 | ||
| @@ -189,6 +189,7 @@ module_param_array(drive3, int, NULL, 0); | |||
| 189 | #define ATAPI_MODE_SENSE 0x1a | 189 | #define ATAPI_MODE_SENSE 0x1a |
| 190 | #define ATAPI_LOG_SENSE 0x4d | 190 | #define ATAPI_LOG_SENSE 0x4d |
| 191 | 191 | ||
| 192 | static DEFINE_MUTEX(pt_mutex); | ||
| 192 | static int pt_open(struct inode *inode, struct file *file); | 193 | static int pt_open(struct inode *inode, struct file *file); |
| 193 | static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 194 | static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
| 194 | static int pt_release(struct inode *inode, struct file *file); | 195 | static int pt_release(struct inode *inode, struct file *file); |
| @@ -650,9 +651,9 @@ static int pt_open(struct inode *inode, struct file *file) | |||
| 650 | struct pt_unit *tape = pt + unit; | 651 | struct pt_unit *tape = pt + unit; |
| 651 | int err; | 652 | int err; |
| 652 | 653 | ||
| 653 | lock_kernel(); | 654 | mutex_lock(&pt_mutex); |
| 654 | if (unit >= PT_UNITS || (!tape->present)) { | 655 | if (unit >= PT_UNITS || (!tape->present)) { |
| 655 | unlock_kernel(); | 656 | mutex_unlock(&pt_mutex); |
| 656 | return -ENODEV; | 657 | return -ENODEV; |
| 657 | } | 658 | } |
| 658 | 659 | ||
| @@ -681,12 +682,12 @@ static int pt_open(struct inode *inode, struct file *file) | |||
| 681 | } | 682 | } |
| 682 | 683 | ||
| 683 | file->private_data = tape; | 684 | file->private_data = tape; |
| 684 | unlock_kernel(); | 685 | mutex_unlock(&pt_mutex); |
| 685 | return 0; | 686 | return 0; |
| 686 | 687 | ||
| 687 | out: | 688 | out: |
| 688 | atomic_inc(&tape->available); | 689 | atomic_inc(&tape->available); |
| 689 | unlock_kernel(); | 690 | mutex_unlock(&pt_mutex); |
| 690 | return err; | 691 | return err; |
| 691 | } | 692 | } |
| 692 | 693 | ||
| @@ -704,15 +705,15 @@ static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 704 | switch (mtop.mt_op) { | 705 | switch (mtop.mt_op) { |
| 705 | 706 | ||
| 706 | case MTREW: | 707 | case MTREW: |
| 707 | lock_kernel(); | 708 | mutex_lock(&pt_mutex); |
| 708 | pt_rewind(tape); | 709 | pt_rewind(tape); |
| 709 | unlock_kernel(); | 710 | mutex_unlock(&pt_mutex); |
| 710 | return 0; | 711 | return 0; |
| 711 | 712 | ||
| 712 | case MTWEOF: | 713 | case MTWEOF: |
| 713 | lock_kernel(); | 714 | mutex_lock(&pt_mutex); |
| 714 | pt_write_fm(tape); | 715 | pt_write_fm(tape); |
| 715 | unlock_kernel(); | 716 | mutex_unlock(&pt_mutex); |
| 716 | return 0; | 717 | return 0; |
| 717 | 718 | ||
| 718 | default: | 719 | default: |
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index 033e1505fca9..6a420baea268 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| 14 | #include <linux/poll.h> | 14 | #include <linux/poll.h> |
| 15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 16 | #include <linux/smp_lock.h> | 16 | #include <linux/mutex.h> |
| 17 | #include <linux/proc_fs.h> | 17 | #include <linux/proc_fs.h> |
| 18 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
| 19 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
| @@ -126,6 +126,7 @@ struct apm_user { | |||
| 126 | /* | 126 | /* |
| 127 | * Local variables | 127 | * Local variables |
| 128 | */ | 128 | */ |
| 129 | static DEFINE_MUTEX(apm_mutex); | ||
| 129 | static atomic_t suspend_acks_pending = ATOMIC_INIT(0); | 130 | static atomic_t suspend_acks_pending = ATOMIC_INIT(0); |
| 130 | static atomic_t userspace_notification_inhibit = ATOMIC_INIT(0); | 131 | static atomic_t userspace_notification_inhibit = ATOMIC_INIT(0); |
| 131 | static int apm_disabled; | 132 | static int apm_disabled; |
| @@ -274,7 +275,7 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg) | |||
| 274 | if (!as->suser || !as->writer) | 275 | if (!as->suser || !as->writer) |
| 275 | return -EPERM; | 276 | return -EPERM; |
| 276 | 277 | ||
| 277 | lock_kernel(); | 278 | mutex_lock(&apm_mutex); |
| 278 | switch (cmd) { | 279 | switch (cmd) { |
| 279 | case APM_IOC_SUSPEND: | 280 | case APM_IOC_SUSPEND: |
| 280 | mutex_lock(&state_lock); | 281 | mutex_lock(&state_lock); |
| @@ -335,7 +336,7 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg) | |||
| 335 | mutex_unlock(&state_lock); | 336 | mutex_unlock(&state_lock); |
| 336 | break; | 337 | break; |
| 337 | } | 338 | } |
| 338 | unlock_kernel(); | 339 | mutex_unlock(&apm_mutex); |
| 339 | 340 | ||
| 340 | return err; | 341 | return err; |
| 341 | } | 342 | } |
| @@ -370,7 +371,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
| 370 | { | 371 | { |
| 371 | struct apm_user *as; | 372 | struct apm_user *as; |
| 372 | 373 | ||
| 373 | lock_kernel(); | 374 | mutex_lock(&apm_mutex); |
| 374 | as = kzalloc(sizeof(*as), GFP_KERNEL); | 375 | as = kzalloc(sizeof(*as), GFP_KERNEL); |
| 375 | if (as) { | 376 | if (as) { |
| 376 | /* | 377 | /* |
| @@ -390,7 +391,7 @@ static int apm_open(struct inode * inode, struct file * filp) | |||
| 390 | 391 | ||
| 391 | filp->private_data = as; | 392 | filp->private_data = as; |
| 392 | } | 393 | } |
| 393 | unlock_kernel(); | 394 | mutex_unlock(&apm_mutex); |
| 394 | 395 | ||
| 395 | return as ? 0 : -ENOMEM; | 396 | return as ? 0 : -ENOMEM; |
| 396 | } | 397 | } |
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index f4ae0e0fb631..e7ba774beda6 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
| 29 | #include <linux/smp_lock.h> | 29 | #include <linux/mutex.h> |
| 30 | #include <linux/miscdevice.h> | 30 | #include <linux/miscdevice.h> |
| 31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 32 | #include <linux/wait.h> | 32 | #include <linux/wait.h> |
| @@ -60,6 +60,7 @@ | |||
| 60 | #define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 | 60 | #define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | static DEFINE_MUTEX(ac_mutex); | ||
| 63 | static char *applicom_pci_devnames[] = { | 64 | static char *applicom_pci_devnames[] = { |
| 64 | "PCI board", | 65 | "PCI board", |
| 65 | "PCI2000IBS / PCI2000CAN", | 66 | "PCI2000IBS / PCI2000CAN", |
| @@ -707,7 +708,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 707 | if (IS_ERR(adgl)) | 708 | if (IS_ERR(adgl)) |
| 708 | return PTR_ERR(adgl); | 709 | return PTR_ERR(adgl); |
| 709 | 710 | ||
| 710 | lock_kernel(); | 711 | mutex_lock(&ac_mutex); |
| 711 | IndexCard = adgl->num_card-1; | 712 | IndexCard = adgl->num_card-1; |
| 712 | 713 | ||
| 713 | if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) { | 714 | if(cmd != 6 && ((IndexCard >= MAX_BOARD) || !apbs[IndexCard].RamIO)) { |
| @@ -717,7 +718,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 717 | warncount--; | 718 | warncount--; |
| 718 | } | 719 | } |
| 719 | kfree(adgl); | 720 | kfree(adgl); |
| 720 | unlock_kernel(); | 721 | mutex_unlock(&ac_mutex); |
| 721 | return -EINVAL; | 722 | return -EINVAL; |
| 722 | } | 723 | } |
| 723 | 724 | ||
| @@ -835,7 +836,7 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 835 | } | 836 | } |
| 836 | Dummy = readb(apbs[IndexCard].RamIO + VERS); | 837 | Dummy = readb(apbs[IndexCard].RamIO + VERS); |
| 837 | kfree(adgl); | 838 | kfree(adgl); |
| 838 | unlock_kernel(); | 839 | mutex_unlock(&ac_mutex); |
| 839 | return 0; | 840 | return 0; |
| 840 | } | 841 | } |
| 841 | 842 | ||
diff --git a/drivers/char/ds1302.c b/drivers/char/ds1302.c index 170693c93c73..e3d72aa3cbd2 100644 --- a/drivers/char/ds1302.c +++ b/drivers/char/ds1302.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <linux/miscdevice.h> | 20 | #include <linux/miscdevice.h> |
| 21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
| 22 | #include <linux/bcd.h> | 22 | #include <linux/bcd.h> |
| 23 | #include <linux/smp_lock.h> | 23 | #include <linux/mutex.h> |
| 24 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
| 25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
| 26 | 26 | ||
| @@ -32,6 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | #define RTC_MAJOR_NR 121 /* local major, change later */ | 33 | #define RTC_MAJOR_NR 121 /* local major, change later */ |
| 34 | 34 | ||
| 35 | static DEFINE_MUTEX(rtc_mutex); | ||
| 35 | static const char ds1302_name[] = "ds1302"; | 36 | static const char ds1302_name[] = "ds1302"; |
| 36 | 37 | ||
| 37 | /* Send 8 bits. */ | 38 | /* Send 8 bits. */ |
| @@ -164,9 +165,9 @@ static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 164 | struct rtc_time rtc_tm; | 165 | struct rtc_time rtc_tm; |
| 165 | 166 | ||
| 166 | memset(&rtc_tm, 0, sizeof (struct rtc_time)); | 167 | memset(&rtc_tm, 0, sizeof (struct rtc_time)); |
| 167 | lock_kernel(); | 168 | mutex_lock(&rtc_mutex); |
| 168 | get_rtc_time(&rtc_tm); | 169 | get_rtc_time(&rtc_tm); |
| 169 | unlock_kernel(); | 170 | mutex_unlock(&rtc_mutex); |
| 170 | if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time))) | 171 | if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time))) |
| 171 | return -EFAULT; | 172 | return -EFAULT; |
| 172 | return 0; | 173 | return 0; |
| @@ -218,7 +219,7 @@ static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 218 | mon = bin2bcd(mon); | 219 | mon = bin2bcd(mon); |
| 219 | yrs = bin2bcd(yrs); | 220 | yrs = bin2bcd(yrs); |
| 220 | 221 | ||
| 221 | lock_kernel(); | 222 | mutex_lock(&rtc_mutex); |
| 222 | local_irq_save(flags); | 223 | local_irq_save(flags); |
| 223 | CMOS_WRITE(yrs, RTC_YEAR); | 224 | CMOS_WRITE(yrs, RTC_YEAR); |
| 224 | CMOS_WRITE(mon, RTC_MONTH); | 225 | CMOS_WRITE(mon, RTC_MONTH); |
| @@ -227,7 +228,7 @@ static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 227 | CMOS_WRITE(min, RTC_MINUTES); | 228 | CMOS_WRITE(min, RTC_MINUTES); |
| 228 | CMOS_WRITE(sec, RTC_SECONDS); | 229 | CMOS_WRITE(sec, RTC_SECONDS); |
| 229 | local_irq_restore(flags); | 230 | local_irq_restore(flags); |
| 230 | unlock_kernel(); | 231 | mutex_unlock(&rtc_mutex); |
| 231 | 232 | ||
| 232 | /* Notice that at this point, the RTC is updated but | 233 | /* Notice that at this point, the RTC is updated but |
| 233 | * the kernel is still running with the old time. | 234 | * the kernel is still running with the old time. |
| @@ -247,10 +248,10 @@ static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 247 | if(copy_from_user(&tcs_val, (int*)arg, sizeof(int))) | 248 | if(copy_from_user(&tcs_val, (int*)arg, sizeof(int))) |
| 248 | return -EFAULT; | 249 | return -EFAULT; |
| 249 | 250 | ||
| 250 | lock_kernel(); | 251 | mutex_lock(&rtc_mutex); |
| 251 | tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F); | 252 | tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F); |
| 252 | ds1302_writereg(RTC_TRICKLECHARGER, tcs_val); | 253 | ds1302_writereg(RTC_TRICKLECHARGER, tcs_val); |
| 253 | unlock_kernel(); | 254 | mutex_unlock(&rtc_mutex); |
| 254 | return 0; | 255 | return 0; |
| 255 | } | 256 | } |
| 256 | default: | 257 | default: |
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index dbee8688f75c..9aa1fd059aea 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
| 9 | #include <linux/capability.h> | 9 | #include <linux/capability.h> |
| 10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
| 11 | #include <linux/smp_lock.h> | 11 | #include <linux/mutex.h> |
| 12 | 12 | ||
| 13 | #include <mach/hardware.h> | 13 | #include <mach/hardware.h> |
| 14 | #include <asm/mach-types.h> | 14 | #include <asm/mach-types.h> |
| @@ -34,6 +34,7 @@ | |||
| 34 | #define CFG_CPU 2 | 34 | #define CFG_CPU 2 |
| 35 | #define CFG_1SHOT 1 | 35 | #define CFG_1SHOT 1 |
| 36 | 36 | ||
| 37 | static DEFINE_MUTEX(ds1620_mutex); | ||
| 37 | static const char *fan_state[] = { "off", "on", "on (hardwired)" }; | 38 | static const char *fan_state[] = { "off", "on", "on (hardwired)" }; |
| 38 | 39 | ||
| 39 | /* | 40 | /* |
| @@ -210,7 +211,6 @@ static void ds1620_read_state(struct therm *therm) | |||
| 210 | 211 | ||
| 211 | static int ds1620_open(struct inode *inode, struct file *file) | 212 | static int ds1620_open(struct inode *inode, struct file *file) |
| 212 | { | 213 | { |
| 213 | cycle_kernel_lock(); | ||
| 214 | return nonseekable_open(inode, file); | 214 | return nonseekable_open(inode, file); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| @@ -321,9 +321,9 @@ ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 321 | { | 321 | { |
| 322 | int ret; | 322 | int ret; |
| 323 | 323 | ||
| 324 | lock_kernel(); | 324 | mutex_lock(&ds1620_mutex); |
| 325 | ret = ds1620_ioctl(file, cmd, arg); | 325 | ret = ds1620_ioctl(file, cmd, arg); |
| 326 | unlock_kernel(); | 326 | mutex_unlock(&ds1620_mutex); |
| 327 | 327 | ||
| 328 | return ret; | 328 | return ret; |
| 329 | } | 329 | } |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 8a1b28a10ef0..b3c756227e39 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
| 33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
| 34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
| 35 | #include <linux/smp_lock.h> | 35 | #include <linux/mutex.h> |
| 36 | #include <linux/firmware.h> | 36 | #include <linux/firmware.h> |
| 37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
| 38 | #include <linux/uaccess.h> /* For put_user and get_user */ | 38 | #include <linux/uaccess.h> /* For put_user and get_user */ |
| @@ -94,6 +94,7 @@ | |||
| 94 | } \ | 94 | } \ |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static DEFINE_MUTEX(dsp56k_mutex); | ||
| 97 | static struct dsp56k_device { | 98 | static struct dsp56k_device { |
| 98 | unsigned long in_use; | 99 | unsigned long in_use; |
| 99 | long maxio, timeout; | 100 | long maxio, timeout; |
| @@ -330,9 +331,9 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, | |||
| 330 | if (len > DSP56K_MAX_BINARY_LENGTH) { | 331 | if (len > DSP56K_MAX_BINARY_LENGTH) { |
| 331 | return -EINVAL; | 332 | return -EINVAL; |
| 332 | } | 333 | } |
| 333 | lock_kernel(); | 334 | mutex_lock(&dsp56k_mutex); |
| 334 | r = dsp56k_upload(bin, len); | 335 | r = dsp56k_upload(bin, len); |
| 335 | unlock_kernel(); | 336 | mutex_unlock(&dsp56k_mutex); |
| 336 | if (r < 0) { | 337 | if (r < 0) { |
| 337 | return r; | 338 | return r; |
| 338 | } | 339 | } |
| @@ -342,16 +343,16 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, | |||
| 342 | case DSP56K_SET_TX_WSIZE: | 343 | case DSP56K_SET_TX_WSIZE: |
| 343 | if (arg > 4 || arg < 1) | 344 | if (arg > 4 || arg < 1) |
| 344 | return -EINVAL; | 345 | return -EINVAL; |
| 345 | lock_kernel(); | 346 | mutex_lock(&dsp56k_mutex); |
| 346 | dsp56k.tx_wsize = (int) arg; | 347 | dsp56k.tx_wsize = (int) arg; |
| 347 | unlock_kernel(); | 348 | mutex_unlock(&dsp56k_mutex); |
| 348 | break; | 349 | break; |
| 349 | case DSP56K_SET_RX_WSIZE: | 350 | case DSP56K_SET_RX_WSIZE: |
| 350 | if (arg > 4 || arg < 1) | 351 | if (arg > 4 || arg < 1) |
| 351 | return -EINVAL; | 352 | return -EINVAL; |
| 352 | lock_kernel(); | 353 | mutex_lock(&dsp56k_mutex); |
| 353 | dsp56k.rx_wsize = (int) arg; | 354 | dsp56k.rx_wsize = (int) arg; |
| 354 | unlock_kernel(); | 355 | mutex_unlock(&dsp56k_mutex); |
| 355 | break; | 356 | break; |
| 356 | case DSP56K_HOST_FLAGS: | 357 | case DSP56K_HOST_FLAGS: |
| 357 | { | 358 | { |
| @@ -363,7 +364,7 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, | |||
| 363 | if(get_user(out, &hf->out) < 0) | 364 | if(get_user(out, &hf->out) < 0) |
| 364 | return -EFAULT; | 365 | return -EFAULT; |
| 365 | 366 | ||
| 366 | lock_kernel(); | 367 | mutex_lock(&dsp56k_mutex); |
| 367 | if ((dir & 0x1) && (out & 0x1)) | 368 | if ((dir & 0x1) && (out & 0x1)) |
| 368 | dsp56k_host_interface.icr |= DSP56K_ICR_HF0; | 369 | dsp56k_host_interface.icr |= DSP56K_ICR_HF0; |
| 369 | else if (dir & 0x1) | 370 | else if (dir & 0x1) |
| @@ -378,16 +379,16 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd, | |||
| 378 | if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2; | 379 | if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2; |
| 379 | if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4; | 380 | if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4; |
| 380 | if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8; | 381 | if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8; |
| 381 | unlock_kernel(); | 382 | mutex_unlock(&dsp56k_mutex); |
| 382 | return put_user(status, &hf->status); | 383 | return put_user(status, &hf->status); |
| 383 | } | 384 | } |
| 384 | case DSP56K_HOST_CMD: | 385 | case DSP56K_HOST_CMD: |
| 385 | if (arg > 31 || arg < 0) | 386 | if (arg > 31 || arg < 0) |
| 386 | return -EINVAL; | 387 | return -EINVAL; |
| 387 | lock_kernel(); | 388 | mutex_lock(&dsp56k_mutex); |
| 388 | dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) | | 389 | dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) | |
| 389 | DSP56K_CVR_HC); | 390 | DSP56K_CVR_HC); |
| 390 | unlock_kernel(); | 391 | mutex_unlock(&dsp56k_mutex); |
| 391 | break; | 392 | break; |
| 392 | default: | 393 | default: |
| 393 | return -EINVAL; | 394 | return -EINVAL; |
| @@ -427,7 +428,7 @@ static int dsp56k_open(struct inode *inode, struct file *file) | |||
| 427 | int dev = iminor(inode) & 0x0f; | 428 | int dev = iminor(inode) & 0x0f; |
| 428 | int ret = 0; | 429 | int ret = 0; |
| 429 | 430 | ||
| 430 | lock_kernel(); | 431 | mutex_lock(&dsp56k_mutex); |
| 431 | switch(dev) | 432 | switch(dev) |
| 432 | { | 433 | { |
| 433 | case DSP56K_DEV_56001: | 434 | case DSP56K_DEV_56001: |
| @@ -454,7 +455,7 @@ static int dsp56k_open(struct inode *inode, struct file *file) | |||
| 454 | ret = -ENODEV; | 455 | ret = -ENODEV; |
| 455 | } | 456 | } |
| 456 | out: | 457 | out: |
| 457 | unlock_kernel(); | 458 | mutex_unlock(&dsp56k_mutex); |
| 458 | return ret; | 459 | return ret; |
| 459 | } | 460 | } |
| 460 | 461 | ||
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index e3859d4eaead..8dd040a945d4 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
| @@ -57,7 +57,7 @@ | |||
| 57 | #include <linux/ioport.h> /* for request_region */ | 57 | #include <linux/ioport.h> /* for request_region */ |
| 58 | #include <linux/delay.h> /* for loops_per_jiffy */ | 58 | #include <linux/delay.h> /* for loops_per_jiffy */ |
| 59 | #include <linux/sched.h> | 59 | #include <linux/sched.h> |
| 60 | #include <linux/smp_lock.h> /* cycle_kernel_lock() */ | 60 | #include <linux/mutex.h> |
| 61 | #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ | 61 | #include <asm/io.h> /* for inb_p, outb_p, inb, outb, etc. */ |
| 62 | #include <asm/uaccess.h> /* for get_user, etc. */ | 62 | #include <asm/uaccess.h> /* for get_user, etc. */ |
| 63 | #include <linux/wait.h> /* for wait_queue */ | 63 | #include <linux/wait.h> /* for wait_queue */ |
| @@ -73,6 +73,7 @@ | |||
| 73 | #define TRACE_RET ((void) 0) | 73 | #define TRACE_RET ((void) 0) |
| 74 | #endif /* TRACING */ | 74 | #endif /* TRACING */ |
| 75 | 75 | ||
| 76 | static DEFINE_MUTEX(dtlk_mutex); | ||
| 76 | static void dtlk_timer_tick(unsigned long data); | 77 | static void dtlk_timer_tick(unsigned long data); |
| 77 | 78 | ||
| 78 | static int dtlk_major; | 79 | static int dtlk_major; |
| @@ -275,9 +276,9 @@ static long dtlk_ioctl(struct file *file, | |||
| 275 | switch (cmd) { | 276 | switch (cmd) { |
| 276 | 277 | ||
| 277 | case DTLK_INTERROGATE: | 278 | case DTLK_INTERROGATE: |
| 278 | lock_kernel(); | 279 | mutex_lock(&dtlk_mutex); |
| 279 | sp = dtlk_interrogate(); | 280 | sp = dtlk_interrogate(); |
| 280 | unlock_kernel(); | 281 | mutex_unlock(&dtlk_mutex); |
| 281 | if (copy_to_user(argp, sp, sizeof(struct dtlk_settings))) | 282 | if (copy_to_user(argp, sp, sizeof(struct dtlk_settings))) |
| 282 | return -EINVAL; | 283 | return -EINVAL; |
| 283 | return 0; | 284 | return 0; |
| @@ -296,7 +297,6 @@ static int dtlk_open(struct inode *inode, struct file *file) | |||
| 296 | { | 297 | { |
| 297 | TRACE_TEXT("(dtlk_open"); | 298 | TRACE_TEXT("(dtlk_open"); |
| 298 | 299 | ||
| 299 | cycle_kernel_lock(); | ||
| 300 | nonseekable_open(inode, file); | 300 | nonseekable_open(inode, file); |
| 301 | switch (iminor(inode)) { | 301 | switch (iminor(inode)) { |
| 302 | case DTLK_MINOR: | 302 | case DTLK_MINOR: |
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c index 82b5a88a82d7..0e941b57482e 100644 --- a/drivers/char/generic_nvram.c +++ b/drivers/char/generic_nvram.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
| 20 | #include <linux/fcntl.h> | 20 | #include <linux/fcntl.h> |
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/smp_lock.h> | 22 | #include <linux/mutex.h> |
| 23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 24 | #include <asm/nvram.h> | 24 | #include <asm/nvram.h> |
| 25 | #ifdef CONFIG_PPC_PMAC | 25 | #ifdef CONFIG_PPC_PMAC |
| @@ -28,6 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | #define NVRAM_SIZE 8192 | 29 | #define NVRAM_SIZE 8192 |
| 30 | 30 | ||
| 31 | static DEFINE_MUTEX(nvram_mutex); | ||
| 31 | static ssize_t nvram_len; | 32 | static ssize_t nvram_len; |
| 32 | 33 | ||
| 33 | static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) | 34 | static loff_t nvram_llseek(struct file *file, loff_t offset, int origin) |
| @@ -120,9 +121,9 @@ static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned l | |||
| 120 | { | 121 | { |
| 121 | int ret; | 122 | int ret; |
| 122 | 123 | ||
| 123 | lock_kernel(); | 124 | mutex_lock(&nvram_mutex); |
| 124 | ret = nvram_ioctl(file, cmd, arg); | 125 | ret = nvram_ioctl(file, cmd, arg); |
| 125 | unlock_kernel(); | 126 | mutex_unlock(&nvram_mutex); |
| 126 | 127 | ||
| 127 | return ret; | 128 | return ret; |
| 128 | } | 129 | } |
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index b6c2cc167c11..2aa69f97360d 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
| 53 | #include <linux/poll.h> | 53 | #include <linux/poll.h> |
| 54 | #include <linux/proc_fs.h> | 54 | #include <linux/proc_fs.h> |
| 55 | #include <linux/smp_lock.h> | 55 | #include <linux/mutex.h> |
| 56 | #include <linux/workqueue.h> | 56 | #include <linux/workqueue.h> |
| 57 | 57 | ||
| 58 | #include <asm/uaccess.h> | 58 | #include <asm/uaccess.h> |
| @@ -66,6 +66,7 @@ | |||
| 66 | * ioctls. | 66 | * ioctls. |
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | static DEFINE_MUTEX(gen_rtc_mutex); | ||
| 69 | static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait); | 70 | static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait); |
| 70 | 71 | ||
| 71 | /* | 72 | /* |
| @@ -337,9 +338,9 @@ static long gen_rtc_unlocked_ioctl(struct file *file, unsigned int cmd, | |||
| 337 | { | 338 | { |
| 338 | int ret; | 339 | int ret; |
| 339 | 340 | ||
| 340 | lock_kernel(); | 341 | mutex_lock(&gen_rtc_mutex); |
| 341 | ret = gen_rtc_ioctl(file, cmd, arg); | 342 | ret = gen_rtc_ioctl(file, cmd, arg); |
| 342 | unlock_kernel(); | 343 | mutex_unlock(&gen_rtc_mutex); |
| 343 | 344 | ||
| 344 | return ret; | 345 | return ret; |
| 345 | } | 346 | } |
| @@ -352,16 +353,16 @@ static long gen_rtc_unlocked_ioctl(struct file *file, unsigned int cmd, | |||
| 352 | 353 | ||
| 353 | static int gen_rtc_open(struct inode *inode, struct file *file) | 354 | static int gen_rtc_open(struct inode *inode, struct file *file) |
| 354 | { | 355 | { |
| 355 | lock_kernel(); | 356 | mutex_lock(&gen_rtc_mutex); |
| 356 | if (gen_rtc_status & RTC_IS_OPEN) { | 357 | if (gen_rtc_status & RTC_IS_OPEN) { |
| 357 | unlock_kernel(); | 358 | mutex_unlock(&gen_rtc_mutex); |
| 358 | return -EBUSY; | 359 | return -EBUSY; |
| 359 | } | 360 | } |
| 360 | 361 | ||
| 361 | gen_rtc_status |= RTC_IS_OPEN; | 362 | gen_rtc_status |= RTC_IS_OPEN; |
| 362 | gen_rtc_irq_data = 0; | 363 | gen_rtc_irq_data = 0; |
| 363 | irq_active = 0; | 364 | irq_active = 0; |
| 364 | unlock_kernel(); | 365 | mutex_unlock(&gen_rtc_mutex); |
| 365 | 366 | ||
| 366 | return 0; | 367 | return 0; |
| 367 | } | 368 | } |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 4cd8b227c11f..3bc0eef88717 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
| @@ -23,7 +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/smp_lock.h> | 26 | #include <linux/mutex.h> |
| 27 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
| 28 | #include <asm/io.h> | 28 | #include <asm/io.h> |
| 29 | 29 | ||
| @@ -56,6 +56,7 @@ | |||
| 56 | 56 | ||
| 57 | #define I8K_TEMPERATURE_BUG 1 | 57 | #define I8K_TEMPERATURE_BUG 1 |
| 58 | 58 | ||
| 59 | static DEFINE_MUTEX(i8k_mutex); | ||
| 59 | static char bios_version[4]; | 60 | static char bios_version[4]; |
| 60 | 61 | ||
| 61 | MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); | 62 | MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); |
| @@ -399,9 +400,9 @@ static long i8k_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) | |||
| 399 | { | 400 | { |
| 400 | long ret; | 401 | long ret; |
| 401 | 402 | ||
| 402 | lock_kernel(); | 403 | mutex_lock(&i8k_mutex); |
| 403 | ret = i8k_ioctl_unlocked(fp, cmd, arg); | 404 | ret = i8k_ioctl_unlocked(fp, cmd, arg); |
| 404 | unlock_kernel(); | 405 | mutex_unlock(&i8k_mutex); |
| 405 | 406 | ||
| 406 | return ret; | 407 | return ret; |
| 407 | } | 408 | } |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index d4b71e8d0d23..dfbdf49d1e80 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
| @@ -98,7 +98,7 @@ | |||
| 98 | #include <linux/major.h> | 98 | #include <linux/major.h> |
| 99 | #include <linux/wait.h> | 99 | #include <linux/wait.h> |
| 100 | #include <linux/device.h> | 100 | #include <linux/device.h> |
| 101 | #include <linux/smp_lock.h> | 101 | #include <linux/mutex.h> |
| 102 | #include <linux/firmware.h> | 102 | #include <linux/firmware.h> |
| 103 | #include <linux/platform_device.h> | 103 | #include <linux/platform_device.h> |
| 104 | 104 | ||
| @@ -138,6 +138,7 @@ | |||
| 138 | #include <linux/proc_fs.h> | 138 | #include <linux/proc_fs.h> |
| 139 | #include <linux/seq_file.h> | 139 | #include <linux/seq_file.h> |
| 140 | 140 | ||
| 141 | static DEFINE_MUTEX(ip2_mutex); | ||
| 141 | static const struct file_operations ip2mem_proc_fops; | 142 | static const struct file_operations ip2mem_proc_fops; |
| 142 | static const struct file_operations ip2_proc_fops; | 143 | static const struct file_operations ip2_proc_fops; |
| 143 | 144 | ||
| @@ -2897,7 +2898,7 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg ) | |||
| 2897 | printk (KERN_DEBUG "IP2IPL: ioctl cmd %d, arg %ld\n", cmd, arg ); | 2898 | printk (KERN_DEBUG "IP2IPL: ioctl cmd %d, arg %ld\n", cmd, arg ); |
| 2898 | #endif | 2899 | #endif |
| 2899 | 2900 | ||
| 2900 | lock_kernel(); | 2901 | mutex_lock(&ip2_mutex); |
| 2901 | 2902 | ||
| 2902 | switch ( iplminor ) { | 2903 | switch ( iplminor ) { |
| 2903 | case 0: // IPL device | 2904 | case 0: // IPL device |
| @@ -2961,7 +2962,7 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg ) | |||
| 2961 | rc = -ENODEV; | 2962 | rc = -ENODEV; |
| 2962 | break; | 2963 | break; |
| 2963 | } | 2964 | } |
| 2964 | unlock_kernel(); | 2965 | mutex_unlock(&ip2_mutex); |
| 2965 | return rc; | 2966 | return rc; |
| 2966 | } | 2967 | } |
| 2967 | 2968 | ||
| @@ -2982,7 +2983,6 @@ ip2_ipl_open( struct inode *pInode, struct file *pFile ) | |||
| 2982 | #ifdef IP2DEBUG_IPL | 2983 | #ifdef IP2DEBUG_IPL |
| 2983 | printk (KERN_DEBUG "IP2IPL: open\n" ); | 2984 | printk (KERN_DEBUG "IP2IPL: open\n" ); |
| 2984 | #endif | 2985 | #endif |
| 2985 | cycle_kernel_lock(); | ||
| 2986 | return 0; | 2986 | return 0; |
| 2987 | } | 2987 | } |
| 2988 | 2988 | ||
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 938a3a273886..598d278db058 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
| @@ -126,7 +126,7 @@ | |||
| 126 | #include <linux/device.h> | 126 | #include <linux/device.h> |
| 127 | #include <linux/wait.h> | 127 | #include <linux/wait.h> |
| 128 | #include <linux/jiffies.h> | 128 | #include <linux/jiffies.h> |
| 129 | #include <linux/smp_lock.h> | 129 | #include <linux/mutex.h> |
| 130 | #include <linux/compat.h> | 130 | #include <linux/compat.h> |
| 131 | 131 | ||
| 132 | #include <linux/parport.h> | 132 | #include <linux/parport.h> |
| @@ -140,6 +140,7 @@ | |||
| 140 | /* if you have more than 8 printers, remember to increase LP_NO */ | 140 | /* if you have more than 8 printers, remember to increase LP_NO */ |
| 141 | #define LP_NO 8 | 141 | #define LP_NO 8 |
| 142 | 142 | ||
| 143 | static DEFINE_MUTEX(lp_mutex); | ||
| 143 | static struct lp_struct lp_table[LP_NO]; | 144 | static struct lp_struct lp_table[LP_NO]; |
| 144 | 145 | ||
| 145 | static unsigned int lp_count = 0; | 146 | static unsigned int lp_count = 0; |
| @@ -493,7 +494,7 @@ static int lp_open(struct inode * inode, struct file * file) | |||
| 493 | unsigned int minor = iminor(inode); | 494 | unsigned int minor = iminor(inode); |
| 494 | int ret = 0; | 495 | int ret = 0; |
| 495 | 496 | ||
| 496 | lock_kernel(); | 497 | mutex_lock(&lp_mutex); |
| 497 | if (minor >= LP_NO) { | 498 | if (minor >= LP_NO) { |
| 498 | ret = -ENXIO; | 499 | ret = -ENXIO; |
| 499 | goto out; | 500 | goto out; |
| @@ -554,7 +555,7 @@ static int lp_open(struct inode * inode, struct file * file) | |||
| 554 | lp_release_parport (&lp_table[minor]); | 555 | lp_release_parport (&lp_table[minor]); |
| 555 | lp_table[minor].current_mode = IEEE1284_MODE_COMPAT; | 556 | lp_table[minor].current_mode = IEEE1284_MODE_COMPAT; |
| 556 | out: | 557 | out: |
| 557 | unlock_kernel(); | 558 | mutex_unlock(&lp_mutex); |
| 558 | return ret; | 559 | return ret; |
| 559 | } | 560 | } |
| 560 | 561 | ||
| @@ -680,7 +681,7 @@ static long lp_ioctl(struct file *file, unsigned int cmd, | |||
| 680 | int ret; | 681 | int ret; |
| 681 | 682 | ||
| 682 | minor = iminor(file->f_path.dentry->d_inode); | 683 | minor = iminor(file->f_path.dentry->d_inode); |
| 683 | lock_kernel(); | 684 | mutex_lock(&lp_mutex); |
| 684 | switch (cmd) { | 685 | switch (cmd) { |
| 685 | case LPSETTIMEOUT: | 686 | case LPSETTIMEOUT: |
| 686 | if (copy_from_user(&par_timeout, (void __user *)arg, | 687 | if (copy_from_user(&par_timeout, (void __user *)arg, |
| @@ -694,7 +695,7 @@ static long lp_ioctl(struct file *file, unsigned int cmd, | |||
| 694 | ret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg); | 695 | ret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg); |
| 695 | break; | 696 | break; |
| 696 | } | 697 | } |
| 697 | unlock_kernel(); | 698 | mutex_unlock(&lp_mutex); |
| 698 | 699 | ||
| 699 | return ret; | 700 | return ret; |
| 700 | } | 701 | } |
| @@ -709,7 +710,7 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd, | |||
| 709 | int ret; | 710 | int ret; |
| 710 | 711 | ||
| 711 | minor = iminor(file->f_path.dentry->d_inode); | 712 | minor = iminor(file->f_path.dentry->d_inode); |
| 712 | lock_kernel(); | 713 | mutex_lock(&lp_mutex); |
| 713 | switch (cmd) { | 714 | switch (cmd) { |
| 714 | case LPSETTIMEOUT: | 715 | case LPSETTIMEOUT: |
| 715 | tc = compat_ptr(arg); | 716 | tc = compat_ptr(arg); |
| @@ -730,7 +731,7 @@ static long lp_compat_ioctl(struct file *file, unsigned int cmd, | |||
| 730 | ret = lp_do_ioctl(minor, cmd, arg, compat_ptr(arg)); | 731 | ret = lp_do_ioctl(minor, cmd, arg, compat_ptr(arg)); |
| 731 | break; | 732 | break; |
| 732 | } | 733 | } |
| 733 | unlock_kernel(); | 734 | mutex_unlock(&lp_mutex); |
| 734 | 735 | ||
| 735 | return ret; | 736 | return ret; |
| 736 | } | 737 | } |
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index 83bef4efe376..1aeaaba680d2 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
| 26 | #include <linux/uio.h> | 26 | #include <linux/uio.h> |
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/smp_lock.h> | ||
| 29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 30 | #include <asm/io.h> | 29 | #include <asm/io.h> |
| 31 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
| @@ -42,6 +41,7 @@ | |||
| 42 | #else | 41 | #else |
| 43 | #define DBG(fmt...) | 42 | #define DBG(fmt...) |
| 44 | #endif | 43 | #endif |
| 44 | static DEFINE_MUTEX(mbcs_mutex); | ||
| 45 | static int mbcs_major; | 45 | static int mbcs_major; |
| 46 | 46 | ||
| 47 | static LIST_HEAD(soft_list); | 47 | static LIST_HEAD(soft_list); |
| @@ -385,19 +385,19 @@ static int mbcs_open(struct inode *ip, struct file *fp) | |||
| 385 | struct mbcs_soft *soft; | 385 | struct mbcs_soft *soft; |
| 386 | int minor; | 386 | int minor; |
| 387 | 387 | ||
| 388 | lock_kernel(); | 388 | mutex_lock(&mbcs_mutex); |
| 389 | minor = iminor(ip); | 389 | minor = iminor(ip); |
| 390 | 390 | ||
| 391 | /* Nothing protects access to this list... */ | 391 | /* Nothing protects access to this list... */ |
| 392 | list_for_each_entry(soft, &soft_list, list) { | 392 | list_for_each_entry(soft, &soft_list, list) { |
| 393 | if (soft->nasid == minor) { | 393 | if (soft->nasid == minor) { |
| 394 | fp->private_data = soft->cxdev; | 394 | fp->private_data = soft->cxdev; |
| 395 | unlock_kernel(); | 395 | mutex_unlock(&mbcs_mutex); |
| 396 | return 0; | 396 | return 0; |
| 397 | } | 397 | } |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | unlock_kernel(); | 400 | mutex_unlock(&mbcs_mutex); |
| 401 | return -ENODEV; | 401 | return -ENODEV; |
| 402 | } | 402 | } |
| 403 | 403 | ||
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index ea7c99fa978f..fe4697844ec1 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
| 33 | #include <linux/time.h> | 33 | #include <linux/time.h> |
| 34 | #include <linux/math64.h> | 34 | #include <linux/math64.h> |
| 35 | #include <linux/smp_lock.h> | 35 | #include <linux/mutex.h> |
| 36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| 37 | 37 | ||
| 38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
| @@ -59,6 +59,7 @@ extern unsigned long sn_rtc_cycles_per_second; | |||
| 59 | 59 | ||
| 60 | #define rtc_time() (*RTC_COUNTER_ADDR) | 60 | #define rtc_time() (*RTC_COUNTER_ADDR) |
| 61 | 61 | ||
| 62 | static DEFINE_MUTEX(mmtimer_mutex); | ||
| 62 | static long mmtimer_ioctl(struct file *file, unsigned int cmd, | 63 | static long mmtimer_ioctl(struct file *file, unsigned int cmd, |
| 63 | unsigned long arg); | 64 | unsigned long arg); |
| 64 | static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); | 65 | static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); |
| @@ -371,7 +372,7 @@ static long mmtimer_ioctl(struct file *file, unsigned int cmd, | |||
| 371 | { | 372 | { |
| 372 | int ret = 0; | 373 | int ret = 0; |
| 373 | 374 | ||
| 374 | lock_kernel(); | 375 | mutex_lock(&mmtimer_mutex); |
| 375 | 376 | ||
| 376 | switch (cmd) { | 377 | switch (cmd) { |
| 377 | case MMTIMER_GETOFFSET: /* offset of the counter */ | 378 | case MMTIMER_GETOFFSET: /* offset of the counter */ |
| @@ -414,7 +415,7 @@ static long mmtimer_ioctl(struct file *file, unsigned int cmd, | |||
| 414 | ret = -ENOTTY; | 415 | ret = -ENOTTY; |
| 415 | break; | 416 | break; |
| 416 | } | 417 | } |
| 417 | unlock_kernel(); | 418 | mutex_unlock(&mmtimer_mutex); |
| 418 | return ret; | 419 | return ret; |
| 419 | } | 420 | } |
| 420 | 421 | ||
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index a4ec50c95072..e5df26b56d59 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #include <linux/serial.h> | 56 | #include <linux/serial.h> |
| 57 | #include <linux/sched.h> | 57 | #include <linux/sched.h> |
| 58 | #include <linux/spinlock.h> | 58 | #include <linux/spinlock.h> |
| 59 | #include <linux/smp_lock.h> | 59 | #include <linux/mutex.h> |
| 60 | #include <linux/delay.h> | 60 | #include <linux/delay.h> |
| 61 | #include <linux/serial_8250.h> | 61 | #include <linux/serial_8250.h> |
| 62 | #include "smapi.h" | 62 | #include "smapi.h" |
| @@ -73,6 +73,7 @@ MODULE_LICENSE("GPL"); | |||
| 73 | * checks are made against other devices (ie. superio) for conflicts. | 73 | * checks are made against other devices (ie. superio) for conflicts. |
| 74 | * We'll depend on users using the tpctl utility to do that for now | 74 | * We'll depend on users using the tpctl utility to do that for now |
| 75 | */ | 75 | */ |
| 76 | static DEFINE_MUTEX(mwave_mutex); | ||
| 76 | int mwave_debug = 0; | 77 | int mwave_debug = 0; |
| 77 | int mwave_3780i_irq = 0; | 78 | int mwave_3780i_irq = 0; |
| 78 | int mwave_3780i_io = 0; | 79 | int mwave_3780i_io = 0; |
| @@ -101,7 +102,6 @@ static int mwave_open(struct inode *inode, struct file *file) | |||
| 101 | PRINTK_2(TRACE_MWAVE, | 102 | PRINTK_2(TRACE_MWAVE, |
| 102 | "mwavedd::mwave_open, exit return retval %x\n", retval); | 103 | "mwavedd::mwave_open, exit return retval %x\n", retval); |
| 103 | 104 | ||
| 104 | cycle_kernel_lock(); | ||
| 105 | return retval; | 105 | return retval; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| @@ -136,9 +136,9 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 136 | PRINTK_1(TRACE_MWAVE, | 136 | PRINTK_1(TRACE_MWAVE, |
| 137 | "mwavedd::mwave_ioctl, IOCTL_MW_RESET" | 137 | "mwavedd::mwave_ioctl, IOCTL_MW_RESET" |
| 138 | " calling tp3780I_ResetDSP\n"); | 138 | " calling tp3780I_ResetDSP\n"); |
| 139 | lock_kernel(); | 139 | mutex_lock(&mwave_mutex); |
| 140 | retval = tp3780I_ResetDSP(&pDrvData->rBDData); | 140 | retval = tp3780I_ResetDSP(&pDrvData->rBDData); |
| 141 | unlock_kernel(); | 141 | mutex_unlock(&mwave_mutex); |
| 142 | PRINTK_2(TRACE_MWAVE, | 142 | PRINTK_2(TRACE_MWAVE, |
| 143 | "mwavedd::mwave_ioctl, IOCTL_MW_RESET" | 143 | "mwavedd::mwave_ioctl, IOCTL_MW_RESET" |
| 144 | " retval %x from tp3780I_ResetDSP\n", | 144 | " retval %x from tp3780I_ResetDSP\n", |
| @@ -149,9 +149,9 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 149 | PRINTK_1(TRACE_MWAVE, | 149 | PRINTK_1(TRACE_MWAVE, |
| 150 | "mwavedd::mwave_ioctl, IOCTL_MW_RUN" | 150 | "mwavedd::mwave_ioctl, IOCTL_MW_RUN" |
| 151 | " calling tp3780I_StartDSP\n"); | 151 | " calling tp3780I_StartDSP\n"); |
| 152 | lock_kernel(); | 152 | mutex_lock(&mwave_mutex); |
| 153 | retval = tp3780I_StartDSP(&pDrvData->rBDData); | 153 | retval = tp3780I_StartDSP(&pDrvData->rBDData); |
| 154 | unlock_kernel(); | 154 | mutex_unlock(&mwave_mutex); |
| 155 | PRINTK_2(TRACE_MWAVE, | 155 | PRINTK_2(TRACE_MWAVE, |
| 156 | "mwavedd::mwave_ioctl, IOCTL_MW_RUN" | 156 | "mwavedd::mwave_ioctl, IOCTL_MW_RUN" |
| 157 | " retval %x from tp3780I_StartDSP\n", | 157 | " retval %x from tp3780I_StartDSP\n", |
| @@ -165,10 +165,10 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 165 | "mwavedd::mwave_ioctl," | 165 | "mwavedd::mwave_ioctl," |
| 166 | " IOCTL_MW_DSP_ABILITIES calling" | 166 | " IOCTL_MW_DSP_ABILITIES calling" |
| 167 | " tp3780I_QueryAbilities\n"); | 167 | " tp3780I_QueryAbilities\n"); |
| 168 | lock_kernel(); | 168 | mutex_lock(&mwave_mutex); |
| 169 | retval = tp3780I_QueryAbilities(&pDrvData->rBDData, | 169 | retval = tp3780I_QueryAbilities(&pDrvData->rBDData, |
| 170 | &rAbilities); | 170 | &rAbilities); |
| 171 | unlock_kernel(); | 171 | mutex_unlock(&mwave_mutex); |
| 172 | PRINTK_2(TRACE_MWAVE, | 172 | PRINTK_2(TRACE_MWAVE, |
| 173 | "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES" | 173 | "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES" |
| 174 | " retval %x from tp3780I_QueryAbilities\n", | 174 | " retval %x from tp3780I_QueryAbilities\n", |
| @@ -199,13 +199,13 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 199 | "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA," | 199 | "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA," |
| 200 | " size %lx, ioarg %lx pusBuffer %p\n", | 200 | " size %lx, ioarg %lx pusBuffer %p\n", |
| 201 | rReadData.ulDataLength, ioarg, pusBuffer); | 201 | rReadData.ulDataLength, ioarg, pusBuffer); |
| 202 | lock_kernel(); | 202 | mutex_lock(&mwave_mutex); |
| 203 | retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, | 203 | retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, |
| 204 | iocmd, | 204 | iocmd, |
| 205 | pusBuffer, | 205 | pusBuffer, |
| 206 | rReadData.ulDataLength, | 206 | rReadData.ulDataLength, |
| 207 | rReadData.usDspAddress); | 207 | rReadData.usDspAddress); |
| 208 | unlock_kernel(); | 208 | mutex_unlock(&mwave_mutex); |
| 209 | } | 209 | } |
| 210 | break; | 210 | break; |
| 211 | 211 | ||
| @@ -223,12 +223,12 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 223 | " size %lx, ioarg %lx pusBuffer %p\n", | 223 | " size %lx, ioarg %lx pusBuffer %p\n", |
| 224 | rReadData.ulDataLength / 2, ioarg, | 224 | rReadData.ulDataLength / 2, ioarg, |
| 225 | pusBuffer); | 225 | pusBuffer); |
| 226 | lock_kernel(); | 226 | mutex_lock(&mwave_mutex); |
| 227 | retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, | 227 | retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, |
| 228 | iocmd, pusBuffer, | 228 | iocmd, pusBuffer, |
| 229 | rReadData.ulDataLength / 2, | 229 | rReadData.ulDataLength / 2, |
| 230 | rReadData.usDspAddress); | 230 | rReadData.usDspAddress); |
| 231 | unlock_kernel(); | 231 | mutex_unlock(&mwave_mutex); |
| 232 | } | 232 | } |
| 233 | break; | 233 | break; |
| 234 | 234 | ||
| @@ -246,12 +246,12 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 246 | " size %lx, ioarg %lx pusBuffer %p\n", | 246 | " size %lx, ioarg %lx pusBuffer %p\n", |
| 247 | rWriteData.ulDataLength, ioarg, | 247 | rWriteData.ulDataLength, ioarg, |
| 248 | pusBuffer); | 248 | pusBuffer); |
| 249 | lock_kernel(); | 249 | mutex_lock(&mwave_mutex); |
| 250 | retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, | 250 | retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData, |
| 251 | iocmd, pusBuffer, | 251 | iocmd, pusBuffer, |
| 252 | rWriteData.ulDataLength, | 252 | rWriteData.ulDataLength, |
| 253 | rWriteData.usDspAddress); | 253 | rWriteData.usDspAddress); |
| 254 | unlock_kernel(); | 254 | mutex_unlock(&mwave_mutex); |
| 255 | } | 255 | } |
| 256 | break; | 256 | break; |
| 257 | 257 | ||
| @@ -269,12 +269,12 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 269 | " size %lx, ioarg %lx pusBuffer %p\n", | 269 | " size %lx, ioarg %lx pusBuffer %p\n", |
| 270 | rWriteData.ulDataLength, ioarg, | 270 | rWriteData.ulDataLength, ioarg, |
| 271 | pusBuffer); | 271 | pusBuffer); |
| 272 | lock_kernel(); | 272 | mutex_lock(&mwave_mutex); |
| 273 | retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData, | 273 | retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData, |
| 274 | iocmd, pusBuffer, | 274 | iocmd, pusBuffer, |
| 275 | rWriteData.ulDataLength, | 275 | rWriteData.ulDataLength, |
| 276 | rWriteData.usDspAddress); | 276 | rWriteData.usDspAddress); |
| 277 | unlock_kernel(); | 277 | mutex_unlock(&mwave_mutex); |
| 278 | } | 278 | } |
| 279 | break; | 279 | break; |
| 280 | 280 | ||
| @@ -295,10 +295,10 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 295 | ipcnum, | 295 | ipcnum, |
| 296 | pDrvData->IPCs[ipcnum].usIntCount); | 296 | pDrvData->IPCs[ipcnum].usIntCount); |
| 297 | 297 | ||
| 298 | lock_kernel(); | 298 | mutex_lock(&mwave_mutex); |
| 299 | pDrvData->IPCs[ipcnum].bIsHere = FALSE; | 299 | pDrvData->IPCs[ipcnum].bIsHere = FALSE; |
| 300 | pDrvData->IPCs[ipcnum].bIsEnabled = TRUE; | 300 | pDrvData->IPCs[ipcnum].bIsEnabled = TRUE; |
| 301 | unlock_kernel(); | 301 | mutex_unlock(&mwave_mutex); |
| 302 | 302 | ||
| 303 | PRINTK_2(TRACE_MWAVE, | 303 | PRINTK_2(TRACE_MWAVE, |
| 304 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" | 304 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" |
| @@ -323,7 +323,7 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 323 | ipcnum, | 323 | ipcnum, |
| 324 | pDrvData->IPCs[ipcnum].usIntCount); | 324 | pDrvData->IPCs[ipcnum].usIntCount); |
| 325 | 325 | ||
| 326 | lock_kernel(); | 326 | mutex_lock(&mwave_mutex); |
| 327 | if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { | 327 | if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { |
| 328 | DECLARE_WAITQUEUE(wait, current); | 328 | DECLARE_WAITQUEUE(wait, current); |
| 329 | 329 | ||
| @@ -364,7 +364,7 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 364 | " processing\n", | 364 | " processing\n", |
| 365 | ipcnum); | 365 | ipcnum); |
| 366 | } | 366 | } |
| 367 | unlock_kernel(); | 367 | mutex_unlock(&mwave_mutex); |
| 368 | } | 368 | } |
| 369 | break; | 369 | break; |
| 370 | 370 | ||
| @@ -383,14 +383,14 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, | |||
| 383 | ipcnum); | 383 | ipcnum); |
| 384 | return -EINVAL; | 384 | return -EINVAL; |
| 385 | } | 385 | } |
| 386 | lock_kernel(); | 386 | mutex_lock(&mwave_mutex); |
| 387 | if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { | 387 | if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) { |
| 388 | pDrvData->IPCs[ipcnum].bIsEnabled = FALSE; | 388 | pDrvData->IPCs[ipcnum].bIsEnabled = FALSE; |
| 389 | if (pDrvData->IPCs[ipcnum].bIsHere == TRUE) { | 389 | if (pDrvData->IPCs[ipcnum].bIsHere == TRUE) { |
| 390 | wake_up_interruptible(&pDrvData->IPCs[ipcnum].ipc_wait_queue); | 390 | wake_up_interruptible(&pDrvData->IPCs[ipcnum].ipc_wait_queue); |
| 391 | } | 391 | } |
| 392 | } | 392 | } |
| 393 | unlock_kernel(); | 393 | mutex_unlock(&mwave_mutex); |
| 394 | } | 394 | } |
| 395 | break; | 395 | break; |
| 396 | 396 | ||
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 66d2917b003f..166f1e7aaa7e 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
| @@ -109,10 +109,11 @@ | |||
| 109 | #include <linux/spinlock.h> | 109 | #include <linux/spinlock.h> |
| 110 | #include <linux/io.h> | 110 | #include <linux/io.h> |
| 111 | #include <linux/uaccess.h> | 111 | #include <linux/uaccess.h> |
| 112 | #include <linux/smp_lock.h> | 112 | #include <linux/mutex.h> |
| 113 | 113 | ||
| 114 | #include <asm/system.h> | 114 | #include <asm/system.h> |
| 115 | 115 | ||
| 116 | static DEFINE_MUTEX(nvram_mutex); | ||
| 116 | static DEFINE_SPINLOCK(nvram_state_lock); | 117 | static DEFINE_SPINLOCK(nvram_state_lock); |
| 117 | static int nvram_open_cnt; /* #times opened */ | 118 | static int nvram_open_cnt; /* #times opened */ |
| 118 | static int nvram_open_mode; /* special open modes */ | 119 | static int nvram_open_mode; /* special open modes */ |
| @@ -308,7 +309,7 @@ static long nvram_ioctl(struct file *file, unsigned int cmd, | |||
| 308 | if (!capable(CAP_SYS_ADMIN)) | 309 | if (!capable(CAP_SYS_ADMIN)) |
| 309 | return -EACCES; | 310 | return -EACCES; |
| 310 | 311 | ||
| 311 | lock_kernel(); | 312 | mutex_lock(&nvram_mutex); |
| 312 | spin_lock_irq(&rtc_lock); | 313 | spin_lock_irq(&rtc_lock); |
| 313 | 314 | ||
| 314 | for (i = 0; i < NVRAM_BYTES; ++i) | 315 | for (i = 0; i < NVRAM_BYTES; ++i) |
| @@ -316,7 +317,7 @@ static long nvram_ioctl(struct file *file, unsigned int cmd, | |||
| 316 | __nvram_set_checksum(); | 317 | __nvram_set_checksum(); |
| 317 | 318 | ||
| 318 | spin_unlock_irq(&rtc_lock); | 319 | spin_unlock_irq(&rtc_lock); |
| 319 | unlock_kernel(); | 320 | mutex_unlock(&nvram_mutex); |
| 320 | return 0; | 321 | return 0; |
| 321 | 322 | ||
| 322 | case NVRAM_SETCKS: | 323 | case NVRAM_SETCKS: |
| @@ -325,11 +326,11 @@ static long nvram_ioctl(struct file *file, unsigned int cmd, | |||
| 325 | if (!capable(CAP_SYS_ADMIN)) | 326 | if (!capable(CAP_SYS_ADMIN)) |
| 326 | return -EACCES; | 327 | return -EACCES; |
| 327 | 328 | ||
| 328 | lock_kernel(); | 329 | mutex_lock(&nvram_mutex); |
| 329 | spin_lock_irq(&rtc_lock); | 330 | spin_lock_irq(&rtc_lock); |
| 330 | __nvram_set_checksum(); | 331 | __nvram_set_checksum(); |
| 331 | spin_unlock_irq(&rtc_lock); | 332 | spin_unlock_irq(&rtc_lock); |
| 332 | unlock_kernel(); | 333 | mutex_unlock(&nvram_mutex); |
| 333 | return 0; | 334 | return 0; |
| 334 | 335 | ||
| 335 | default: | 336 | default: |
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index 043a1c7b86be..a12f52400dbc 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
| 26 | #include <linux/rwsem.h> | 26 | #include <linux/rwsem.h> |
| 27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
| 28 | #include <linux/smp_lock.h> | ||
| 29 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
| 30 | #include <linux/jiffies.h> | 29 | #include <linux/jiffies.h> |
| 31 | 30 | ||
| @@ -41,6 +40,7 @@ | |||
| 41 | 40 | ||
| 42 | #define NWFLASH_VERSION "6.4" | 41 | #define NWFLASH_VERSION "6.4" |
| 43 | 42 | ||
| 43 | static DEFINE_MUTEX(flash_mutex); | ||
| 44 | static void kick_open(void); | 44 | static void kick_open(void); |
| 45 | static int get_flash_id(void); | 45 | static int get_flash_id(void); |
| 46 | static int erase_block(int nBlock); | 46 | static int erase_block(int nBlock); |
| @@ -96,7 +96,7 @@ static int get_flash_id(void) | |||
| 96 | 96 | ||
| 97 | static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | 97 | static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) |
| 98 | { | 98 | { |
| 99 | lock_kernel(); | 99 | mutex_lock(&flash_mutex); |
| 100 | switch (cmd) { | 100 | switch (cmd) { |
| 101 | case CMD_WRITE_DISABLE: | 101 | case CMD_WRITE_DISABLE: |
| 102 | gbWriteBase64Enable = 0; | 102 | gbWriteBase64Enable = 0; |
| @@ -114,10 +114,10 @@ static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | |||
| 114 | default: | 114 | default: |
| 115 | gbWriteBase64Enable = 0; | 115 | gbWriteBase64Enable = 0; |
| 116 | gbWriteEnable = 0; | 116 | gbWriteEnable = 0; |
| 117 | unlock_kernel(); | 117 | mutex_unlock(&flash_mutex); |
| 118 | return -EINVAL; | 118 | return -EINVAL; |
| 119 | } | 119 | } |
| 120 | unlock_kernel(); | 120 | mutex_unlock(&flash_mutex); |
| 121 | return 0; | 121 | return 0; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| @@ -282,7 +282,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig) | |||
| 282 | { | 282 | { |
| 283 | loff_t ret; | 283 | loff_t ret; |
| 284 | 284 | ||
| 285 | lock_kernel(); | 285 | mutex_lock(&flash_mutex); |
| 286 | if (flashdebug) | 286 | if (flashdebug) |
| 287 | printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n", | 287 | printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n", |
| 288 | (unsigned int) offset, orig); | 288 | (unsigned int) offset, orig); |
| @@ -317,7 +317,7 @@ static loff_t flash_llseek(struct file *file, loff_t offset, int orig) | |||
| 317 | default: | 317 | default: |
| 318 | ret = -EINVAL; | 318 | ret = -EINVAL; |
| 319 | } | 319 | } |
| 320 | unlock_kernel(); | 320 | mutex_unlock(&flash_mutex); |
| 321 | return ret; | 321 | return ret; |
| 322 | } | 322 | } |
| 323 | 323 | ||
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index ec73d9f6d9ed..7d091b68d247 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
| 31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
| 32 | #include <linux/bitrev.h> | 32 | #include <linux/bitrev.h> |
| 33 | #include <linux/smp_lock.h> | 33 | #include <linux/mutex.h> |
| 34 | #include <linux/uaccess.h> | 34 | #include <linux/uaccess.h> |
| 35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
| 36 | 36 | ||
| @@ -55,6 +55,7 @@ | |||
| 55 | __func__ , ## args); \ | 55 | __func__ , ## args); \ |
| 56 | } while (0) | 56 | } while (0) |
| 57 | 57 | ||
| 58 | static DEFINE_MUTEX(cmm_mutex); | ||
| 58 | static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; | 59 | static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; |
| 59 | 60 | ||
| 60 | #define T_1SEC (HZ) | 61 | #define T_1SEC (HZ) |
| @@ -1418,7 +1419,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 1418 | iminor(inode), ioctl_names[_IOC_NR(cmd)]); | 1419 | iminor(inode), ioctl_names[_IOC_NR(cmd)]); |
| 1419 | #endif | 1420 | #endif |
| 1420 | 1421 | ||
| 1421 | lock_kernel(); | 1422 | mutex_lock(&cmm_mutex); |
| 1422 | rc = -ENODEV; | 1423 | rc = -ENODEV; |
| 1423 | link = dev_table[iminor(inode)]; | 1424 | link = dev_table[iminor(inode)]; |
| 1424 | if (!pcmcia_dev_present(link)) { | 1425 | if (!pcmcia_dev_present(link)) { |
| @@ -1626,7 +1627,7 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 1626 | rc = -ENOTTY; | 1627 | rc = -ENOTTY; |
| 1627 | } | 1628 | } |
| 1628 | out: | 1629 | out: |
| 1629 | unlock_kernel(); | 1630 | mutex_unlock(&cmm_mutex); |
| 1630 | return rc; | 1631 | return rc; |
| 1631 | } | 1632 | } |
| 1632 | 1633 | ||
| @@ -1640,7 +1641,7 @@ static int cmm_open(struct inode *inode, struct file *filp) | |||
| 1640 | if (minor >= CM4000_MAX_DEV) | 1641 | if (minor >= CM4000_MAX_DEV) |
| 1641 | return -ENODEV; | 1642 | return -ENODEV; |
| 1642 | 1643 | ||
| 1643 | lock_kernel(); | 1644 | mutex_lock(&cmm_mutex); |
| 1644 | link = dev_table[minor]; | 1645 | link = dev_table[minor]; |
| 1645 | if (link == NULL || !pcmcia_dev_present(link)) { | 1646 | if (link == NULL || !pcmcia_dev_present(link)) { |
| 1646 | ret = -ENODEV; | 1647 | ret = -ENODEV; |
| @@ -1685,7 +1686,7 @@ static int cmm_open(struct inode *inode, struct file *filp) | |||
| 1685 | DEBUGP(2, dev, "<- cmm_open\n"); | 1686 | DEBUGP(2, dev, "<- cmm_open\n"); |
| 1686 | ret = nonseekable_open(inode, filp); | 1687 | ret = nonseekable_open(inode, filp); |
| 1687 | out: | 1688 | out: |
| 1688 | unlock_kernel(); | 1689 | mutex_unlock(&cmm_mutex); |
| 1689 | return ret; | 1690 | return ret; |
| 1690 | } | 1691 | } |
| 1691 | 1692 | ||
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 815cde1d0570..04c0a895740e 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
| 27 | #include <linux/smp_lock.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
| 29 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
| 30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
| @@ -49,6 +49,7 @@ | |||
| 49 | __func__ , ## args); \ | 49 | __func__ , ## args); \ |
| 50 | } while (0) | 50 | } while (0) |
| 51 | 51 | ||
| 52 | static DEFINE_MUTEX(cm4040_mutex); | ||
| 52 | static char *version = | 53 | static char *version = |
| 53 | "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; | 54 | "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; |
| 54 | 55 | ||
| @@ -444,7 +445,7 @@ static int cm4040_open(struct inode *inode, struct file *filp) | |||
| 444 | if (minor >= CM_MAX_DEV) | 445 | if (minor >= CM_MAX_DEV) |
| 445 | return -ENODEV; | 446 | return -ENODEV; |
| 446 | 447 | ||
| 447 | lock_kernel(); | 448 | mutex_lock(&cm4040_mutex); |
| 448 | link = dev_table[minor]; | 449 | link = dev_table[minor]; |
| 449 | if (link == NULL || !pcmcia_dev_present(link)) { | 450 | if (link == NULL || !pcmcia_dev_present(link)) { |
| 450 | ret = -ENODEV; | 451 | ret = -ENODEV; |
| @@ -473,7 +474,7 @@ static int cm4040_open(struct inode *inode, struct file *filp) | |||
| 473 | DEBUGP(2, dev, "<- cm4040_open (successfully)\n"); | 474 | DEBUGP(2, dev, "<- cm4040_open (successfully)\n"); |
| 474 | ret = nonseekable_open(inode, filp); | 475 | ret = nonseekable_open(inode, filp); |
| 475 | out: | 476 | out: |
| 476 | unlock_kernel(); | 477 | mutex_unlock(&cm4040_mutex); |
| 477 | return ret; | 478 | return ret; |
| 478 | } | 479 | } |
| 479 | 480 | ||
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 02abfddce45a..723152d978a9 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
| @@ -67,7 +67,7 @@ | |||
| 67 | #include <linux/slab.h> | 67 | #include <linux/slab.h> |
| 68 | #include <linux/major.h> | 68 | #include <linux/major.h> |
| 69 | #include <linux/ppdev.h> | 69 | #include <linux/ppdev.h> |
| 70 | #include <linux/smp_lock.h> | 70 | #include <linux/mutex.h> |
| 71 | #include <linux/uaccess.h> | 71 | #include <linux/uaccess.h> |
| 72 | 72 | ||
| 73 | #define PP_VERSION "ppdev: user-space parallel port driver" | 73 | #define PP_VERSION "ppdev: user-space parallel port driver" |
| @@ -97,6 +97,7 @@ struct pp_struct { | |||
| 97 | /* ROUND_UP macro from fs/select.c */ | 97 | /* ROUND_UP macro from fs/select.c */ |
| 98 | #define ROUND_UP(x,y) (((x)+(y)-1)/(y)) | 98 | #define ROUND_UP(x,y) (((x)+(y)-1)/(y)) |
| 99 | 99 | ||
| 100 | static DEFINE_MUTEX(pp_do_mutex); | ||
| 100 | static inline void pp_enable_irq (struct pp_struct *pp) | 101 | static inline void pp_enable_irq (struct pp_struct *pp) |
| 101 | { | 102 | { |
| 102 | struct parport *port = pp->pdev->port; | 103 | struct parport *port = pp->pdev->port; |
| @@ -630,9 +631,9 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 630 | static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 631 | static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
| 631 | { | 632 | { |
| 632 | long ret; | 633 | long ret; |
| 633 | lock_kernel(); | 634 | mutex_lock(&pp_do_mutex); |
| 634 | ret = pp_do_ioctl(file, cmd, arg); | 635 | ret = pp_do_ioctl(file, cmd, arg); |
| 635 | unlock_kernel(); | 636 | mutex_unlock(&pp_do_mutex); |
| 636 | return ret; | 637 | return ret; |
| 637 | } | 638 | } |
| 638 | 639 | ||
| @@ -641,7 +642,6 @@ static int pp_open (struct inode * inode, struct file * file) | |||
| 641 | unsigned int minor = iminor(inode); | 642 | unsigned int minor = iminor(inode); |
| 642 | struct pp_struct *pp; | 643 | struct pp_struct *pp; |
| 643 | 644 | ||
| 644 | cycle_kernel_lock(); | ||
| 645 | if (minor >= PARPORT_MAX) | 645 | if (minor >= PARPORT_MAX) |
| 646 | return -ENXIO; | 646 | return -ENXIO; |
| 647 | 647 | ||
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index d58c2eb07f07..e06a5977fdb2 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
| 45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
| 46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
| 47 | #include <linux/smp_lock.h> | 47 | #include <linux/mutex.h> |
| 48 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
| 49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
| 50 | 50 | ||
| @@ -122,6 +122,7 @@ more than 512 ports.... */ | |||
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | /* These constants are derived from SCO Source */ | 124 | /* These constants are derived from SCO Source */ |
| 125 | static DEFINE_MUTEX(rio_fw_mutex); | ||
| 125 | static struct Conf | 126 | static struct Conf |
| 126 | RIOConf = { | 127 | RIOConf = { |
| 127 | /* locator */ "RIO Config here", | 128 | /* locator */ "RIO Config here", |
| @@ -566,9 +567,9 @@ static long rio_fw_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 566 | func_enter(); | 567 | func_enter(); |
| 567 | 568 | ||
| 568 | /* The "dev" argument isn't used. */ | 569 | /* The "dev" argument isn't used. */ |
| 569 | lock_kernel(); | 570 | mutex_lock(&rio_fw_mutex); |
| 570 | rc = riocontrol(p, 0, cmd, arg, capable(CAP_SYS_ADMIN)); | 571 | rc = riocontrol(p, 0, cmd, arg, capable(CAP_SYS_ADMIN)); |
| 571 | unlock_kernel(); | 572 | mutex_unlock(&rio_fw_mutex); |
| 572 | 573 | ||
| 573 | func_exit(); | 574 | func_exit(); |
| 574 | return rc; | 575 | return rc; |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 32b74de18f5f..208e25731dfe 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <linux/poll.h> | 21 | #include <linux/poll.h> |
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/smp_lock.h> | 24 | #include <linux/mutex.h> |
| 25 | #include <asm/sn/io.h> | 25 | #include <asm/sn/io.h> |
| 26 | #include <asm/sn/sn_sal.h> | 26 | #include <asm/sn/sn_sal.h> |
| 27 | #include <asm/sn/module.h> | 27 | #include <asm/sn/module.h> |
| @@ -34,6 +34,7 @@ | |||
| 34 | #define SCDRV_BUFSZ 2048 | 34 | #define SCDRV_BUFSZ 2048 |
| 35 | #define SCDRV_TIMEOUT 1000 | 35 | #define SCDRV_TIMEOUT 1000 |
| 36 | 36 | ||
| 37 | static DEFINE_MUTEX(scdrv_mutex); | ||
| 37 | static irqreturn_t | 38 | static irqreturn_t |
| 38 | scdrv_interrupt(int irq, void *subch_data) | 39 | scdrv_interrupt(int irq, void *subch_data) |
| 39 | { | 40 | { |
| @@ -105,7 +106,7 @@ scdrv_open(struct inode *inode, struct file *file) | |||
| 105 | file->private_data = sd; | 106 | file->private_data = sd; |
| 106 | 107 | ||
| 107 | /* hook this subchannel up to the system controller interrupt */ | 108 | /* hook this subchannel up to the system controller interrupt */ |
| 108 | lock_kernel(); | 109 | mutex_lock(&scdrv_mutex); |
| 109 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, | 110 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, |
| 110 | IRQF_SHARED | IRQF_DISABLED, | 111 | IRQF_SHARED | IRQF_DISABLED, |
| 111 | SYSCTL_BASENAME, sd); | 112 | SYSCTL_BASENAME, sd); |
| @@ -113,10 +114,10 @@ scdrv_open(struct inode *inode, struct file *file) | |||
| 113 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); | 114 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); |
| 114 | kfree(sd); | 115 | kfree(sd); |
| 115 | printk("%s: irq request failed (%d)\n", __func__, rv); | 116 | printk("%s: irq request failed (%d)\n", __func__, rv); |
| 116 | unlock_kernel(); | 117 | mutex_unlock(&scdrv_mutex); |
| 117 | return -EBUSY; | 118 | return -EBUSY; |
| 118 | } | 119 | } |
| 119 | unlock_kernel(); | 120 | mutex_unlock(&scdrv_mutex); |
| 120 | return 0; | 121 | return 0; |
| 121 | } | 122 | } |
| 122 | 123 | ||
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index f8bc79f6de34..f8f09ab0b170 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>"); | |||
| 78 | MODULE_DESCRIPTION("Toshiba laptop SMM driver"); | 78 | MODULE_DESCRIPTION("Toshiba laptop SMM driver"); |
| 79 | MODULE_SUPPORTED_DEVICE("toshiba"); | 79 | MODULE_SUPPORTED_DEVICE("toshiba"); |
| 80 | 80 | ||
| 81 | static DEFINE_MUTEX(tosh_mutex); | ||
| 81 | static int tosh_fn; | 82 | static int tosh_fn; |
| 82 | module_param_named(fn, tosh_fn, int, 0); | 83 | module_param_named(fn, tosh_fn, int, 0); |
| 83 | MODULE_PARM_DESC(fn, "User specified Fn key detection port"); | 84 | MODULE_PARM_DESC(fn, "User specified Fn key detection port"); |
| @@ -274,16 +275,16 @@ static long tosh_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) | |||
| 274 | return -EINVAL; | 275 | return -EINVAL; |
| 275 | 276 | ||
| 276 | /* do we need to emulate the fan ? */ | 277 | /* do we need to emulate the fan ? */ |
| 277 | lock_kernel(); | 278 | mutex_lock(&tosh_mutex); |
| 278 | if (tosh_fan==1) { | 279 | if (tosh_fan==1) { |
| 279 | if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { | 280 | if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) { |
| 280 | err = tosh_emulate_fan(®s); | 281 | err = tosh_emulate_fan(®s); |
| 281 | unlock_kernel(); | 282 | mutex_unlock(&tosh_mutex); |
| 282 | break; | 283 | break; |
| 283 | } | 284 | } |
| 284 | } | 285 | } |
| 285 | err = tosh_smm(®s); | 286 | err = tosh_smm(®s); |
| 286 | unlock_kernel(); | 287 | mutex_unlock(&tosh_mutex); |
| 287 | break; | 288 | break; |
| 288 | default: | 289 | default: |
| 289 | return -EINVAL; | 290 | return -EINVAL; |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 42f7fa442ff8..6f954a808b65 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | #include <linux/completion.h> | 46 | #include <linux/completion.h> |
| 47 | #include <linux/proc_fs.h> | 47 | #include <linux/proc_fs.h> |
| 48 | #include <linux/seq_file.h> | 48 | #include <linux/seq_file.h> |
| 49 | #include <linux/smp_lock.h> | 49 | #include <linux/mutex.h> |
| 50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
| 51 | 51 | ||
| 52 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
| @@ -64,6 +64,7 @@ | |||
| 64 | #define VIOTAPE_KERN_WARN KERN_WARNING "viotape: " | 64 | #define VIOTAPE_KERN_WARN KERN_WARNING "viotape: " |
| 65 | #define VIOTAPE_KERN_INFO KERN_INFO "viotape: " | 65 | #define VIOTAPE_KERN_INFO KERN_INFO "viotape: " |
| 66 | 66 | ||
| 67 | static DEFINE_MUTEX(proc_viotape_mutex); | ||
| 67 | static int viotape_numdev; | 68 | static int viotape_numdev; |
| 68 | 69 | ||
| 69 | /* | 70 | /* |
| @@ -684,9 +685,9 @@ static long viotap_unlocked_ioctl(struct file *file, | |||
| 684 | { | 685 | { |
| 685 | long rc; | 686 | long rc; |
| 686 | 687 | ||
| 687 | lock_kernel(); | 688 | mutex_lock(&proc_viotape_mutex); |
| 688 | rc = viotap_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); | 689 | rc = viotap_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); |
| 689 | unlock_kernel(); | 690 | mutex_unlock(&proc_viotape_mutex); |
| 690 | return rc; | 691 | return rc; |
| 691 | } | 692 | } |
| 692 | 693 | ||
| @@ -700,7 +701,7 @@ static int viotap_open(struct inode *inode, struct file *file) | |||
| 700 | if (op == NULL) | 701 | if (op == NULL) |
| 701 | return -ENOMEM; | 702 | return -ENOMEM; |
| 702 | 703 | ||
| 703 | lock_kernel(); | 704 | mutex_lock(&proc_viotape_mutex); |
| 704 | get_dev_info(file->f_path.dentry->d_inode, &devi); | 705 | get_dev_info(file->f_path.dentry->d_inode, &devi); |
| 705 | 706 | ||
| 706 | /* Note: We currently only support one mode! */ | 707 | /* Note: We currently only support one mode! */ |
| @@ -731,7 +732,7 @@ static int viotap_open(struct inode *inode, struct file *file) | |||
| 731 | 732 | ||
| 732 | free_op: | 733 | free_op: |
| 733 | free_op_struct(op); | 734 | free_op_struct(op); |
| 734 | unlock_kernel(); | 735 | mutex_unlock(&proc_viotape_mutex); |
| 735 | return ret; | 736 | return ret; |
| 736 | } | 737 | } |
| 737 | 738 | ||
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index b663d573aad9..d985204d76fe 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
| @@ -81,7 +81,6 @@ | |||
| 81 | #include <linux/poll.h> | 81 | #include <linux/poll.h> |
| 82 | #include <linux/proc_fs.h> | 82 | #include <linux/proc_fs.h> |
| 83 | #include <linux/mutex.h> | 83 | #include <linux/mutex.h> |
| 84 | #include <linux/smp_lock.h> | ||
| 85 | #include <linux/sysctl.h> | 84 | #include <linux/sysctl.h> |
| 86 | #include <linux/fs.h> | 85 | #include <linux/fs.h> |
| 87 | #include <linux/cdev.h> | 86 | #include <linux/cdev.h> |
| @@ -112,6 +111,7 @@ | |||
| 112 | #define HWICAP_DEVICES 1 | 111 | #define HWICAP_DEVICES 1 |
| 113 | 112 | ||
| 114 | /* An array, which is set to true when the device is registered. */ | 113 | /* An array, which is set to true when the device is registered. */ |
| 114 | static DEFINE_MUTEX(hwicap_mutex); | ||
| 115 | static bool probed_devices[HWICAP_DEVICES]; | 115 | static bool probed_devices[HWICAP_DEVICES]; |
| 116 | static struct mutex icap_sem; | 116 | static struct mutex icap_sem; |
| 117 | 117 | ||
| @@ -502,7 +502,7 @@ static int hwicap_open(struct inode *inode, struct file *file) | |||
| 502 | struct hwicap_drvdata *drvdata; | 502 | struct hwicap_drvdata *drvdata; |
| 503 | int status; | 503 | int status; |
| 504 | 504 | ||
| 505 | lock_kernel(); | 505 | mutex_lock(&hwicap_mutex); |
| 506 | drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev); | 506 | drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev); |
| 507 | 507 | ||
| 508 | status = mutex_lock_interruptible(&drvdata->sem); | 508 | status = mutex_lock_interruptible(&drvdata->sem); |
| @@ -528,7 +528,7 @@ static int hwicap_open(struct inode *inode, struct file *file) | |||
| 528 | error: | 528 | error: |
| 529 | mutex_unlock(&drvdata->sem); | 529 | mutex_unlock(&drvdata->sem); |
| 530 | out: | 530 | out: |
| 531 | unlock_kernel(); | 531 | mutex_unlock(&hwicap_mutex); |
| 532 | return status; | 532 | return status; |
| 533 | } | 533 | } |
| 534 | 534 | ||
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index b7ca2a9676cf..d4d4ca65d371 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include <linux/i2c.h> | 38 | #include <linux/i2c.h> |
| 39 | #include <linux/hwmon.h> | 39 | #include <linux/hwmon.h> |
| 40 | #include <linux/hwmon-sysfs.h> | 40 | #include <linux/hwmon-sysfs.h> |
| 41 | #include <linux/smp_lock.h> | ||
| 42 | #include <linux/err.h> | 41 | #include <linux/err.h> |
| 43 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
| 44 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
| @@ -50,6 +49,7 @@ | |||
| 50 | #include <linux/kref.h> | 49 | #include <linux/kref.h> |
| 51 | 50 | ||
| 52 | /* Addresses to scan */ | 51 | /* Addresses to scan */ |
| 52 | static DEFINE_MUTEX(watchdog_mutex); | ||
| 53 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | 53 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; |
| 54 | 54 | ||
| 55 | /* Insmod parameters */ | 55 | /* Insmod parameters */ |
| @@ -858,7 +858,7 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long ar | |||
| 858 | int i, ret = 0; | 858 | int i, ret = 0; |
| 859 | struct fschmd_data *data = filp->private_data; | 859 | struct fschmd_data *data = filp->private_data; |
| 860 | 860 | ||
| 861 | lock_kernel(); | 861 | mutex_lock(&watchdog_mutex); |
| 862 | switch (cmd) { | 862 | switch (cmd) { |
| 863 | case WDIOC_GETSUPPORT: | 863 | case WDIOC_GETSUPPORT: |
| 864 | ident.firmware_version = data->revision; | 864 | ident.firmware_version = data->revision; |
| @@ -915,7 +915,7 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long ar | |||
| 915 | default: | 915 | default: |
| 916 | ret = -ENOTTY; | 916 | ret = -ENOTTY; |
| 917 | } | 917 | } |
| 918 | unlock_kernel(); | 918 | mutex_unlock(&watchdog_mutex); |
| 919 | return ret; | 919 | return ret; |
| 920 | } | 920 | } |
| 921 | 921 | ||
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 697202e27891..8e540ada47d2 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
| 36 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
| 37 | #include <linux/hwmon.h> | 37 | #include <linux/hwmon.h> |
| 38 | #include <linux/smp_lock.h> | ||
| 39 | #include <linux/hwmon-vid.h> | 38 | #include <linux/hwmon-vid.h> |
| 40 | #include <linux/hwmon-sysfs.h> | 39 | #include <linux/hwmon-sysfs.h> |
| 41 | #include <linux/err.h> | 40 | #include <linux/err.h> |
| @@ -52,6 +51,7 @@ | |||
| 52 | #define WATCHDOG_TIMEOUT 2 /* 2 minute default timeout */ | 51 | #define WATCHDOG_TIMEOUT 2 /* 2 minute default timeout */ |
| 53 | 52 | ||
| 54 | /* Addresses to scan */ | 53 | /* Addresses to scan */ |
| 54 | static DEFINE_MUTEX(watchdog_mutex); | ||
| 55 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, | 55 | static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, |
| 56 | I2C_CLIENT_END }; | 56 | I2C_CLIENT_END }; |
| 57 | 57 | ||
| @@ -1333,7 +1333,7 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, | |||
| 1333 | int val, ret = 0; | 1333 | int val, ret = 0; |
| 1334 | struct w83793_data *data = filp->private_data; | 1334 | struct w83793_data *data = filp->private_data; |
| 1335 | 1335 | ||
| 1336 | lock_kernel(); | 1336 | mutex_lock(&watchdog_mutex); |
| 1337 | switch (cmd) { | 1337 | switch (cmd) { |
| 1338 | case WDIOC_GETSUPPORT: | 1338 | case WDIOC_GETSUPPORT: |
| 1339 | if (!nowayout) | 1339 | if (!nowayout) |
| @@ -1387,7 +1387,7 @@ static long watchdog_ioctl(struct file *filp, unsigned int cmd, | |||
| 1387 | default: | 1387 | default: |
| 1388 | ret = -ENOTTY; | 1388 | ret = -ENOTTY; |
| 1389 | } | 1389 | } |
| 1390 | unlock_kernel(); | 1390 | mutex_unlock(&watchdog_mutex); |
| 1391 | return ret; | 1391 | return ret; |
| 1392 | } | 1392 | } |
| 1393 | 1393 | ||
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index c19066479057..07337061b2eb 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | #include <linux/proc_fs.h> | 43 | #include <linux/proc_fs.h> |
| 44 | #include <linux/poll.h> | 44 | #include <linux/poll.h> |
| 45 | #include <linux/rtc.h> | 45 | #include <linux/rtc.h> |
| 46 | #include <linux/smp_lock.h> | 46 | #include <linux/mutex.h> |
| 47 | #include <linux/semaphore.h> | 47 | #include <linux/semaphore.h> |
| 48 | 48 | ||
| 49 | MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); | 49 | MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); |
| @@ -52,6 +52,7 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
| 52 | 52 | ||
| 53 | #define RTC_VERSION "1.10d" | 53 | #define RTC_VERSION "1.10d" |
| 54 | 54 | ||
| 55 | static DEFINE_MUTEX(hp_sdc_rtc_mutex); | ||
| 55 | static unsigned long epoch = 2000; | 56 | static unsigned long epoch = 2000; |
| 56 | 57 | ||
| 57 | static struct semaphore i8042tregs; | 58 | static struct semaphore i8042tregs; |
| @@ -665,9 +666,9 @@ static long hp_sdc_rtc_unlocked_ioctl(struct file *file, | |||
| 665 | { | 666 | { |
| 666 | int ret; | 667 | int ret; |
| 667 | 668 | ||
| 668 | lock_kernel(); | 669 | mutex_lock(&hp_sdc_rtc_mutex); |
| 669 | ret = hp_sdc_rtc_ioctl(file, cmd, arg); | 670 | ret = hp_sdc_rtc_ioctl(file, cmd, arg); |
| 670 | unlock_kernel(); | 671 | mutex_unlock(&hp_sdc_rtc_mutex); |
| 671 | 672 | ||
| 672 | return ret; | 673 | return ret; |
| 673 | } | 674 | } |
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index 75ee0d3f6f45..3712e5077e25 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/phantom.h> | 25 | #include <linux/phantom.h> |
| 26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
| 27 | #include <linux/smp_lock.h> | 27 | #include <linux/mutex.h> |
| 28 | 28 | ||
| 29 | #include <asm/atomic.h> | 29 | #include <asm/atomic.h> |
| 30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
| @@ -38,6 +38,7 @@ | |||
| 38 | #define PHB_RUNNING 1 | 38 | #define PHB_RUNNING 1 |
| 39 | #define PHB_NOT_OH 2 | 39 | #define PHB_NOT_OH 2 |
| 40 | 40 | ||
| 41 | static DEFINE_MUTEX(phantom_mutex); | ||
| 41 | static struct class *phantom_class; | 42 | static struct class *phantom_class; |
| 42 | static int phantom_major; | 43 | static int phantom_major; |
| 43 | 44 | ||
| @@ -215,17 +216,17 @@ static int phantom_open(struct inode *inode, struct file *file) | |||
| 215 | struct phantom_device *dev = container_of(inode->i_cdev, | 216 | struct phantom_device *dev = container_of(inode->i_cdev, |
| 216 | struct phantom_device, cdev); | 217 | struct phantom_device, cdev); |
| 217 | 218 | ||
| 218 | lock_kernel(); | 219 | mutex_lock(&phantom_mutex); |
| 219 | nonseekable_open(inode, file); | 220 | nonseekable_open(inode, file); |
| 220 | 221 | ||
| 221 | if (mutex_lock_interruptible(&dev->open_lock)) { | 222 | if (mutex_lock_interruptible(&dev->open_lock)) { |
| 222 | unlock_kernel(); | 223 | mutex_unlock(&phantom_mutex); |
| 223 | return -ERESTARTSYS; | 224 | return -ERESTARTSYS; |
| 224 | } | 225 | } |
| 225 | 226 | ||
| 226 | if (dev->opened) { | 227 | if (dev->opened) { |
| 227 | mutex_unlock(&dev->open_lock); | 228 | mutex_unlock(&dev->open_lock); |
| 228 | unlock_kernel(); | 229 | mutex_unlock(&phantom_mutex); |
| 229 | return -EINVAL; | 230 | return -EINVAL; |
| 230 | } | 231 | } |
| 231 | 232 | ||
| @@ -236,7 +237,7 @@ static int phantom_open(struct inode *inode, struct file *file) | |||
| 236 | atomic_set(&dev->counter, 0); | 237 | atomic_set(&dev->counter, 0); |
| 237 | dev->opened++; | 238 | dev->opened++; |
| 238 | mutex_unlock(&dev->open_lock); | 239 | mutex_unlock(&dev->open_lock); |
| 239 | unlock_kernel(); | 240 | mutex_unlock(&phantom_mutex); |
| 240 | return 0; | 241 | return 0; |
| 241 | } | 242 | } |
| 242 | 243 | ||
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index 56215322930a..4cb30447a486 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
| @@ -34,10 +34,11 @@ | |||
| 34 | #include <linux/workqueue.h> | 34 | #include <linux/workqueue.h> |
| 35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
| 36 | #include <linux/pci_hotplug.h> | 36 | #include <linux/pci_hotplug.h> |
| 37 | #include <linux/smp_lock.h> | 37 | #include <linux/mutex.h> |
| 38 | #include <linux/debugfs.h> | 38 | #include <linux/debugfs.h> |
| 39 | #include "cpqphp.h" | 39 | #include "cpqphp.h" |
| 40 | 40 | ||
| 41 | static DEFINE_MUTEX(cpqphp_mutex); | ||
| 41 | static int show_ctrl (struct controller *ctrl, char *buf) | 42 | static int show_ctrl (struct controller *ctrl, char *buf) |
| 42 | { | 43 | { |
| 43 | char *out = buf; | 44 | char *out = buf; |
| @@ -147,7 +148,7 @@ static int open(struct inode *inode, struct file *file) | |||
| 147 | struct ctrl_dbg *dbg; | 148 | struct ctrl_dbg *dbg; |
| 148 | int retval = -ENOMEM; | 149 | int retval = -ENOMEM; |
| 149 | 150 | ||
| 150 | lock_kernel(); | 151 | mutex_lock(&cpqphp_mutex); |
| 151 | dbg = kmalloc(sizeof(*dbg), GFP_KERNEL); | 152 | dbg = kmalloc(sizeof(*dbg), GFP_KERNEL); |
| 152 | if (!dbg) | 153 | if (!dbg) |
| 153 | goto exit; | 154 | goto exit; |
| @@ -160,7 +161,7 @@ static int open(struct inode *inode, struct file *file) | |||
| 160 | file->private_data = dbg; | 161 | file->private_data = dbg; |
| 161 | retval = 0; | 162 | retval = 0; |
| 162 | exit: | 163 | exit: |
| 163 | unlock_kernel(); | 164 | mutex_unlock(&cpqphp_mutex); |
| 164 | return retval; | 165 | return retval; |
| 165 | } | 166 | } |
| 166 | 167 | ||
| @@ -169,7 +170,7 @@ static loff_t lseek(struct file *file, loff_t off, int whence) | |||
| 169 | struct ctrl_dbg *dbg; | 170 | struct ctrl_dbg *dbg; |
| 170 | loff_t new = -1; | 171 | loff_t new = -1; |
| 171 | 172 | ||
| 172 | lock_kernel(); | 173 | mutex_lock(&cpqphp_mutex); |
| 173 | dbg = file->private_data; | 174 | dbg = file->private_data; |
| 174 | 175 | ||
| 175 | switch (whence) { | 176 | switch (whence) { |
| @@ -181,10 +182,10 @@ static loff_t lseek(struct file *file, loff_t off, int whence) | |||
| 181 | break; | 182 | break; |
| 182 | } | 183 | } |
| 183 | if (new < 0 || new > dbg->size) { | 184 | if (new < 0 || new > dbg->size) { |
| 184 | unlock_kernel(); | 185 | mutex_unlock(&cpqphp_mutex); |
| 185 | return -EINVAL; | 186 | return -EINVAL; |
| 186 | } | 187 | } |
| 187 | unlock_kernel(); | 188 | mutex_unlock(&cpqphp_mutex); |
| 188 | return (file->f_pos = new); | 189 | return (file->f_pos = new); |
| 189 | } | 190 | } |
| 190 | 191 | ||
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index d60557cae8ef..512dca16a42c 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/rtc.h> | 21 | #include <linux/rtc.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/smp_lock.h> | 23 | #include <linux/mutex.h> |
| 24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
| 25 | #ifdef CONFIG_RTC_DRV_M41T80_WDT | 25 | #ifdef CONFIG_RTC_DRV_M41T80_WDT |
| 26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
| @@ -68,6 +68,7 @@ | |||
| 68 | 68 | ||
| 69 | #define DRV_VERSION "0.05" | 69 | #define DRV_VERSION "0.05" |
| 70 | 70 | ||
| 71 | static DEFINE_MUTEX(m41t80_rtc_mutex); | ||
| 71 | static const struct i2c_device_id m41t80_id[] = { | 72 | static const struct i2c_device_id m41t80_id[] = { |
| 72 | { "m41t62", M41T80_FEATURE_SQ | M41T80_FEATURE_SQ_ALT }, | 73 | { "m41t62", M41T80_FEATURE_SQ | M41T80_FEATURE_SQ_ALT }, |
| 73 | { "m41t65", M41T80_FEATURE_HT | M41T80_FEATURE_WD }, | 74 | { "m41t65", M41T80_FEATURE_HT | M41T80_FEATURE_WD }, |
| @@ -677,9 +678,9 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd, | |||
| 677 | { | 678 | { |
| 678 | int ret; | 679 | int ret; |
| 679 | 680 | ||
| 680 | lock_kernel(); | 681 | mutex_lock(&m41t80_rtc_mutex); |
| 681 | ret = wdt_ioctl(file, cmd, arg); | 682 | ret = wdt_ioctl(file, cmd, arg); |
| 682 | unlock_kernel(); | 683 | mutex_unlock(&m41t80_rtc_mutex); |
| 683 | 684 | ||
| 684 | return ret; | 685 | return ret; |
| 685 | } | 686 | } |
| @@ -693,16 +694,16 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd, | |||
| 693 | static int wdt_open(struct inode *inode, struct file *file) | 694 | static int wdt_open(struct inode *inode, struct file *file) |
| 694 | { | 695 | { |
| 695 | if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) { | 696 | if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) { |
| 696 | lock_kernel(); | 697 | mutex_lock(&m41t80_rtc_mutex); |
| 697 | if (test_and_set_bit(0, &wdt_is_open)) { | 698 | if (test_and_set_bit(0, &wdt_is_open)) { |
| 698 | unlock_kernel(); | 699 | mutex_unlock(&m41t80_rtc_mutex); |
| 699 | return -EBUSY; | 700 | return -EBUSY; |
| 700 | } | 701 | } |
| 701 | /* | 702 | /* |
| 702 | * Activate | 703 | * Activate |
| 703 | */ | 704 | */ |
| 704 | wdt_is_open = 1; | 705 | wdt_is_open = 1; |
| 705 | unlock_kernel(); | 706 | mutex_unlock(&m41t80_rtc_mutex); |
| 706 | return nonseekable_open(inode, file); | 707 | return nonseekable_open(inode, file); |
| 707 | } | 708 | } |
| 708 | return -ENODEV; | 709 | return -ENODEV; |
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index 4942050dc5b6..13f48e28a1e1 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | #include <linux/smp_lock.h> | 30 | #include <linux/mutex.h> |
| 31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
| 32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
| 33 | #include <linux/miscdevice.h> | 33 | #include <linux/miscdevice.h> |
| @@ -68,6 +68,8 @@ | |||
| 68 | #define JSF_PART_BITS 2 /* 2 bits of minors to cover JSF_NPART */ | 68 | #define JSF_PART_BITS 2 /* 2 bits of minors to cover JSF_NPART */ |
| 69 | #define JSF_PART_MASK 0x3 /* 2 bits mask */ | 69 | #define JSF_PART_MASK 0x3 /* 2 bits mask */ |
| 70 | 70 | ||
| 71 | static DEFINE_MUTEX(jsf_mutex); | ||
| 72 | |||
| 71 | /* | 73 | /* |
| 72 | * Access functions. | 74 | * Access functions. |
| 73 | * We could ioremap(), but it's easier this way. | 75 | * We could ioremap(), but it's easier this way. |
| @@ -225,7 +227,7 @@ static loff_t jsf_lseek(struct file * file, loff_t offset, int orig) | |||
| 225 | { | 227 | { |
| 226 | loff_t ret; | 228 | loff_t ret; |
| 227 | 229 | ||
| 228 | lock_kernel(); | 230 | mutex_lock(&jsf_mutex); |
| 229 | switch (orig) { | 231 | switch (orig) { |
| 230 | case 0: | 232 | case 0: |
| 231 | file->f_pos = offset; | 233 | file->f_pos = offset; |
| @@ -238,7 +240,7 @@ static loff_t jsf_lseek(struct file * file, loff_t offset, int orig) | |||
| 238 | default: | 240 | default: |
| 239 | ret = -EINVAL; | 241 | ret = -EINVAL; |
| 240 | } | 242 | } |
| 241 | unlock_kernel(); | 243 | mutex_unlock(&jsf_mutex); |
| 242 | return ret; | 244 | return ret; |
| 243 | } | 245 | } |
| 244 | 246 | ||
| @@ -384,18 +386,18 @@ static int jsf_ioctl_program(void __user *arg) | |||
| 384 | 386 | ||
| 385 | static long jsf_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | 387 | static long jsf_ioctl(struct file *f, unsigned int cmd, unsigned long arg) |
| 386 | { | 388 | { |
| 387 | lock_kernel(); | 389 | mutex_lock(&jsf_mutex); |
| 388 | int error = -ENOTTY; | 390 | int error = -ENOTTY; |
| 389 | void __user *argp = (void __user *)arg; | 391 | void __user *argp = (void __user *)arg; |
| 390 | 392 | ||
| 391 | if (!capable(CAP_SYS_ADMIN)) { | 393 | if (!capable(CAP_SYS_ADMIN)) { |
| 392 | unlock_kernel(); | 394 | mutex_unlock(&jsf_mutex); |
| 393 | return -EPERM; | 395 | return -EPERM; |
| 394 | } | 396 | } |
| 395 | switch (cmd) { | 397 | switch (cmd) { |
| 396 | case JSFLASH_IDENT: | 398 | case JSFLASH_IDENT: |
| 397 | if (copy_to_user(argp, &jsf0.id, JSFIDSZ)) { | 399 | if (copy_to_user(argp, &jsf0.id, JSFIDSZ)) { |
| 398 | unlock_kernel(); | 400 | mutex_unlock(&jsf_mutex); |
| 399 | return -EFAULT; | 401 | return -EFAULT; |
| 400 | } | 402 | } |
| 401 | break; | 403 | break; |
| @@ -407,7 +409,7 @@ static long jsf_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | |||
| 407 | break; | 409 | break; |
| 408 | } | 410 | } |
| 409 | 411 | ||
| 410 | unlock_kernel(); | 412 | mutex_unlock(&jsf_mutex); |
| 411 | return error; | 413 | return error; |
| 412 | } | 414 | } |
| 413 | 415 | ||
| @@ -418,17 +420,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma) | |||
| 418 | 420 | ||
| 419 | static int jsf_open(struct inode * inode, struct file * filp) | 421 | static int jsf_open(struct inode * inode, struct file * filp) |
| 420 | { | 422 | { |
| 421 | lock_kernel(); | 423 | mutex_lock(&jsf_mutex); |
| 422 | if (jsf0.base == 0) { | 424 | if (jsf0.base == 0) { |
| 423 | unlock_kernel(); | 425 | mutex_unlock(&jsf_mutex); |
| 424 | return -ENXIO; | 426 | return -ENXIO; |
| 425 | } | 427 | } |
| 426 | if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) { | 428 | if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) { |
| 427 | unlock_kernel(); | 429 | mutex_unlock(&jsf_mutex); |
| 428 | return -EBUSY; | 430 | return -EBUSY; |
| 429 | } | 431 | } |
| 430 | 432 | ||
| 431 | unlock_kernel(); | 433 | mutex_unlock(&jsf_mutex); |
| 432 | return 0; /* XXX What security? */ | 434 | return 0; /* XXX What security? */ |
| 433 | } | 435 | } |
| 434 | 436 | ||
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index b53deee25d74..b1e469983b1d 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c | |||
| @@ -257,7 +257,7 @@ | |||
| 257 | #include <linux/fs.h> /* everything... */ | 257 | #include <linux/fs.h> /* everything... */ |
| 258 | #include <linux/errno.h> /* error codes */ | 258 | #include <linux/errno.h> /* error codes */ |
| 259 | #include <linux/slab.h> | 259 | #include <linux/slab.h> |
| 260 | #include <linux/smp_lock.h> | 260 | #include <linux/mutex.h> |
| 261 | #include <linux/mm.h> | 261 | #include <linux/mm.h> |
| 262 | #include <linux/ioport.h> | 262 | #include <linux/ioport.h> |
| 263 | #include <linux/interrupt.h> | 263 | #include <linux/interrupt.h> |
| @@ -277,6 +277,7 @@ | |||
| 277 | #define TYPE(inode) (iminor(inode) >> 4) | 277 | #define TYPE(inode) (iminor(inode) >> 4) |
| 278 | #define NUM(inode) (iminor(inode) & 0xf) | 278 | #define NUM(inode) (iminor(inode) & 0xf) |
| 279 | 279 | ||
| 280 | static DEFINE_MUTEX(ixj_mutex); | ||
| 280 | static int ixjdebug; | 281 | static int ixjdebug; |
| 281 | static int hertz = HZ; | 282 | static int hertz = HZ; |
| 282 | static int samplerate = 100; | 283 | static int samplerate = 100; |
| @@ -6655,9 +6656,9 @@ static long do_ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long ar | |||
| 6655 | static long ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long arg) | 6656 | static long ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long arg) |
| 6656 | { | 6657 | { |
| 6657 | long ret; | 6658 | long ret; |
| 6658 | lock_kernel(); | 6659 | mutex_lock(&ixj_mutex); |
| 6659 | ret = do_ixj_ioctl(file_p, cmd, arg); | 6660 | ret = do_ixj_ioctl(file_p, cmd, arg); |
| 6660 | unlock_kernel(); | 6661 | mutex_unlock(&ixj_mutex); |
| 6661 | return ret; | 6662 | return ret; |
| 6662 | } | 6663 | } |
| 6663 | 6664 | ||
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 566343b3c131..b7d96e6236a1 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
| 26 | #include <linux/timer.h> | 26 | #include <linux/timer.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <linux/smp_lock.h> | 28 | #include <linux/mutex.h> |
| 29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
| 30 | #include <linux/of.h> | 30 | #include <linux/of.h> |
| 31 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
| @@ -89,6 +89,7 @@ struct cpwd { | |||
| 89 | } devs[WD_NUMDEVS]; | 89 | } devs[WD_NUMDEVS]; |
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | static DEFINE_MUTEX(cpwd_mutex); | ||
| 92 | static struct cpwd *cpwd_device; | 93 | static struct cpwd *cpwd_device; |
| 93 | 94 | ||
| 94 | /* Sun uses Altera PLD EPF8820ATC144-4 | 95 | /* Sun uses Altera PLD EPF8820ATC144-4 |
| @@ -368,7 +369,7 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
| 368 | { | 369 | { |
| 369 | struct cpwd *p = cpwd_device; | 370 | struct cpwd *p = cpwd_device; |
| 370 | 371 | ||
| 371 | lock_kernel(); | 372 | mutex_lock(&cpwd_mutex); |
| 372 | switch (iminor(inode)) { | 373 | switch (iminor(inode)) { |
| 373 | case WD0_MINOR: | 374 | case WD0_MINOR: |
| 374 | case WD1_MINOR: | 375 | case WD1_MINOR: |
| @@ -376,7 +377,7 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
| 376 | break; | 377 | break; |
| 377 | 378 | ||
| 378 | default: | 379 | default: |
| 379 | unlock_kernel(); | 380 | mutex_unlock(&cpwd_mutex); |
| 380 | return -ENODEV; | 381 | return -ENODEV; |
| 381 | } | 382 | } |
| 382 | 383 | ||
| @@ -386,13 +387,13 @@ static int cpwd_open(struct inode *inode, struct file *f) | |||
| 386 | IRQF_SHARED, DRIVER_NAME, p)) { | 387 | IRQF_SHARED, DRIVER_NAME, p)) { |
| 387 | printk(KERN_ERR PFX "Cannot register IRQ %d\n", | 388 | printk(KERN_ERR PFX "Cannot register IRQ %d\n", |
| 388 | p->irq); | 389 | p->irq); |
| 389 | unlock_kernel(); | 390 | mutex_unlock(&cpwd_mutex); |
| 390 | return -EBUSY; | 391 | return -EBUSY; |
| 391 | } | 392 | } |
| 392 | p->initialized = true; | 393 | p->initialized = true; |
| 393 | } | 394 | } |
| 394 | 395 | ||
| 395 | unlock_kernel(); | 396 | mutex_unlock(&cpwd_mutex); |
| 396 | 397 | ||
| 397 | return nonseekable_open(inode, f); | 398 | return nonseekable_open(inode, f); |
| 398 | } | 399 | } |
| @@ -482,9 +483,9 @@ static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, | |||
| 482 | case WIOCSTART: | 483 | case WIOCSTART: |
| 483 | case WIOCSTOP: | 484 | case WIOCSTOP: |
| 484 | case WIOCGSTAT: | 485 | case WIOCGSTAT: |
| 485 | lock_kernel(); | 486 | mutex_lock(&cpwd_mutex); |
| 486 | rval = cpwd_ioctl(file, cmd, arg); | 487 | rval = cpwd_ioctl(file, cmd, arg); |
| 487 | unlock_kernel(); | 488 | mutex_unlock(&cpwd_mutex); |
| 488 | break; | 489 | break; |
| 489 | 490 | ||
| 490 | /* everything else is handled by the generic compat layer */ | 491 | /* everything else is handled by the generic compat layer */ |
