diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/ide/ide-tape.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 58fc920d5c32..b07232880ec9 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -221,6 +221,8 @@ typedef struct ide_tape_obj { | |||
221 | 221 | ||
222 | static DEFINE_MUTEX(idetape_ref_mutex); | 222 | static DEFINE_MUTEX(idetape_ref_mutex); |
223 | 223 | ||
224 | static DEFINE_MUTEX(idetape_chrdev_mutex); | ||
225 | |||
224 | static struct class *idetape_sysfs_class; | 226 | static struct class *idetape_sysfs_class; |
225 | 227 | ||
226 | static void ide_tape_release(struct device *); | 228 | static void ide_tape_release(struct device *); |
@@ -1363,7 +1365,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) | |||
1363 | * supported here, and not in the corresponding block interface. Our own | 1365 | * supported here, and not in the corresponding block interface. Our own |
1364 | * ide-tape ioctls are supported on both interfaces. | 1366 | * ide-tape ioctls are supported on both interfaces. |
1365 | */ | 1367 | */ |
1366 | static int idetape_chrdev_ioctl(struct inode *inode, struct file *file, | 1368 | static long do_idetape_chrdev_ioctl(struct file *file, |
1367 | unsigned int cmd, unsigned long arg) | 1369 | unsigned int cmd, unsigned long arg) |
1368 | { | 1370 | { |
1369 | struct ide_tape_obj *tape = file->private_data; | 1371 | struct ide_tape_obj *tape = file->private_data; |
@@ -1418,6 +1420,16 @@ static int idetape_chrdev_ioctl(struct inode *inode, struct file *file, | |||
1418 | } | 1420 | } |
1419 | } | 1421 | } |
1420 | 1422 | ||
1423 | static long idetape_chrdev_ioctl(struct file *file, | ||
1424 | unsigned int cmd, unsigned long arg) | ||
1425 | { | ||
1426 | long ret; | ||
1427 | lock_kernel(); | ||
1428 | ret = do_idetape_chrdev_ioctl(file, cmd, arg); | ||
1429 | unlock_kernel(); | ||
1430 | return ret; | ||
1431 | } | ||
1432 | |||
1421 | /* | 1433 | /* |
1422 | * Do a mode sense page 0 with block descriptor and if it succeeds set the tape | 1434 | * Do a mode sense page 0 with block descriptor and if it succeeds set the tape |
1423 | * block size with the reported value. | 1435 | * block size with the reported value. |
@@ -1457,10 +1469,11 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp) | |||
1457 | if (i >= MAX_HWIFS * MAX_DRIVES) | 1469 | if (i >= MAX_HWIFS * MAX_DRIVES) |
1458 | return -ENXIO; | 1470 | return -ENXIO; |
1459 | 1471 | ||
1460 | lock_kernel(); | 1472 | mutex_lock(&idetape_chrdev_mutex); |
1473 | |||
1461 | tape = ide_tape_get(NULL, true, i); | 1474 | tape = ide_tape_get(NULL, true, i); |
1462 | if (!tape) { | 1475 | if (!tape) { |
1463 | unlock_kernel(); | 1476 | mutex_unlock(&idetape_chrdev_mutex); |
1464 | return -ENXIO; | 1477 | return -ENXIO; |
1465 | } | 1478 | } |
1466 | 1479 | ||
@@ -1519,12 +1532,15 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp) | |||
1519 | tape->door_locked = DOOR_LOCKED; | 1532 | tape->door_locked = DOOR_LOCKED; |
1520 | } | 1533 | } |
1521 | } | 1534 | } |
1522 | unlock_kernel(); | 1535 | mutex_unlock(&idetape_chrdev_mutex); |
1536 | |||
1523 | return 0; | 1537 | return 0; |
1524 | 1538 | ||
1525 | out_put_tape: | 1539 | out_put_tape: |
1526 | ide_tape_put(tape); | 1540 | ide_tape_put(tape); |
1527 | unlock_kernel(); | 1541 | |
1542 | mutex_unlock(&idetape_chrdev_mutex); | ||
1543 | |||
1528 | return retval; | 1544 | return retval; |
1529 | } | 1545 | } |
1530 | 1546 | ||
@@ -1551,7 +1567,8 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp) | |||
1551 | ide_drive_t *drive = tape->drive; | 1567 | ide_drive_t *drive = tape->drive; |
1552 | unsigned int minor = iminor(inode); | 1568 | unsigned int minor = iminor(inode); |
1553 | 1569 | ||
1554 | lock_kernel(); | 1570 | mutex_lock(&idetape_chrdev_mutex); |
1571 | |||
1555 | tape = drive->driver_data; | 1572 | tape = drive->driver_data; |
1556 | 1573 | ||
1557 | ide_debug_log(IDE_DBG_FUNC, "enter"); | 1574 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
@@ -1575,7 +1592,9 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp) | |||
1575 | } | 1592 | } |
1576 | clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); | 1593 | clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); |
1577 | ide_tape_put(tape); | 1594 | ide_tape_put(tape); |
1578 | unlock_kernel(); | 1595 | |
1596 | mutex_unlock(&idetape_chrdev_mutex); | ||
1597 | |||
1579 | return 0; | 1598 | return 0; |
1580 | } | 1599 | } |
1581 | 1600 | ||
@@ -1879,7 +1898,7 @@ static const struct file_operations idetape_fops = { | |||
1879 | .owner = THIS_MODULE, | 1898 | .owner = THIS_MODULE, |
1880 | .read = idetape_chrdev_read, | 1899 | .read = idetape_chrdev_read, |
1881 | .write = idetape_chrdev_write, | 1900 | .write = idetape_chrdev_write, |
1882 | .ioctl = idetape_chrdev_ioctl, | 1901 | .unlocked_ioctl = idetape_chrdev_ioctl, |
1883 | .open = idetape_chrdev_open, | 1902 | .open = idetape_chrdev_open, |
1884 | .release = idetape_chrdev_release, | 1903 | .release = idetape_chrdev_release, |
1885 | }; | 1904 | }; |