aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/paride/pcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/paride/pcd.c')
-rw-r--r--drivers/block/paride/pcd.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 71acf4e53356..76f8565e1e8d 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -138,6 +138,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
138#include <linux/cdrom.h> 138#include <linux/cdrom.h>
139#include <linux/spinlock.h> 139#include <linux/spinlock.h>
140#include <linux/blkdev.h> 140#include <linux/blkdev.h>
141#include <linux/smp_lock.h>
141#include <asm/uaccess.h> 142#include <asm/uaccess.h>
142 143
143static DEFINE_SPINLOCK(pcd_lock); 144static DEFINE_SPINLOCK(pcd_lock);
@@ -224,13 +225,21 @@ static char *pcd_buf; /* buffer for request in progress */
224static int pcd_block_open(struct block_device *bdev, fmode_t mode) 225static int pcd_block_open(struct block_device *bdev, fmode_t mode)
225{ 226{
226 struct pcd_unit *cd = bdev->bd_disk->private_data; 227 struct pcd_unit *cd = bdev->bd_disk->private_data;
227 return cdrom_open(&cd->info, bdev, mode); 228 int ret;
229
230 lock_kernel();
231 ret = cdrom_open(&cd->info, bdev, mode);
232 unlock_kernel();
233
234 return ret;
228} 235}
229 236
230static int pcd_block_release(struct gendisk *disk, fmode_t mode) 237static int pcd_block_release(struct gendisk *disk, fmode_t mode)
231{ 238{
232 struct pcd_unit *cd = disk->private_data; 239 struct pcd_unit *cd = disk->private_data;
240 lock_kernel();
233 cdrom_release(&cd->info, mode); 241 cdrom_release(&cd->info, mode);
242 unlock_kernel();
234 return 0; 243 return 0;
235} 244}
236 245
@@ -238,7 +247,13 @@ static int pcd_block_ioctl(struct block_device *bdev, fmode_t mode,
238 unsigned cmd, unsigned long arg) 247 unsigned cmd, unsigned long arg)
239{ 248{
240 struct pcd_unit *cd = bdev->bd_disk->private_data; 249 struct pcd_unit *cd = bdev->bd_disk->private_data;
241 return cdrom_ioctl(&cd->info, bdev, mode, cmd, arg); 250 int ret;
251
252 lock_kernel();
253 ret = cdrom_ioctl(&cd->info, bdev, mode, cmd, arg);
254 unlock_kernel();
255
256 return ret;
242} 257}
243 258
244static int pcd_block_media_changed(struct gendisk *disk) 259static int pcd_block_media_changed(struct gendisk *disk)
@@ -251,7 +266,7 @@ static const struct block_device_operations pcd_bdops = {
251 .owner = THIS_MODULE, 266 .owner = THIS_MODULE,
252 .open = pcd_block_open, 267 .open = pcd_block_open,
253 .release = pcd_block_release, 268 .release = pcd_block_release,
254 .locked_ioctl = pcd_block_ioctl, 269 .ioctl = pcd_block_ioctl,
255 .media_changed = pcd_block_media_changed, 270 .media_changed = pcd_block_media_changed,
256}; 271};
257 272