]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/ide/ide-floppy_ioctl.c
block: autoconvert trivial BKL users to private mutex
[net-next-2.6.git] / drivers / ide / ide-floppy_ioctl.c
index 9c2288234dea484e8cbac8abbdd71fdc651664b7..d267b7affad63fab887a10585e647cec6eb98020 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/kernel.h>
 #include <linux/ide.h>
 #include <linux/cdrom.h>
+#include <linux/mutex.h>
 
 #include <asm/unaligned.h>
 
@@ -31,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)
@@ -275,12 +277,15 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
        void __user *argp = (void __user *)arg;
        int err;
 
-       if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR)
-               return ide_floppy_lockdoor(drive, &pc, arg, cmd);
+       mutex_lock(&ide_floppy_ioctl_mutex);
+       if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) {
+               err = ide_floppy_lockdoor(drive, &pc, arg, cmd);
+               goto out;
+       }
 
        err = ide_floppy_format_ioctl(drive, &pc, mode, cmd, argp);
        if (err != -ENOTTY)
-               return err;
+               goto out;
 
        /*
         * skip SCSI_IOCTL_SEND_COMMAND (deprecated)
@@ -293,5 +298,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
        if (err == -ENOTTY)
                err = generic_ide_ioctl(drive, bdev, cmd, arg);
 
+out:
+       mutex_unlock(&ide_floppy_ioctl_mutex);
        return err;
 }