aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
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
commit8fccf8995c6d462db50265a5f7fa9a288a5a4590 (patch)
treed3d0da0b8a8bd29ecc290cd8985724c6ac874b38 /drivers/ide/ide-atapi.c
parent08feacf3bcc20c33e6a2a91d85d8190dd219d967 (diff)
ide: use rq->cmd instead of pc->c in atapi common code
There should be no functionality change resulting from this patch. [bart: s/HWGROUP(drive)/hwif->hwgroup/] Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 0e9eeb08da2d..f848010c15a5 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -22,6 +22,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
22 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int)) 22 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
23{ 23{
24 ide_hwif_t *hwif = drive->hwif; 24 ide_hwif_t *hwif = drive->hwif;
25 struct request *rq = hwif->hwgroup->rq;
25 const struct ide_tp_ops *tp_ops = hwif->tp_ops; 26 const struct ide_tp_ops *tp_ops = hwif->tp_ops;
26 xfer_func_t *xferfunc; 27 xfer_func_t *xferfunc;
27 unsigned int temp; 28 unsigned int temp;
@@ -64,8 +65,9 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
64 local_irq_enable_in_hardirq(); 65 local_irq_enable_in_hardirq();
65 66
66 if (drive->media == ide_tape && !scsi && 67 if (drive->media == ide_tape && !scsi &&
67 (stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE) 68 (stat & ERR_STAT) && rq->cmd[0] == REQUEST_SENSE)
68 stat &= ~ERR_STAT; 69 stat &= ~ERR_STAT;
70
69 if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) { 71 if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
70 /* Error detected */ 72 /* Error detected */
71 debug_log("%s: I/O error\n", drive->name); 73 debug_log("%s: I/O error\n", drive->name);
@@ -76,16 +78,17 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
76 goto cmd_finished; 78 goto cmd_finished;
77 } 79 }
78 80
79 if (pc->c[0] == REQUEST_SENSE) { 81 if (rq->cmd[0] == REQUEST_SENSE) {
80 printk(KERN_ERR "%s: I/O error in request sense" 82 printk(KERN_ERR "%s: I/O error in request sense"
81 " command\n", drive->name); 83 " command\n", drive->name);
82 return ide_do_reset(drive); 84 return ide_do_reset(drive);
83 } 85 }
84 86
85 debug_log("[cmd %x]: check condition\n", pc->c[0]); 87 debug_log("[cmd %x]: check condition\n", rq->cmd[0]);
86 88
87 /* Retry operation */ 89 /* Retry operation */
88 retry_pc(drive); 90 retry_pc(drive);
91
89 /* queued, but not started */ 92 /* queued, but not started */
90 return ide_stopped; 93 return ide_stopped;
91 } 94 }
@@ -96,8 +99,10 @@ cmd_finished:
96 dsc_handle(drive); 99 dsc_handle(drive);
97 return ide_stopped; 100 return ide_stopped;
98 } 101 }
102
99 /* Command finished - Call the callback function */ 103 /* Command finished - Call the callback function */
100 drive->pc_callback(drive); 104 drive->pc_callback(drive);
105
101 return ide_stopped; 106 return ide_stopped;
102 } 107 }
103 108
@@ -116,6 +121,7 @@ cmd_finished:
116 printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__); 121 printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
117 return ide_do_reset(drive); 122 return ide_do_reset(drive);
118 } 123 }
124
119 if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) { 125 if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
120 /* Hopefully, we will never get here */ 126 /* Hopefully, we will never get here */
121 printk(KERN_ERR "%s: We wanted to %s, but the device wants us " 127 printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
@@ -124,6 +130,7 @@ cmd_finished:
124 (ireason & IO) ? "Read" : "Write"); 130 (ireason & IO) ? "Read" : "Write");
125 return ide_do_reset(drive); 131 return ide_do_reset(drive);
126 } 132 }
133
127 if (!(pc->flags & PC_FLAG_WRITING)) { 134 if (!(pc->flags & PC_FLAG_WRITING)) {
128 /* Reading - Check that we have enough space */ 135 /* Reading - Check that we have enough space */
129 temp = pc->xferred + bcount; 136 temp = pc->xferred + bcount;
@@ -174,7 +181,7 @@ cmd_finished:
174 pc->cur_pos += bcount; 181 pc->cur_pos += bcount;
175 182
176 debug_log("[cmd %x] transferred %d bytes on that intr.\n", 183 debug_log("[cmd %x] transferred %d bytes on that intr.\n",
177 pc->c[0], bcount); 184 rq->cmd[0], bcount);
178 185
179 /* And set the interrupt handler again */ 186 /* And set the interrupt handler again */
180 ide_set_handler(drive, handler, timeout, expiry); 187 ide_set_handler(drive, handler, timeout, expiry);
@@ -220,6 +227,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
220 ide_expiry_t *expiry) 227 ide_expiry_t *expiry)
221{ 228{
222 ide_hwif_t *hwif = drive->hwif; 229 ide_hwif_t *hwif = drive->hwif;
230 struct request *rq = hwif->hwgroup->rq;
223 ide_startstop_t startstop; 231 ide_startstop_t startstop;
224 u8 ireason; 232 u8 ireason;
225 233
@@ -250,7 +258,7 @@ ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
250 258
251 /* Send the actual packet */ 259 /* Send the actual packet */
252 if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0) 260 if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0)
253 hwif->tp_ops->output_data(drive, NULL, pc->c, 12); 261 hwif->tp_ops->output_data(drive, NULL, rq->cmd, 12);
254 262
255 return ide_started; 263 return ide_started;
256} 264}