diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2008-04-17 18:46:27 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:27 -0400 |
commit | e3bfae4c105c9b79a539bb868e8541d2ad38deee (patch) | |
tree | d2ef5f10e34f0317cdb1dea96379fdf927199002 | |
parent | eaec3e7ded9dbc88bad393c076b65f4b7b11d30d (diff) |
ide-scsi: do non-atomic pc->flags testing
...also, convert ide-scsi to using the generic pc->flags defines.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/scsi/ide-scsi.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 5ec421c988d4..93c3fc20aa59 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -61,14 +61,6 @@ | |||
61 | #define IDESCSI_DEBUG_LOG 0 | 61 | #define IDESCSI_DEBUG_LOG 0 |
62 | 62 | ||
63 | /* | 63 | /* |
64 | * Packet command status bits. | ||
65 | */ | ||
66 | #define PC_DMA_IN_PROGRESS 0 /* 1 while DMA in progress */ | ||
67 | #define PC_WRITING 1 /* Data direction */ | ||
68 | #define PC_TIMEDOUT 3 /* command timed out */ | ||
69 | #define PC_DMA_OK 4 /* Use DMA */ | ||
70 | |||
71 | /* | ||
72 | * SCSI command transformation layer | 64 | * SCSI command transformation layer |
73 | */ | 65 | */ |
74 | #define IDESCSI_SG_TRANSFORM 1 /* /dev/sg transformation */ | 66 | #define IDESCSI_SG_TRANSFORM 1 /* /dev/sg transformation */ |
@@ -319,8 +311,10 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
319 | pc = opc; | 311 | pc = opc; |
320 | rq = pc->rq; | 312 | rq = pc->rq; |
321 | pc->scsi_cmd->result = (CHECK_CONDITION << 1) | | 313 | pc->scsi_cmd->result = (CHECK_CONDITION << 1) | |
322 | ((test_bit(PC_TIMEDOUT, &pc->flags)?DID_TIME_OUT:DID_OK) << 16); | 314 | (((pc->flags & PC_FLAG_TIMEDOUT) ? |
323 | } else if (test_bit(PC_TIMEDOUT, &pc->flags)) { | 315 | DID_TIME_OUT : |
316 | DID_OK) << 16); | ||
317 | } else if (pc->flags & PC_FLAG_TIMEDOUT) { | ||
324 | if (log) | 318 | if (log) |
325 | printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n", | 319 | printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n", |
326 | drive->name, pc->scsi_cmd->serial_number); | 320 | drive->name, pc->scsi_cmd->serial_number); |
@@ -362,7 +356,7 @@ static int idescsi_expiry(ide_drive_t *drive) | |||
362 | #if IDESCSI_DEBUG_LOG | 356 | #if IDESCSI_DEBUG_LOG |
363 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); | 357 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); |
364 | #endif | 358 | #endif |
365 | set_bit(PC_TIMEDOUT, &pc->flags); | 359 | pc->flags |= PC_FLAG_TIMEDOUT; |
366 | 360 | ||
367 | return 0; /* we do not want the ide subsystem to retry */ | 361 | return 0; /* we do not want the ide subsystem to retry */ |
368 | } | 362 | } |
@@ -384,7 +378,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
384 | printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); | 378 | printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); |
385 | #endif /* IDESCSI_DEBUG_LOG */ | 379 | #endif /* IDESCSI_DEBUG_LOG */ |
386 | 380 | ||
387 | if (test_bit(PC_TIMEDOUT, &pc->flags)){ | 381 | if (pc->flags & PC_FLAG_TIMEDOUT) { |
388 | #if IDESCSI_DEBUG_LOG | 382 | #if IDESCSI_DEBUG_LOG |
389 | printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n", | 383 | printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n", |
390 | pc->scsi_cmd->serial_number, jiffies); | 384 | pc->scsi_cmd->serial_number, jiffies); |
@@ -393,7 +387,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
393 | idescsi_end_request (drive, 1, 0); | 387 | idescsi_end_request (drive, 1, 0); |
394 | return ide_stopped; | 388 | return ide_stopped; |
395 | } | 389 | } |
396 | if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) { | 390 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
391 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; | ||
397 | #if IDESCSI_DEBUG_LOG | 392 | #if IDESCSI_DEBUG_LOG |
398 | printk ("ide-scsi: %s: DMA complete\n", drive->name); | 393 | printk ("ide-scsi: %s: DMA complete\n", drive->name); |
399 | #endif /* IDESCSI_DEBUG_LOG */ | 394 | #endif /* IDESCSI_DEBUG_LOG */ |
@@ -432,7 +427,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
432 | "- discarding data\n"); | 427 | "- discarding data\n"); |
433 | temp = pc->buf_size - pc->xferred; | 428 | temp = pc->buf_size - pc->xferred; |
434 | if (temp) { | 429 | if (temp) { |
435 | clear_bit(PC_WRITING, &pc->flags); | 430 | pc->flags &= ~PC_FLAG_WRITING; |
436 | if (pc->sg) | 431 | if (pc->sg) |
437 | idescsi_input_buffers(drive, pc, | 432 | idescsi_input_buffers(drive, pc, |
438 | temp); | 433 | temp); |
@@ -454,14 +449,14 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
454 | } | 449 | } |
455 | } | 450 | } |
456 | if (ireason & IO) { | 451 | if (ireason & IO) { |
457 | clear_bit(PC_WRITING, &pc->flags); | 452 | pc->flags &= ~PC_FLAG_WRITING; |
458 | if (pc->sg) | 453 | if (pc->sg) |
459 | idescsi_input_buffers(drive, pc, bcount); | 454 | idescsi_input_buffers(drive, pc, bcount); |
460 | else | 455 | else |
461 | hwif->atapi_input_bytes(drive, pc->cur_pos, | 456 | hwif->atapi_input_bytes(drive, pc->cur_pos, |
462 | bcount); | 457 | bcount); |
463 | } else { | 458 | } else { |
464 | set_bit(PC_WRITING, &pc->flags); | 459 | pc->flags |= PC_FLAG_WRITING; |
465 | if (pc->sg) | 460 | if (pc->sg) |
466 | idescsi_output_buffers(drive, pc, bcount); | 461 | idescsi_output_buffers(drive, pc, bcount); |
467 | else | 462 | else |
@@ -501,8 +496,8 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive) | |||
501 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 496 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
502 | /* Send the actual packet */ | 497 | /* Send the actual packet */ |
503 | drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); | 498 | drive->hwif->atapi_output_bytes(drive, scsi->pc->c, 12); |
504 | if (test_bit (PC_DMA_OK, &pc->flags)) { | 499 | if (pc->flags & PC_FLAG_DMA_OK) { |
505 | set_bit (PC_DMA_IN_PROGRESS, &pc->flags); | 500 | pc->flags |= PC_FLAG_DMA_IN_PROGRESS; |
506 | hwif->dma_start(drive); | 501 | hwif->dma_start(drive); |
507 | } | 502 | } |
508 | return ide_started; | 503 | return ide_started; |
@@ -512,10 +507,10 @@ static inline int idescsi_set_direction(struct ide_atapi_pc *pc) | |||
512 | { | 507 | { |
513 | switch (pc->c[0]) { | 508 | switch (pc->c[0]) { |
514 | case READ_6: case READ_10: case READ_12: | 509 | case READ_6: case READ_10: case READ_12: |
515 | clear_bit(PC_WRITING, &pc->flags); | 510 | pc->flags &= ~PC_FLAG_WRITING; |
516 | return 0; | 511 | return 0; |
517 | case WRITE_6: case WRITE_10: case WRITE_12: | 512 | case WRITE_6: case WRITE_10: case WRITE_12: |
518 | set_bit(PC_WRITING, &pc->flags); | 513 | pc->flags |= PC_FLAG_WRITING; |
519 | return 0; | 514 | return 0; |
520 | default: | 515 | default: |
521 | return 1; | 516 | return 1; |
@@ -572,7 +567,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive, | |||
572 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma); | 567 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma); |
573 | 568 | ||
574 | if (dma) | 569 | if (dma) |
575 | set_bit(PC_DMA_OK, &pc->flags); | 570 | pc->flags |= PC_FLAG_DMA_OK; |
576 | 571 | ||
577 | if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { | 572 | if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { |
578 | ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc, | 573 | ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc, |