diff options
author | Jes Sorensen <jes@sgi.com> | 2006-03-23 06:00:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:11 -0500 |
commit | b1c82b5c55851bf309f4019994610789f7042757 (patch) | |
tree | e095ddbc53298b6ddc0324df4321a537014af0f3 /drivers | |
parent | 1657f824e880a9bd239a3436b820d1a2986f763d (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/floppy.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index d23b54332d7e..fb2d0be7cdeb 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -179,6 +179,7 @@ static int print_unex = 1; | |||
179 | #include <linux/devfs_fs_kernel.h> | 179 | #include <linux/devfs_fs_kernel.h> |
180 | #include <linux/platform_device.h> | 180 | #include <linux/platform_device.h> |
181 | #include <linux/buffer_head.h> /* for invalidate_buffers() */ | 181 | #include <linux/buffer_head.h> /* for invalidate_buffers() */ |
182 | #include <linux/mutex.h> | ||
182 | 183 | ||
183 | /* | 184 | /* |
184 | * PS/2 floppies have much slower step rates than regular floppies. | 185 | * PS/2 floppies have much slower step rates than regular floppies. |
@@ -413,7 +414,7 @@ static struct floppy_write_errors write_errors[N_DRIVE]; | |||
413 | static struct timer_list motor_off_timer[N_DRIVE]; | 414 | static struct timer_list motor_off_timer[N_DRIVE]; |
414 | static struct gendisk *disks[N_DRIVE]; | 415 | static struct gendisk *disks[N_DRIVE]; |
415 | static struct block_device *opened_bdev[N_DRIVE]; | 416 | static struct block_device *opened_bdev[N_DRIVE]; |
416 | static DECLARE_MUTEX(open_lock); | 417 | static DEFINE_MUTEX(open_lock); |
417 | static struct floppy_raw_cmd *raw_cmd, default_raw_cmd; | 418 | static struct floppy_raw_cmd *raw_cmd, default_raw_cmd; |
418 | 419 | ||
419 | /* | 420 | /* |
@@ -3333,7 +3334,7 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, | |||
3333 | if (type) { | 3334 | if (type) { |
3334 | if (!capable(CAP_SYS_ADMIN)) | 3335 | if (!capable(CAP_SYS_ADMIN)) |
3335 | return -EPERM; | 3336 | return -EPERM; |
3336 | down(&open_lock); | 3337 | mutex_lock(&open_lock); |
3337 | LOCK_FDC(drive, 1); | 3338 | LOCK_FDC(drive, 1); |
3338 | floppy_type[type] = *g; | 3339 | floppy_type[type] = *g; |
3339 | floppy_type[type].name = "user format"; | 3340 | floppy_type[type].name = "user format"; |
@@ -3347,7 +3348,7 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, | |||
3347 | continue; | 3348 | continue; |
3348 | __invalidate_device(bdev); | 3349 | __invalidate_device(bdev); |
3349 | } | 3350 | } |
3350 | up(&open_lock); | 3351 | mutex_unlock(&open_lock); |
3351 | } else { | 3352 | } else { |
3352 | int oldStretch; | 3353 | int oldStretch; |
3353 | LOCK_FDC(drive, 1); | 3354 | LOCK_FDC(drive, 1); |
@@ -3674,7 +3675,7 @@ static int floppy_release(struct inode *inode, struct file *filp) | |||
3674 | { | 3675 | { |
3675 | int drive = (long)inode->i_bdev->bd_disk->private_data; | 3676 | int drive = (long)inode->i_bdev->bd_disk->private_data; |
3676 | 3677 | ||
3677 | down(&open_lock); | 3678 | mutex_lock(&open_lock); |
3678 | if (UDRS->fd_ref < 0) | 3679 | if (UDRS->fd_ref < 0) |
3679 | UDRS->fd_ref = 0; | 3680 | UDRS->fd_ref = 0; |
3680 | else if (!UDRS->fd_ref--) { | 3681 | else if (!UDRS->fd_ref--) { |
@@ -3684,7 +3685,7 @@ static int floppy_release(struct inode *inode, struct file *filp) | |||
3684 | if (!UDRS->fd_ref) | 3685 | if (!UDRS->fd_ref) |
3685 | opened_bdev[drive] = NULL; | 3686 | opened_bdev[drive] = NULL; |
3686 | floppy_release_irq_and_dma(); | 3687 | floppy_release_irq_and_dma(); |
3687 | up(&open_lock); | 3688 | mutex_unlock(&open_lock); |
3688 | return 0; | 3689 | return 0; |
3689 | } | 3690 | } |
3690 | 3691 | ||
@@ -3702,7 +3703,7 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
3702 | char *tmp; | 3703 | char *tmp; |
3703 | 3704 | ||
3704 | filp->private_data = (void *)0; | 3705 | filp->private_data = (void *)0; |
3705 | down(&open_lock); | 3706 | mutex_lock(&open_lock); |
3706 | old_dev = UDRS->fd_device; | 3707 | old_dev = UDRS->fd_device; |
3707 | if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev) | 3708 | if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev) |
3708 | goto out2; | 3709 | goto out2; |
@@ -3785,7 +3786,7 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
3785 | if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE))) | 3786 | if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE))) |
3786 | goto out; | 3787 | goto out; |
3787 | } | 3788 | } |
3788 | up(&open_lock); | 3789 | mutex_unlock(&open_lock); |
3789 | return 0; | 3790 | return 0; |
3790 | out: | 3791 | out: |
3791 | if (UDRS->fd_ref < 0) | 3792 | if (UDRS->fd_ref < 0) |
@@ -3796,7 +3797,7 @@ out: | |||
3796 | opened_bdev[drive] = NULL; | 3797 | opened_bdev[drive] = NULL; |
3797 | floppy_release_irq_and_dma(); | 3798 | floppy_release_irq_and_dma(); |
3798 | out2: | 3799 | out2: |
3799 | up(&open_lock); | 3800 | mutex_unlock(&open_lock); |
3800 | return res; | 3801 | return res; |
3801 | } | 3802 | } |
3802 | 3803 | ||