aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/mmc_block.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-01-12 13:43:35 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-12 13:43:35 -0500
commita621aaed690b9439141c555941b6af53873f6ff1 (patch)
tree47d08433a946e34299556a9e23482582ffb911c0 /drivers/mmc/mmc_block.c
parent593195f9b2309693f27b402f34573f7920b82c3e (diff)
[MMC+MFD] Convert mmc to mutexes
convert mfd and mmc to mutexes Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/mmc_block.c')
-rw-r--r--drivers/mmc/mmc_block.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index f2c42b13945d..9b7c37e0e574 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -28,6 +28,7 @@
28#include <linux/kdev_t.h> 28#include <linux/kdev_t.h>
29#include <linux/blkdev.h> 29#include <linux/blkdev.h>
30#include <linux/devfs_fs_kernel.h> 30#include <linux/devfs_fs_kernel.h>
31#include <linux/mutex.h>
31 32
32#include <linux/mmc/card.h> 33#include <linux/mmc/card.h>
33#include <linux/mmc/protocol.h> 34#include <linux/mmc/protocol.h>
@@ -57,33 +58,33 @@ struct mmc_blk_data {
57 unsigned int read_only; 58 unsigned int read_only;
58}; 59};
59 60
60static DECLARE_MUTEX(open_lock); 61static DEFINE_MUTEX(open_lock);
61 62
62static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) 63static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
63{ 64{
64 struct mmc_blk_data *md; 65 struct mmc_blk_data *md;
65 66
66 down(&open_lock); 67 mutex_lock(&open_lock);
67 md = disk->private_data; 68 md = disk->private_data;
68 if (md && md->usage == 0) 69 if (md && md->usage == 0)
69 md = NULL; 70 md = NULL;
70 if (md) 71 if (md)
71 md->usage++; 72 md->usage++;
72 up(&open_lock); 73 mutex_unlock(&open_lock);
73 74
74 return md; 75 return md;
75} 76}
76 77
77static void mmc_blk_put(struct mmc_blk_data *md) 78static void mmc_blk_put(struct mmc_blk_data *md)
78{ 79{
79 down(&open_lock); 80 mutex_lock(&open_lock);
80 md->usage--; 81 md->usage--;
81 if (md->usage == 0) { 82 if (md->usage == 0) {
82 put_disk(md->disk); 83 put_disk(md->disk);
83 mmc_cleanup_queue(&md->queue); 84 mmc_cleanup_queue(&md->queue);
84 kfree(md); 85 kfree(md);
85 } 86 }
86 up(&open_lock); 87 mutex_unlock(&open_lock);
87} 88}
88 89
89static int mmc_blk_open(struct inode *inode, struct file *filp) 90static int mmc_blk_open(struct inode *inode, struct file *filp)