diff options
Diffstat (limited to 'drivers/block/z2ram.c')
-rw-r--r-- | drivers/block/z2ram.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index d75b2bb601ad..dcd4cfcf4126 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/blkdev.h> | 34 | #include <linux/blkdev.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/smp_lock.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | 38 | ||
39 | #include <asm/setup.h> | 39 | #include <asm/setup.h> |
@@ -57,6 +57,7 @@ extern struct mem_info m68k_memory[NUM_MEMINFO]; | |||
57 | 57 | ||
58 | #define Z2RAM_CHUNK1024 ( Z2RAM_CHUNKSIZE >> 10 ) | 58 | #define Z2RAM_CHUNK1024 ( Z2RAM_CHUNKSIZE >> 10 ) |
59 | 59 | ||
60 | static DEFINE_MUTEX(z2ram_mutex); | ||
60 | static u_long *z2ram_map = NULL; | 61 | static u_long *z2ram_map = NULL; |
61 | static u_long z2ram_size = 0; | 62 | static u_long z2ram_size = 0; |
62 | static int z2_count = 0; | 63 | static int z2_count = 0; |
@@ -154,7 +155,7 @@ static int z2_open(struct block_device *bdev, fmode_t mode) | |||
154 | 155 | ||
155 | device = MINOR(bdev->bd_dev); | 156 | device = MINOR(bdev->bd_dev); |
156 | 157 | ||
157 | lock_kernel(); | 158 | mutex_lock(&z2ram_mutex); |
158 | if ( current_device != -1 && current_device != device ) | 159 | if ( current_device != -1 && current_device != device ) |
159 | { | 160 | { |
160 | rc = -EBUSY; | 161 | rc = -EBUSY; |
@@ -296,25 +297,25 @@ static int z2_open(struct block_device *bdev, fmode_t mode) | |||
296 | set_capacity(z2ram_gendisk, z2ram_size >> 9); | 297 | set_capacity(z2ram_gendisk, z2ram_size >> 9); |
297 | } | 298 | } |
298 | 299 | ||
299 | unlock_kernel(); | 300 | mutex_unlock(&z2ram_mutex); |
300 | return 0; | 301 | return 0; |
301 | 302 | ||
302 | err_out_kfree: | 303 | err_out_kfree: |
303 | kfree(z2ram_map); | 304 | kfree(z2ram_map); |
304 | err_out: | 305 | err_out: |
305 | unlock_kernel(); | 306 | mutex_unlock(&z2ram_mutex); |
306 | return rc; | 307 | return rc; |
307 | } | 308 | } |
308 | 309 | ||
309 | static int | 310 | static int |
310 | z2_release(struct gendisk *disk, fmode_t mode) | 311 | z2_release(struct gendisk *disk, fmode_t mode) |
311 | { | 312 | { |
312 | lock_kernel(); | 313 | mutex_lock(&z2ram_mutex); |
313 | if ( current_device == -1 ) { | 314 | if ( current_device == -1 ) { |
314 | unlock_kernel(); | 315 | mutex_unlock(&z2ram_mutex); |
315 | return 0; | 316 | return 0; |
316 | } | 317 | } |
317 | unlock_kernel(); | 318 | mutex_unlock(&z2ram_mutex); |
318 | /* | 319 | /* |
319 | * FIXME: unmap memory | 320 | * FIXME: unmap memory |
320 | */ | 321 | */ |