From: Jes Sorensen Convert from semaphore to mutex. Untested as I have no access to a floppy drive at the moment. Signed-off-by: Jes Sorensen Signed-off-by: Ingo Molnar Cc: Jens Axboe Signed-off-by: Andrew Morton --- drivers/block/floppy.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff -puN drivers/block/floppy.c~sem2mutex-drivers-block-floppyc drivers/block/floppy.c --- 25/drivers/block/floppy.c~sem2mutex-drivers-block-floppyc Fri Jan 13 16:10:00 2006 +++ 25-akpm/drivers/block/floppy.c Fri Jan 13 16:10:00 2006 @@ -179,6 +179,7 @@ static int print_unex = 1; #include #include #include /* for invalidate_buffers() */ +#include /* * PS/2 floppies have much slower step rates than regular floppies. @@ -414,7 +415,7 @@ static struct floppy_write_errors write_ static struct timer_list motor_off_timer[N_DRIVE]; static struct gendisk *disks[N_DRIVE]; static struct block_device *opened_bdev[N_DRIVE]; -static DECLARE_MUTEX(open_lock); +static DEFINE_MUTEX(open_lock); static struct floppy_raw_cmd *raw_cmd, default_raw_cmd; /* @@ -3334,7 +3335,7 @@ static inline int set_geometry(unsigned if (type) { if (!capable(CAP_SYS_ADMIN)) return -EPERM; - down(&open_lock); + mutex_lock(&open_lock); LOCK_FDC(drive, 1); floppy_type[type] = *g; floppy_type[type].name = "user format"; @@ -3348,7 +3349,7 @@ static inline int set_geometry(unsigned continue; __invalidate_device(bdev); } - up(&open_lock); + mutex_unlock(&open_lock); } else { int oldStretch; LOCK_FDC(drive, 1); @@ -3675,7 +3676,7 @@ static int floppy_release(struct inode * { int drive = (long)inode->i_bdev->bd_disk->private_data; - down(&open_lock); + mutex_lock(&open_lock); if (UDRS->fd_ref < 0) UDRS->fd_ref = 0; else if (!UDRS->fd_ref--) { @@ -3685,7 +3686,7 @@ static int floppy_release(struct inode * if (!UDRS->fd_ref) opened_bdev[drive] = NULL; floppy_release_irq_and_dma(); - up(&open_lock); + mutex_unlock(&open_lock); return 0; } @@ -3703,7 +3704,7 @@ static int floppy_open(struct inode *ino char *tmp; filp->private_data = (void *)0; - down(&open_lock); + mutex_lock(&open_lock); old_dev = UDRS->fd_device; if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev) goto out2; @@ -3786,7 +3787,7 @@ static int floppy_open(struct inode *ino if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE))) goto out; } - up(&open_lock); + mutex_unlock(&open_lock); return 0; out: if (UDRS->fd_ref < 0) @@ -3797,7 +3798,7 @@ out: opened_bdev[drive] = NULL; floppy_release_irq_and_dma(); out2: - up(&open_lock); + mutex_unlock(&open_lock); return res; } _