aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/amiflop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/amiflop.c')
-rw-r--r--drivers/block/amiflop.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 76f114f0bba3..4b852c962266 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -60,7 +60,7 @@
60#include <linux/hdreg.h> 60#include <linux/hdreg.h>
61#include <linux/delay.h> 61#include <linux/delay.h>
62#include <linux/init.h> 62#include <linux/init.h>
63#include <linux/smp_lock.h> 63#include <linux/mutex.h>
64#include <linux/amifdreg.h> 64#include <linux/amifdreg.h>
65#include <linux/amifd.h> 65#include <linux/amifd.h>
66#include <linux/buffer_head.h> 66#include <linux/buffer_head.h>
@@ -109,6 +109,7 @@
109#define FD_HD_3 0x55555555 /* high-density 3.5" (1760K) drive */ 109#define FD_HD_3 0x55555555 /* high-density 3.5" (1760K) drive */
110#define FD_DD_5 0xaaaaaaaa /* double-density 5.25" (440K) drive */ 110#define FD_DD_5 0xaaaaaaaa /* double-density 5.25" (440K) drive */
111 111
112static DEFINE_MUTEX(amiflop_mutex);
112static unsigned long int fd_def_df0 = FD_DD_3; /* default for df0 if it doesn't identify */ 113static unsigned long int fd_def_df0 = FD_DD_3; /* default for df0 if it doesn't identify */
113 114
114module_param(fd_def_df0, ulong, 0); 115module_param(fd_def_df0, ulong, 0);
@@ -1506,9 +1507,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode,
1506{ 1507{
1507 int ret; 1508 int ret;
1508 1509
1509 lock_kernel(); 1510 mutex_lock(&amiflop_mutex);
1510 ret = fd_locked_ioctl(bdev, mode, cmd, param); 1511 ret = fd_locked_ioctl(bdev, mode, cmd, param);
1511 unlock_kernel(); 1512 mutex_unlock(&amiflop_mutex);
1512 1513
1513 return ret; 1514 return ret;
1514} 1515}
@@ -1555,11 +1556,11 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
1555 int old_dev; 1556 int old_dev;
1556 unsigned long flags; 1557 unsigned long flags;
1557 1558
1558 lock_kernel(); 1559 mutex_lock(&amiflop_mutex);
1559 old_dev = fd_device[drive]; 1560 old_dev = fd_device[drive];
1560 1561
1561 if (fd_ref[drive] && old_dev != system) { 1562 if (fd_ref[drive] && old_dev != system) {
1562 unlock_kernel(); 1563 mutex_unlock(&amiflop_mutex);
1563 return -EBUSY; 1564 return -EBUSY;
1564 } 1565 }
1565 1566
@@ -1575,7 +1576,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
1575 rel_fdc(); 1576 rel_fdc();
1576 1577
1577 if (wrprot) { 1578 if (wrprot) {
1578 unlock_kernel(); 1579 mutex_unlock(&amiflop_mutex);
1579 return -EROFS; 1580 return -EROFS;
1580 } 1581 }
1581 } 1582 }
@@ -1594,7 +1595,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
1594 printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, 1595 printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive,
1595 unit[drive].type->name, data_types[system].name); 1596 unit[drive].type->name, data_types[system].name);
1596 1597
1597 unlock_kernel(); 1598 mutex_unlock(&amiflop_mutex);
1598 return 0; 1599 return 0;
1599} 1600}
1600 1601
@@ -1603,7 +1604,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
1603 struct amiga_floppy_struct *p = disk->private_data; 1604 struct amiga_floppy_struct *p = disk->private_data;
1604 int drive = p - unit; 1605 int drive = p - unit;
1605 1606
1606 lock_kernel(); 1607 mutex_lock(&amiflop_mutex);
1607 if (unit[drive].dirty == 1) { 1608 if (unit[drive].dirty == 1) {
1608 del_timer (flush_track_timer + drive); 1609 del_timer (flush_track_timer + drive);
1609 non_int_flush_track (drive); 1610 non_int_flush_track (drive);
@@ -1617,7 +1618,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
1617/* the mod_use counter is handled this way */ 1618/* the mod_use counter is handled this way */
1618 floppy_off (drive | 0x40000000); 1619 floppy_off (drive | 0x40000000);
1619#endif 1620#endif
1620 unlock_kernel(); 1621 mutex_unlock(&amiflop_mutex);
1621 return 0; 1622 return 0;
1622} 1623}
1623 1624