summaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c14
-rw-r--r--drivers/ide/ide-disk_ioctl.c7
-rw-r--r--drivers/ide/ide-floppy_ioctl.c7
-rw-r--r--drivers/ide/ide-gd.c10
-rw-r--r--drivers/ide/ide-tape.c19
5 files changed, 29 insertions, 28 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 31fc76960a8f..0c73fe39a236 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -31,7 +31,6 @@
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/seq_file.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
@@ -52,6 +51,7 @@
#include "ide-cd.h"
+static DEFINE_MUTEX(ide_cd_mutex);
static DEFINE_MUTEX(idecd_ref_mutex);
static void ide_cd_release(struct device *);
@@ -1602,7 +1602,7 @@ static int idecd_open(struct block_device *bdev, fmode_t mode)
struct cdrom_info *info;
int rc = -ENXIO;
- lock_kernel();
+ mutex_lock(&ide_cd_mutex);
info = ide_cd_get(bdev->bd_disk);
if (!info)
goto out;
@@ -1611,7 +1611,7 @@ static int idecd_open(struct block_device *bdev, fmode_t mode)
if (rc < 0)
ide_cd_put(info);
out:
- unlock_kernel();
+ mutex_unlock(&ide_cd_mutex);
return rc;
}
@@ -1619,11 +1619,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode)
{
struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
- lock_kernel();
+ mutex_lock(&ide_cd_mutex);
cdrom_release(&info->devinfo, mode);
ide_cd_put(info);
- unlock_kernel();
+ mutex_unlock(&ide_cd_mutex);
return 0;
}
@@ -1694,9 +1694,9 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
{
int ret;
- lock_kernel();
+ mutex_lock(&ide_cd_mutex);
ret = idecd_locked_ioctl(bdev, mode, cmd, arg);
- unlock_kernel();
+ mutex_unlock(&ide_cd_mutex);
return ret;
}
diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c
index ec94c66918f6..da36f729ff32 100644
--- a/drivers/ide/ide-disk_ioctl.c
+++ b/drivers/ide/ide-disk_ioctl.c
@@ -1,10 +1,11 @@
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/hdreg.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include "ide-disk.h"
+static DEFINE_MUTEX(ide_disk_ioctl_mutex);
static const struct ide_ioctl_devset ide_disk_ioctl_settings[] = {
{ HDIO_GET_ADDRESS, HDIO_SET_ADDRESS, &ide_devset_address },
{ HDIO_GET_MULTCOUNT, HDIO_SET_MULTCOUNT, &ide_devset_multcount },
@@ -19,13 +20,13 @@ int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode,
{
int err;
- lock_kernel();
+ mutex_lock(&ide_disk_ioctl_mutex);
err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings);
if (err != -EOPNOTSUPP)
goto out;
err = generic_ide_ioctl(drive, bdev, cmd, arg);
out:
- unlock_kernel();
+ mutex_unlock(&ide_disk_ioctl_mutex);
return err;
}
diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
index fd3d05ab3417..d267b7affad6 100644
--- a/drivers/ide/ide-floppy_ioctl.c
+++ b/drivers/ide/ide-floppy_ioctl.c
@@ -5,7 +5,7 @@
#include <linux/kernel.h>
#include <linux/ide.h>
#include <linux/cdrom.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <asm/unaligned.h>
@@ -32,6 +32,7 @@
* On exit we set nformats to the number of records we've actually initialized.
*/
+static DEFINE_MUTEX(ide_floppy_ioctl_mutex);
static int ide_floppy_get_format_capacities(ide_drive_t *drive,
struct ide_atapi_pc *pc,
int __user *arg)
@@ -276,7 +277,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
void __user *argp = (void __user *)arg;
int err;
- lock_kernel();
+ mutex_lock(&ide_floppy_ioctl_mutex);
if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) {
err = ide_floppy_lockdoor(drive, &pc, arg, cmd);
goto out;
@@ -298,6 +299,6 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
err = generic_ide_ioctl(drive, bdev, cmd, arg);
out:
- unlock_kernel();
+ mutex_unlock(&ide_floppy_ioctl_mutex);
return err;
}
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 70aeeb18833e..35c4b43585e3 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -1,4 +1,3 @@
-#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
@@ -23,6 +22,7 @@
#define IDE_GD_VERSION "1.18"
/* module parameters */
+static DEFINE_MUTEX(ide_gd_mutex);
static unsigned long debug_mask;
module_param(debug_mask, ulong, 0644);
@@ -242,9 +242,9 @@ static int ide_gd_unlocked_open(struct block_device *bdev, fmode_t mode)
{
int ret;
- lock_kernel();
+ mutex_lock(&ide_gd_mutex);
ret = ide_gd_open(bdev, mode);
- unlock_kernel();
+ mutex_unlock(&ide_gd_mutex);
return ret;
}
@@ -257,7 +257,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode)
ide_debug_log(IDE_DBG_FUNC, "enter");
- lock_kernel();
+ mutex_lock(&ide_gd_mutex);
if (idkp->openers == 1)
drive->disk_ops->flush(drive);
@@ -269,7 +269,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode)
idkp->openers--;
ide_disk_put(idkp);
- unlock_kernel();
+ mutex_unlock(&ide_gd_mutex);
return 0;
}
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 6d622cb5ac81..65f0bcfb42ca 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -32,11 +32,9 @@
#include <linux/errno.h>
#include <linux/genhd.h>
#include <linux/seq_file.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/ide.h>
-#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <linux/bitops.h>
#include <linux/mutex.h>
@@ -220,6 +218,7 @@ typedef struct ide_tape_obj {
char write_prot;
} idetape_tape_t;
+static DEFINE_MUTEX(ide_tape_mutex);
static DEFINE_MUTEX(idetape_ref_mutex);
static DEFINE_MUTEX(idetape_chrdev_mutex);
@@ -1426,9 +1425,9 @@ static long idetape_chrdev_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
long ret;
- lock_kernel();
+ mutex_lock(&ide_tape_mutex);
ret = do_idetape_chrdev_ioctl(file, cmd, arg);
- unlock_kernel();
+ mutex_unlock(&ide_tape_mutex);
return ret;
}
@@ -1909,9 +1908,9 @@ static int idetape_open(struct block_device *bdev, fmode_t mode)
{
struct ide_tape_obj *tape;
- lock_kernel();
+ mutex_lock(&ide_tape_mutex);
tape = ide_tape_get(bdev->bd_disk, false, 0);
- unlock_kernel();
+ mutex_unlock(&ide_tape_mutex);
if (!tape)
return -ENXIO;
@@ -1923,9 +1922,9 @@ static int idetape_release(struct gendisk *disk, fmode_t mode)
{
struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj);
- lock_kernel();
+ mutex_lock(&ide_tape_mutex);
ide_tape_put(tape);
- unlock_kernel();
+ mutex_unlock(&ide_tape_mutex);
return 0;
}
@@ -1937,11 +1936,11 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode,
ide_drive_t *drive = tape->drive;
int err;
- lock_kernel();
+ mutex_lock(&ide_tape_mutex);
err = generic_ide_ioctl(drive, bdev, cmd, arg);
if (err == -EINVAL)
err = idetape_blkdev_ioctl(drive, cmd, arg);
- unlock_kernel();
+ mutex_unlock(&ide_tape_mutex);
return err;
}