Commit b1c82b5c55851bf309f4019994610789f7042757

Authored by Jes Sorensen
Committed by Linus Torvalds
1 parent 1657f824e8

[PATCH] sem2mutex: drivers/block/floppy.c

Convert from semaphore to mutex.
Untested as I have no access to a floppy drive at the moment.

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 9 additions and 8 deletions Side-by-side Diff

drivers/block/floppy.c
... ... @@ -179,6 +179,7 @@
179 179 #include <linux/devfs_fs_kernel.h>
180 180 #include <linux/platform_device.h>
181 181 #include <linux/buffer_head.h> /* for invalidate_buffers() */
  182 +#include <linux/mutex.h>
182 183  
183 184 /*
184 185 * PS/2 floppies have much slower step rates than regular floppies.
... ... @@ -413,7 +414,7 @@
413 414 static struct timer_list motor_off_timer[N_DRIVE];
414 415 static struct gendisk *disks[N_DRIVE];
415 416 static struct block_device *opened_bdev[N_DRIVE];
416   -static DECLARE_MUTEX(open_lock);
  417 +static DEFINE_MUTEX(open_lock);
417 418 static struct floppy_raw_cmd *raw_cmd, default_raw_cmd;
418 419  
419 420 /*
... ... @@ -3333,7 +3334,7 @@
3333 3334 if (type) {
3334 3335 if (!capable(CAP_SYS_ADMIN))
3335 3336 return -EPERM;
3336   - down(&open_lock);
  3337 + mutex_lock(&open_lock);
3337 3338 LOCK_FDC(drive, 1);
3338 3339 floppy_type[type] = *g;
3339 3340 floppy_type[type].name = "user format";
... ... @@ -3347,7 +3348,7 @@
3347 3348 continue;
3348 3349 __invalidate_device(bdev);
3349 3350 }
3350   - up(&open_lock);
  3351 + mutex_unlock(&open_lock);
3351 3352 } else {
3352 3353 int oldStretch;
3353 3354 LOCK_FDC(drive, 1);
... ... @@ -3674,7 +3675,7 @@
3674 3675 {
3675 3676 int drive = (long)inode->i_bdev->bd_disk->private_data;
3676 3677  
3677   - down(&open_lock);
  3678 + mutex_lock(&open_lock);
3678 3679 if (UDRS->fd_ref < 0)
3679 3680 UDRS->fd_ref = 0;
3680 3681 else if (!UDRS->fd_ref--) {
... ... @@ -3684,7 +3685,7 @@
3684 3685 if (!UDRS->fd_ref)
3685 3686 opened_bdev[drive] = NULL;
3686 3687 floppy_release_irq_and_dma();
3687   - up(&open_lock);
  3688 + mutex_unlock(&open_lock);
3688 3689 return 0;
3689 3690 }
3690 3691  
... ... @@ -3702,7 +3703,7 @@
3702 3703 char *tmp;
3703 3704  
3704 3705 filp->private_data = (void *)0;
3705   - down(&open_lock);
  3706 + mutex_lock(&open_lock);
3706 3707 old_dev = UDRS->fd_device;
3707 3708 if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev)
3708 3709 goto out2;
... ... @@ -3785,7 +3786,7 @@
3785 3786 if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE)))
3786 3787 goto out;
3787 3788 }
3788   - up(&open_lock);
  3789 + mutex_unlock(&open_lock);
3789 3790 return 0;
3790 3791 out:
3791 3792 if (UDRS->fd_ref < 0)
... ... @@ -3796,7 +3797,7 @@
3796 3797 opened_bdev[drive] = NULL;
3797 3798 floppy_release_irq_and_dma();
3798 3799 out2:
3799   - up(&open_lock);
  3800 + mutex_unlock(&open_lock);
3800 3801 return res;
3801 3802 }
3802 3803