aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-06-02 08:28:52 -0400
committerArnd Bergmann <arnd@arndb.de>2010-10-05 09:01:10 -0400
commit2a48fc0ab24241755dc93bfd4f01d68efab47f5a (patch)
treefa9ae10ce89b26b7d8ae9ce24bdfda5e3007b763 /drivers/block/floppy.c
parent613655fa39ff6957754fa8ceb8559980920eb8ee (diff)
block: autoconvert trivial BKL users to private mutex
The block device drivers have all gained new lock_kernel calls from a recent pushdown, and some of the drivers were already using the BKL before. This turns the BKL into a set of per-driver mutexes. Still need to check whether this is safe to do. file=$1 name=$2 if grep -q lock_kernel ${file} ; then if grep -q 'include.*linux.mutex.h' ${file} ; then sed -i '/include.*<linux\/smp_lock.h>/d' ${file} else sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file} fi sed -i ${file} \ -e "/^#include.*linux.mutex.h/,$ { 1,/^\(static\|int\|long\)/ { /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex); } }" \ -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \ -e '/[ ]*cycle_kernel_lock();/d' else sed -i -e '/include.*\<smp_lock.h\>/d' ${file} \ -e '/cycle_kernel_lock()/d' fi Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r--drivers/block/floppy.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index cf04c1b234ed..3b57459bb745 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -178,7 +178,6 @@ static int print_unex = 1;
178#include <linux/slab.h> 178#include <linux/slab.h>
179#include <linux/mm.h> 179#include <linux/mm.h>
180#include <linux/bio.h> 180#include <linux/bio.h>
181#include <linux/smp_lock.h>
182#include <linux/string.h> 181#include <linux/string.h>
183#include <linux/jiffies.h> 182#include <linux/jiffies.h>
184#include <linux/fcntl.h> 183#include <linux/fcntl.h>
@@ -199,6 +198,7 @@ static int print_unex = 1;
199 * It's been recommended that take about 1/4 of the default speed 198 * It's been recommended that take about 1/4 of the default speed
200 * in some more extreme cases. 199 * in some more extreme cases.
201 */ 200 */
201static DEFINE_MUTEX(floppy_mutex);
202static int slow_floppy; 202static int slow_floppy;
203 203
204#include <asm/dma.h> 204#include <asm/dma.h>
@@ -3553,9 +3553,9 @@ static int fd_ioctl(struct block_device *bdev, fmode_t mode,
3553{ 3553{
3554 int ret; 3554 int ret;
3555 3555
3556 lock_kernel(); 3556 mutex_lock(&floppy_mutex);
3557 ret = fd_locked_ioctl(bdev, mode, cmd, param); 3557 ret = fd_locked_ioctl(bdev, mode, cmd, param);
3558 unlock_kernel(); 3558 mutex_unlock(&floppy_mutex);
3559 3559
3560 return ret; 3560 return ret;
3561} 3561}
@@ -3616,7 +3616,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
3616{ 3616{
3617 int drive = (long)disk->private_data; 3617 int drive = (long)disk->private_data;
3618 3618
3619 lock_kernel(); 3619 mutex_lock(&floppy_mutex);
3620 mutex_lock(&open_lock); 3620 mutex_lock(&open_lock);
3621 if (UDRS->fd_ref < 0) 3621 if (UDRS->fd_ref < 0)
3622 UDRS->fd_ref = 0; 3622 UDRS->fd_ref = 0;
@@ -3627,7 +3627,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
3627 if (!UDRS->fd_ref) 3627 if (!UDRS->fd_ref)
3628 opened_bdev[drive] = NULL; 3628 opened_bdev[drive] = NULL;
3629 mutex_unlock(&open_lock); 3629 mutex_unlock(&open_lock);
3630 unlock_kernel(); 3630 mutex_unlock(&floppy_mutex);
3631 3631
3632 return 0; 3632 return 0;
3633} 3633}
@@ -3645,7 +3645,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
3645 int res = -EBUSY; 3645 int res = -EBUSY;
3646 char *tmp; 3646 char *tmp;
3647 3647
3648 lock_kernel(); 3648 mutex_lock(&floppy_mutex);
3649 mutex_lock(&open_lock); 3649 mutex_lock(&open_lock);
3650 old_dev = UDRS->fd_device; 3650 old_dev = UDRS->fd_device;
3651 if (opened_bdev[drive] && opened_bdev[drive] != bdev) 3651 if (opened_bdev[drive] && opened_bdev[drive] != bdev)
@@ -3722,7 +3722,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
3722 goto out; 3722 goto out;
3723 } 3723 }
3724 mutex_unlock(&open_lock); 3724 mutex_unlock(&open_lock);
3725 unlock_kernel(); 3725 mutex_unlock(&floppy_mutex);
3726 return 0; 3726 return 0;
3727out: 3727out:
3728 if (UDRS->fd_ref < 0) 3728 if (UDRS->fd_ref < 0)
@@ -3733,7 +3733,7 @@ out:
3733 opened_bdev[drive] = NULL; 3733 opened_bdev[drive] = NULL;
3734out2: 3734out2:
3735 mutex_unlock(&open_lock); 3735 mutex_unlock(&open_lock);
3736 unlock_kernel(); 3736 mutex_unlock(&floppy_mutex);
3737 return res; 3737 return res;
3738} 3738}
3739 3739