Skip to content

Commit

Permalink
mtd: Remove redundant mutex from mtd_blkdevs.c
Browse files Browse the repository at this point in the history
In commit 2a48fc0 ('block: autoconvert
trivial BKL users to private mutex'), Arnd replaced the BKL usage with a
mutex. However, Maxim has already provided a better fix in commit
480792b ('mtd: blktrans: kill BKL'),
which was simply to remove the BKL without replacing it — since he'd
already made it do all necessary locking for itself.

Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 30, 2010
1 parent 6757792 commit 8cc9de3
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

#include "mtdcore.h"

static DEFINE_MUTEX(mtd_blkdevs_mutex);
static LIST_HEAD(blktrans_majors);
static DEFINE_MUTEX(blktrans_ref_mutex);

Expand Down Expand Up @@ -185,7 +184,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
if (!dev)
return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/

mutex_lock(&mtd_blkdevs_mutex);
mutex_lock(&dev->lock);

if (dev->open++)
Expand All @@ -202,7 +200,6 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
unlock:
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
mutex_unlock(&mtd_blkdevs_mutex);
return ret;
}

Expand All @@ -214,7 +211,6 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
if (!dev)
return ret;

mutex_lock(&mtd_blkdevs_mutex);
mutex_lock(&dev->lock);

if (--dev->open)
Expand All @@ -230,7 +226,6 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode)
unlock:
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
mutex_unlock(&mtd_blkdevs_mutex);
return ret;
}

Expand Down Expand Up @@ -263,7 +258,6 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
if (!dev)
return ret;

mutex_lock(&mtd_blkdevs_mutex);
mutex_lock(&dev->lock);

if (!dev->mtd)
Expand All @@ -278,7 +272,6 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
}
unlock:
mutex_unlock(&dev->lock);
mutex_unlock(&mtd_blkdevs_mutex);
blktrans_dev_put(dev);
return ret;
}
Expand Down

0 comments on commit 8cc9de3

Please sign in to comment.