diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 19 |
1 files changed, 9 insertions, 10 deletions
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 @@ | |||
32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
33 | #include <linux/genhd.h> | 33 | #include <linux/genhd.h> |
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
37 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
38 | #include <linux/ide.h> | 37 | #include <linux/ide.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/completion.h> | 38 | #include <linux/completion.h> |
41 | #include <linux/bitops.h> | 39 | #include <linux/bitops.h> |
42 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
@@ -220,6 +218,7 @@ typedef struct ide_tape_obj { | |||
220 | char write_prot; | 218 | char write_prot; |
221 | } idetape_tape_t; | 219 | } idetape_tape_t; |
222 | 220 | ||
221 | static DEFINE_MUTEX(ide_tape_mutex); | ||
223 | static DEFINE_MUTEX(idetape_ref_mutex); | 222 | static DEFINE_MUTEX(idetape_ref_mutex); |
224 | 223 | ||
225 | static DEFINE_MUTEX(idetape_chrdev_mutex); | 224 | static DEFINE_MUTEX(idetape_chrdev_mutex); |
@@ -1426,9 +1425,9 @@ static long idetape_chrdev_ioctl(struct file *file, | |||
1426 | unsigned int cmd, unsigned long arg) | 1425 | unsigned int cmd, unsigned long arg) |
1427 | { | 1426 | { |
1428 | long ret; | 1427 | long ret; |
1429 | lock_kernel(); | 1428 | mutex_lock(&ide_tape_mutex); |
1430 | ret = do_idetape_chrdev_ioctl(file, cmd, arg); | 1429 | ret = do_idetape_chrdev_ioctl(file, cmd, arg); |
1431 | unlock_kernel(); | 1430 | mutex_unlock(&ide_tape_mutex); |
1432 | return ret; | 1431 | return ret; |
1433 | } | 1432 | } |
1434 | 1433 | ||
@@ -1909,9 +1908,9 @@ static int idetape_open(struct block_device *bdev, fmode_t mode) | |||
1909 | { | 1908 | { |
1910 | struct ide_tape_obj *tape; | 1909 | struct ide_tape_obj *tape; |
1911 | 1910 | ||
1912 | lock_kernel(); | 1911 | mutex_lock(&ide_tape_mutex); |
1913 | tape = ide_tape_get(bdev->bd_disk, false, 0); | 1912 | tape = ide_tape_get(bdev->bd_disk, false, 0); |
1914 | unlock_kernel(); | 1913 | mutex_unlock(&ide_tape_mutex); |
1915 | 1914 | ||
1916 | if (!tape) | 1915 | if (!tape) |
1917 | return -ENXIO; | 1916 | return -ENXIO; |
@@ -1923,9 +1922,9 @@ static int idetape_release(struct gendisk *disk, fmode_t mode) | |||
1923 | { | 1922 | { |
1924 | struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); | 1923 | struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); |
1925 | 1924 | ||
1926 | lock_kernel(); | 1925 | mutex_lock(&ide_tape_mutex); |
1927 | ide_tape_put(tape); | 1926 | ide_tape_put(tape); |
1928 | unlock_kernel(); | 1927 | mutex_unlock(&ide_tape_mutex); |
1929 | 1928 | ||
1930 | return 0; | 1929 | return 0; |
1931 | } | 1930 | } |
@@ -1937,11 +1936,11 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode, | |||
1937 | ide_drive_t *drive = tape->drive; | 1936 | ide_drive_t *drive = tape->drive; |
1938 | int err; | 1937 | int err; |
1939 | 1938 | ||
1940 | lock_kernel(); | 1939 | mutex_lock(&ide_tape_mutex); |
1941 | err = generic_ide_ioctl(drive, bdev, cmd, arg); | 1940 | err = generic_ide_ioctl(drive, bdev, cmd, arg); |
1942 | if (err == -EINVAL) | 1941 | if (err == -EINVAL) |
1943 | err = idetape_blkdev_ioctl(drive, cmd, arg); | 1942 | err = idetape_blkdev_ioctl(drive, cmd, arg); |
1944 | unlock_kernel(); | 1943 | mutex_unlock(&ide_tape_mutex); |
1945 | 1944 | ||
1946 | return err; | 1945 | return err; |
1947 | } | 1946 | } |