aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2008-07-23 13:56:01 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:56:01 -0400
commitf2e3ab52afb3b05879b9d82a05740cd924993325 (patch)
treeeac0e5955fd1af60e7bc756319b55f43ef79f21a /drivers/ide
parentea68d270ff55bcdfa5d07697eb68103b5b02c7bb (diff)
ide-tape: convert to using the new atapi_flags
There should be no functionality change resulting from this patch. [bart: IDE_FLAG_* -> IDE_AFLAG_*, dev_flags -> atapi_flags] Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-tape.c68
1 files changed, 23 insertions, 45 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index a6d4e484aaeb..6962ca4891a1 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -195,23 +195,6 @@ enum {
195#define IDETAPE_BLOCK_DESCRIPTOR 0 195#define IDETAPE_BLOCK_DESCRIPTOR 0
196#define IDETAPE_CAPABILITIES_PAGE 0x2a 196#define IDETAPE_CAPABILITIES_PAGE 0x2a
197 197
198/* Tape flag bits values. */
199enum {
200 IDETAPE_FLAG_IGNORE_DSC = (1 << 0),
201 /* 0 When the tape position is unknown */
202 IDETAPE_FLAG_ADDRESS_VALID = (1 << 1),
203 /* Device already opened */
204 IDETAPE_FLAG_BUSY = (1 << 2),
205 /* Attempt to auto-detect the current user block size */
206 IDETAPE_FLAG_DETECT_BS = (1 << 3),
207 /* Currently on a filemark */
208 IDETAPE_FLAG_FILEMARK = (1 << 4),
209 /* DRQ interrupt device */
210 IDETAPE_FLAG_DRQ_INTERRUPT = (1 << 5),
211 /* 0 = no tape is loaded, so we don't rewind after ejecting */
212 IDETAPE_FLAG_MEDIUM_PRESENT = (1 << 6),
213};
214
215/* 198/*
216 * Most of our global data which we need to save even as we leave the driver due 199 * Most of our global data which we need to save even as we leave the driver due
217 * to an interrupt or a timer event is stored in the struct defined below. 200 * to an interrupt or a timer event is stored in the struct defined below.
@@ -312,8 +295,6 @@ typedef struct ide_tape_obj {
312 /* Wasted space in each stage */ 295 /* Wasted space in each stage */
313 int excess_bh_size; 296 int excess_bh_size;
314 297
315 /* Status/Action flags: long for set_bit */
316 unsigned long flags;
317 /* protects the ide-tape queue */ 298 /* protects the ide-tape queue */
318 spinlock_t lock; 299 spinlock_t lock;
319 300
@@ -664,7 +645,7 @@ static void ide_tape_callback(ide_drive_t *drive)
664 if (readpos[0] & 0x4) { 645 if (readpos[0] & 0x4) {
665 printk(KERN_INFO "ide-tape: Block location is unknown" 646 printk(KERN_INFO "ide-tape: Block location is unknown"
666 "to the tape\n"); 647 "to the tape\n");
667 clear_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags); 648 clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags);
668 uptodate = 0; 649 uptodate = 0;
669 } else { 650 } else {
670 debug_log(DBG_SENSE, "Block Location - %u\n", 651 debug_log(DBG_SENSE, "Block Location - %u\n",
@@ -672,7 +653,7 @@ static void ide_tape_callback(ide_drive_t *drive)
672 653
673 tape->partition = readpos[1]; 654 tape->partition = readpos[1];
674 tape->first_frame = be32_to_cpu(*(u32 *)&readpos[4]); 655 tape->first_frame = be32_to_cpu(*(u32 *)&readpos[4]);
675 set_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags); 656 set_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags);
676 } 657 }
677 } 658 }
678 659
@@ -741,7 +722,6 @@ static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
741 */ 722 */
742static void idetape_retry_pc(ide_drive_t *drive) 723static void idetape_retry_pc(ide_drive_t *drive)
743{ 724{
744 idetape_tape_t *tape = drive->driver_data;
745 struct ide_atapi_pc *pc; 725 struct ide_atapi_pc *pc;
746 struct request *rq; 726 struct request *rq;
747 727
@@ -749,7 +729,7 @@ static void idetape_retry_pc(ide_drive_t *drive)
749 pc = idetape_next_pc_storage(drive); 729 pc = idetape_next_pc_storage(drive);
750 rq = idetape_next_rq_storage(drive); 730 rq = idetape_next_rq_storage(drive);
751 idetape_create_request_sense_cmd(pc); 731 idetape_create_request_sense_cmd(pc);
752 set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags); 732 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
753 idetape_queue_pc_head(drive, pc, rq); 733 idetape_queue_pc_head(drive, pc, rq);
754} 734}
755 735
@@ -1026,14 +1006,14 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
1026 stat = hwif->tp_ops->read_status(hwif); 1006 stat = hwif->tp_ops->read_status(hwif);
1027 1007
1028 if (!drive->dsc_overlap && !(rq->cmd[13] & REQ_IDETAPE_PC2)) 1008 if (!drive->dsc_overlap && !(rq->cmd[13] & REQ_IDETAPE_PC2))
1029 set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags); 1009 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
1030 1010
1031 if (drive->post_reset == 1) { 1011 if (drive->post_reset == 1) {
1032 set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags); 1012 set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
1033 drive->post_reset = 0; 1013 drive->post_reset = 0;
1034 } 1014 }
1035 1015
1036 if (!test_and_clear_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags) && 1016 if (!test_and_clear_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags) &&
1037 (stat & SEEK_STAT) == 0) { 1017 (stat & SEEK_STAT) == 0) {
1038 if (postponed_rq == NULL) { 1018 if (postponed_rq == NULL) {
1039 tape->dsc_polling_start = jiffies; 1019 tape->dsc_polling_start = jiffies;
@@ -1076,10 +1056,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
1076 return ide_stopped; 1056 return ide_stopped;
1077 } 1057 }
1078 BUG(); 1058 BUG();
1079out:
1080 if (test_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags))
1081 pc->flags |= PC_FLAG_DRQ_INTERRUPT;
1082 1059
1060out:
1083 return idetape_issue_pc(drive, pc); 1061 return idetape_issue_pc(drive, pc);
1084} 1062}
1085 1063
@@ -1307,7 +1285,7 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout)
1307 int load_attempted = 0; 1285 int load_attempted = 0;
1308 1286
1309 /* Wait for the tape to become ready */ 1287 /* Wait for the tape to become ready */
1310 set_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags); 1288 set_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags);
1311 timeout += jiffies; 1289 timeout += jiffies;
1312 while (time_before(jiffies, timeout)) { 1290 while (time_before(jiffies, timeout)) {
1313 idetape_create_test_unit_ready_cmd(&pc); 1291 idetape_create_test_unit_ready_cmd(&pc);
@@ -1400,7 +1378,7 @@ static void __ide_tape_discard_merge_buffer(ide_drive_t *drive)
1400 if (tape->chrdev_dir != IDETAPE_DIR_READ) 1378 if (tape->chrdev_dir != IDETAPE_DIR_READ)
1401 return; 1379 return;
1402 1380
1403 clear_bit(IDETAPE_FLAG_FILEMARK, &tape->flags); 1381 clear_bit(IDE_AFLAG_FILEMARK, &drive->atapi_flags);
1404 tape->merge_bh_size = 0; 1382 tape->merge_bh_size = 0;
1405 if (tape->merge_bh != NULL) { 1383 if (tape->merge_bh != NULL) {
1406 ide_tape_kfree_buffer(tape); 1384 ide_tape_kfree_buffer(tape);
@@ -1639,7 +1617,7 @@ static int idetape_add_chrdev_read_request(ide_drive_t *drive, int blocks)
1639 debug_log(DBG_PROCS, "Enter %s, %d blocks\n", __func__, blocks); 1617 debug_log(DBG_PROCS, "Enter %s, %d blocks\n", __func__, blocks);
1640 1618
1641 /* If we are at a filemark, return a read length of 0 */ 1619 /* If we are at a filemark, return a read length of 0 */
1642 if (test_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) 1620 if (test_bit(IDE_AFLAG_FILEMARK, &drive->atapi_flags))
1643 return 0; 1621 return 0;
1644 1622
1645 idetape_init_read(drive); 1623 idetape_init_read(drive);
@@ -1749,7 +1727,7 @@ static int idetape_space_over_filemarks(ide_drive_t *drive, short mt_op,
1749 1727
1750 if (tape->chrdev_dir == IDETAPE_DIR_READ) { 1728 if (tape->chrdev_dir == IDETAPE_DIR_READ) {
1751 tape->merge_bh_size = 0; 1729 tape->merge_bh_size = 0;
1752 if (test_and_clear_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) 1730 if (test_and_clear_bit(IDE_AFLAG_FILEMARK, &drive->atapi_flags))
1753 ++count; 1731 ++count;
1754 ide_tape_discard_merge_buffer(drive, 0); 1732 ide_tape_discard_merge_buffer(drive, 0);
1755 } 1733 }
@@ -1804,7 +1782,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
1804 debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count); 1782 debug_log(DBG_CHRDEV, "Enter %s, count %Zd\n", __func__, count);
1805 1783
1806 if (tape->chrdev_dir != IDETAPE_DIR_READ) { 1784 if (tape->chrdev_dir != IDETAPE_DIR_READ) {
1807 if (test_bit(IDETAPE_FLAG_DETECT_BS, &tape->flags)) 1785 if (test_bit(IDE_AFLAG_DETECT_BS, &drive->atapi_flags))
1808 if (count > tape->blk_size && 1786 if (count > tape->blk_size &&
1809 (count % tape->blk_size) == 0) 1787 (count % tape->blk_size) == 0)
1810 tape->user_bs_factor = count / tape->blk_size; 1788 tape->user_bs_factor = count / tape->blk_size;
@@ -1844,7 +1822,7 @@ static ssize_t idetape_chrdev_read(struct file *file, char __user *buf,
1844 tape->merge_bh_size = bytes_read-temp; 1822 tape->merge_bh_size = bytes_read-temp;
1845 } 1823 }
1846finish: 1824finish:
1847 if (!actually_read && test_bit(IDETAPE_FLAG_FILEMARK, &tape->flags)) { 1825 if (!actually_read && test_bit(IDE_AFLAG_FILEMARK, &drive->atapi_flags)) {
1848 debug_log(DBG_SENSE, "%s: spacing over filemark\n", tape->name); 1826 debug_log(DBG_SENSE, "%s: spacing over filemark\n", tape->name);
1849 1827
1850 idetape_space_over_filemarks(drive, MTFSF, 1); 1828 idetape_space_over_filemarks(drive, MTFSF, 1);
@@ -2030,7 +2008,7 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count)
2030 !IDETAPE_LU_LOAD_MASK); 2008 !IDETAPE_LU_LOAD_MASK);
2031 retval = idetape_queue_pc_tail(drive, &pc); 2009 retval = idetape_queue_pc_tail(drive, &pc);
2032 if (!retval) 2010 if (!retval)
2033 clear_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags); 2011 clear_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags);
2034 return retval; 2012 return retval;
2035 case MTNOP: 2013 case MTNOP:
2036 ide_tape_discard_merge_buffer(drive, 0); 2014 ide_tape_discard_merge_buffer(drive, 0);
@@ -2053,9 +2031,9 @@ static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count)
2053 mt_count % tape->blk_size) 2031 mt_count % tape->blk_size)
2054 return -EIO; 2032 return -EIO;
2055 tape->user_bs_factor = mt_count / tape->blk_size; 2033 tape->user_bs_factor = mt_count / tape->blk_size;
2056 clear_bit(IDETAPE_FLAG_DETECT_BS, &tape->flags); 2034 clear_bit(IDE_AFLAG_DETECT_BS, &drive->atapi_flags);
2057 } else 2035 } else
2058 set_bit(IDETAPE_FLAG_DETECT_BS, &tape->flags); 2036 set_bit(IDE_AFLAG_DETECT_BS, &drive->atapi_flags);
2059 return 0; 2037 return 0;
2060 case MTSEEK: 2038 case MTSEEK:
2061 ide_tape_discard_merge_buffer(drive, 0); 2039 ide_tape_discard_merge_buffer(drive, 0);
@@ -2205,20 +2183,20 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
2205 2183
2206 filp->private_data = tape; 2184 filp->private_data = tape;
2207 2185
2208 if (test_and_set_bit(IDETAPE_FLAG_BUSY, &tape->flags)) { 2186 if (test_and_set_bit(IDE_AFLAG_BUSY, &drive->atapi_flags)) {
2209 retval = -EBUSY; 2187 retval = -EBUSY;
2210 goto out_put_tape; 2188 goto out_put_tape;
2211 } 2189 }
2212 2190
2213 retval = idetape_wait_ready(drive, 60 * HZ); 2191 retval = idetape_wait_ready(drive, 60 * HZ);
2214 if (retval) { 2192 if (retval) {
2215 clear_bit(IDETAPE_FLAG_BUSY, &tape->flags); 2193 clear_bit(IDE_AFLAG_BUSY, &drive->atapi_flags);
2216 printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name); 2194 printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name);
2217 goto out_put_tape; 2195 goto out_put_tape;
2218 } 2196 }
2219 2197
2220 idetape_read_position(drive); 2198 idetape_read_position(drive);
2221 if (!test_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags)) 2199 if (!test_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags))
2222 (void)idetape_rewind_tape(drive); 2200 (void)idetape_rewind_tape(drive);
2223 2201
2224 /* Read block size and write protect status from drive. */ 2202 /* Read block size and write protect status from drive. */
@@ -2234,7 +2212,7 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
2234 if (tape->write_prot) { 2212 if (tape->write_prot) {
2235 if ((filp->f_flags & O_ACCMODE) == O_WRONLY || 2213 if ((filp->f_flags & O_ACCMODE) == O_WRONLY ||
2236 (filp->f_flags & O_ACCMODE) == O_RDWR) { 2214 (filp->f_flags & O_ACCMODE) == O_RDWR) {
2237 clear_bit(IDETAPE_FLAG_BUSY, &tape->flags); 2215 clear_bit(IDE_AFLAG_BUSY, &drive->atapi_flags);
2238 retval = -EROFS; 2216 retval = -EROFS;
2239 goto out_put_tape; 2217 goto out_put_tape;
2240 } 2218 }
@@ -2294,7 +2272,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
2294 ide_tape_discard_merge_buffer(drive, 1); 2272 ide_tape_discard_merge_buffer(drive, 1);
2295 } 2273 }
2296 2274
2297 if (minor < 128 && test_bit(IDETAPE_FLAG_MEDIUM_PRESENT, &tape->flags)) 2275 if (minor < 128 && test_bit(IDE_AFLAG_MEDIUM_PRESENT, &drive->atapi_flags))
2298 (void) idetape_rewind_tape(drive); 2276 (void) idetape_rewind_tape(drive);
2299 if (tape->chrdev_dir == IDETAPE_DIR_NONE) { 2277 if (tape->chrdev_dir == IDETAPE_DIR_NONE) {
2300 if (tape->door_locked == DOOR_LOCKED) { 2278 if (tape->door_locked == DOOR_LOCKED) {
@@ -2304,7 +2282,7 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
2304 } 2282 }
2305 } 2283 }
2306 } 2284 }
2307 clear_bit(IDETAPE_FLAG_BUSY, &tape->flags); 2285 clear_bit(IDE_AFLAG_BUSY, &drive->atapi_flags);
2308 ide_tape_put(tape); 2286 ide_tape_put(tape);
2309 unlock_kernel(); 2287 unlock_kernel();
2310 return 0; 2288 return 0;
@@ -2489,7 +2467,7 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
2489 2467
2490 /* Command packet DRQ type */ 2468 /* Command packet DRQ type */
2491 if (((gcw[0] & 0x60) >> 5) == 1) 2469 if (((gcw[0] & 0x60) >> 5) == 1)
2492 set_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags); 2470 set_bit(IDE_AFLAG_DRQ_INTERRUPT, &drive->atapi_flags);
2493 2471
2494 idetape_get_inquiry_results(drive); 2472 idetape_get_inquiry_results(drive);
2495 idetape_get_mode_sense_results(drive); 2473 idetape_get_mode_sense_results(drive);