aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ide-scsi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-15 15:22:02 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-15 15:22:02 -0400
commitc6b2d260b5a7a5ed32aa2ce370d81183fc37eeb1 (patch)
tree806a4770acce66ee15f7af626caa36d040d73338 /drivers/scsi/ide-scsi.c
parent4c93067ea9e5eca9d975bec74dae641228ac1bbe (diff)
ide-scsi: use pc->callback
* Add ide_scsi_callback() pc->callback implementation, then update idescsi_check_condition() and idescsi_queue() to setup ->callback. * Convert idescsi_pc_intr() to use pc->callback. This is a preparation for adding generic ide_pc_intr() helper. Cc: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r--drivers/scsi/ide-scsi.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 32415466fbf..c0b39b9e5c1 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -183,6 +183,24 @@ static void ide_scsi_hex_dump(u8 *data, int len)
183 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0); 183 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0);
184} 184}
185 185
186static int idescsi_end_request(ide_drive_t *, int, int);
187
188static void ide_scsi_callback(ide_drive_t *drive)
189{
190 idescsi_scsi_t *scsi = drive_to_idescsi(drive);
191 struct ide_atapi_pc *pc = scsi->pc;
192
193 if (pc->flags & PC_FLAG_TIMEDOUT)
194 debug_log("%s: got timed out packet %lu at %lu\n", __func__,
195 pc->scsi_cmd->serial_number, jiffies);
196 /* end this request now - scsi should retry it*/
197 else if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
198 printk(KERN_INFO "Packet command completed, %d bytes"
199 " transferred\n", pc->xferred);
200
201 idescsi_end_request(drive, 1, 0);
202}
203
186static int idescsi_check_condition(ide_drive_t *drive, 204static int idescsi_check_condition(ide_drive_t *drive,
187 struct request *failed_cmd) 205 struct request *failed_cmd)
188{ 206{
@@ -210,6 +228,7 @@ static int idescsi_check_condition(ide_drive_t *drive,
210 rq->cmd_type = REQ_TYPE_SENSE; 228 rq->cmd_type = REQ_TYPE_SENSE;
211 rq->cmd_flags |= REQ_PREEMPT; 229 rq->cmd_flags |= REQ_PREEMPT;
212 pc->timeout = jiffies + WAIT_READY; 230 pc->timeout = jiffies + WAIT_READY;
231 pc->callback = ide_scsi_callback;
213 /* NOTE! Save the failed packet command in "rq->buffer" */ 232 /* NOTE! Save the failed packet command in "rq->buffer" */
214 rq->buffer = (void *) failed_cmd->special; 233 rq->buffer = (void *) failed_cmd->special;
215 pc->scsi_cmd = ((struct ide_atapi_pc *) failed_cmd->special)->scsi_cmd; 234 pc->scsi_cmd = ((struct ide_atapi_pc *) failed_cmd->special)->scsi_cmd;
@@ -222,8 +241,6 @@ static int idescsi_check_condition(ide_drive_t *drive,
222 return 0; 241 return 0;
223} 242}
224 243
225static int idescsi_end_request(ide_drive_t *, int, int);
226
227static ide_startstop_t 244static ide_startstop_t
228idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err) 245idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
229{ 246{
@@ -350,10 +367,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
350 debug_log("Reached %s interrupt handler\n", __func__); 367 debug_log("Reached %s interrupt handler\n", __func__);
351 368
352 if (pc->flags & PC_FLAG_TIMEDOUT) { 369 if (pc->flags & PC_FLAG_TIMEDOUT) {
353 debug_log("%s: got timed out packet %lu at %lu\n", __func__, 370 pc->callback(drive);
354 pc->scsi_cmd->serial_number, jiffies);
355 /* end this request now - scsi should retry it*/
356 idescsi_end_request (drive, 1, 0);
357 return ide_stopped; 371 return ide_stopped;
358 } 372 }
359 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { 373 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
@@ -369,14 +383,11 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
369 383
370 if ((stat & DRQ_STAT) == 0) { 384 if ((stat & DRQ_STAT) == 0) {
371 /* No more interrupts */ 385 /* No more interrupts */
372 if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
373 printk(KERN_INFO "Packet command completed, %d bytes"
374 " transferred\n", pc->xferred);
375 pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; 386 pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
376 local_irq_enable_in_hardirq(); 387 local_irq_enable_in_hardirq();
377 if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) 388 if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR))
378 rq->errors++; 389 rq->errors++;
379 idescsi_end_request (drive, 1, 0); 390 pc->callback(drive);
380 return ide_stopped; 391 return ide_stopped;
381 } 392 }
382 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { 393 if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
@@ -718,6 +729,7 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
718 pc->scsi_cmd = cmd; 729 pc->scsi_cmd = cmd;
719 pc->done = done; 730 pc->done = done;
720 pc->timeout = jiffies + cmd->timeout_per_command; 731 pc->timeout = jiffies + cmd->timeout_per_command;
732 pc->callback = ide_scsi_callback;
721 733
722 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 734 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
723 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); 735 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number);