aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:45:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:45:38 -0500
commite49aedb594dc9cd4add2f0fd7360952c11017532 (patch)
treed29262a962727020206abd9b4cba70c47041476a /drivers/ide/ide-tape.c
parent4ef58d4e2ad1fa2a3e5bbf41af2284671fca8cf8 (diff)
parent4e5b932c829e9a6bf32ec80c6e1ce60121eef124 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6: sl82c105: remove no longer needed debugging code sis5513: remove stale TODO pdc202xx_old: remove no longer needed debugging code cy82c693: remove no longer needed debugging code cmd64x: remove no longer needed debugging code alim15x3: remove obsolete and dangerous wdc_udma parameter ide: Increase WAIT_DRQ to accomodate some CF cards and SSD drives. cs5535: add pci id for AMD based CS5535 controllers slc90e66: fix UDMA handling drivers/ide/tx4938ide.c: use resource_size() drivers/ide/ide_platform.c: use resource_size() drivers/ide/au1xxx-ide.c: use resource_size() hpt366: remove dead old timing tables ide: update Kconfig text to mark as deprecated ide-tape: remove the BKL hpt366: kill unused #define's
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 58fc920d5c32..6a0e62542167 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -221,6 +221,8 @@ typedef struct ide_tape_obj {
221 221
222static DEFINE_MUTEX(idetape_ref_mutex); 222static DEFINE_MUTEX(idetape_ref_mutex);
223 223
224static DEFINE_MUTEX(idetape_chrdev_mutex);
225
224static struct class *idetape_sysfs_class; 226static struct class *idetape_sysfs_class;
225 227
226static void ide_tape_release(struct device *); 228static void ide_tape_release(struct device *);
@@ -1457,10 +1459,11 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
1457 if (i >= MAX_HWIFS * MAX_DRIVES) 1459 if (i >= MAX_HWIFS * MAX_DRIVES)
1458 return -ENXIO; 1460 return -ENXIO;
1459 1461
1460 lock_kernel(); 1462 mutex_lock(&idetape_chrdev_mutex);
1463
1461 tape = ide_tape_get(NULL, true, i); 1464 tape = ide_tape_get(NULL, true, i);
1462 if (!tape) { 1465 if (!tape) {
1463 unlock_kernel(); 1466 mutex_unlock(&idetape_chrdev_mutex);
1464 return -ENXIO; 1467 return -ENXIO;
1465 } 1468 }
1466 1469
@@ -1519,12 +1522,15 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
1519 tape->door_locked = DOOR_LOCKED; 1522 tape->door_locked = DOOR_LOCKED;
1520 } 1523 }
1521 } 1524 }
1522 unlock_kernel(); 1525 mutex_unlock(&idetape_chrdev_mutex);
1526
1523 return 0; 1527 return 0;
1524 1528
1525out_put_tape: 1529out_put_tape:
1526 ide_tape_put(tape); 1530 ide_tape_put(tape);
1527 unlock_kernel(); 1531
1532 mutex_unlock(&idetape_chrdev_mutex);
1533
1528 return retval; 1534 return retval;
1529} 1535}
1530 1536
@@ -1551,7 +1557,8 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
1551 ide_drive_t *drive = tape->drive; 1557 ide_drive_t *drive = tape->drive;
1552 unsigned int minor = iminor(inode); 1558 unsigned int minor = iminor(inode);
1553 1559
1554 lock_kernel(); 1560 mutex_lock(&idetape_chrdev_mutex);
1561
1555 tape = drive->driver_data; 1562 tape = drive->driver_data;
1556 1563
1557 ide_debug_log(IDE_DBG_FUNC, "enter"); 1564 ide_debug_log(IDE_DBG_FUNC, "enter");
@@ -1575,7 +1582,9 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
1575 } 1582 }
1576 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1583 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags);
1577 ide_tape_put(tape); 1584 ide_tape_put(tape);
1578 unlock_kernel(); 1585
1586 mutex_unlock(&idetape_chrdev_mutex);
1587
1579 return 0; 1588 return 0;
1580} 1589}
1581 1590