diff options
author | Tejun Heo <htejun@gmail.com> | 2006-02-11 05:11:13 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-11 17:51:57 -0500 |
commit | a46314744d8fadb91451bf2e5d2fd949c4a752d8 (patch) | |
tree | 46757778593f4d24d4b69a5cefd522d22d60abcf /drivers/scsi/libata-scsi.c | |
parent | 4bd00f6a201897af4cd50250a761e6bc4b2221ec (diff) |
[PATCH] libata: convert assert(X)'s in libata core layer to WARN_ON(!X)'s
In an effort to kill libata-specific assert() and use generic
WARN_ON(), this patch converts all assert(X)'s in libata core layer to
WARN_ON(!X)'s. Most conversions are straight-forward logical negation
exception for the followings.
* In libata-core.c:ata_fill_sg(),
assert(qc->n_elem > 0) is converted to WARN_ON(qc->n_elem == 0) because
qc->n_elem is unsigned and unsigned <= 0 is weird.
* In libata-scsi.c:ata_gen_ata_desc/fixed_sense(),
assert(NULL != qc->ap->ops->tf_read) is converted to
WARN_ON(qc->ap->ops->tf_read == NULL), as there are no other users of
'constant cond var' style in libata.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 9d67c6768335..26f07a2617f9 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -553,7 +553,7 @@ void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc) | |||
553 | /* | 553 | /* |
554 | * Read the controller registers. | 554 | * Read the controller registers. |
555 | */ | 555 | */ |
556 | assert(NULL != qc->ap->ops->tf_read); | 556 | WARN_ON(qc->ap->ops->tf_read == NULL); |
557 | qc->ap->ops->tf_read(qc->ap, tf); | 557 | qc->ap->ops->tf_read(qc->ap, tf); |
558 | 558 | ||
559 | /* | 559 | /* |
@@ -628,7 +628,7 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
628 | /* | 628 | /* |
629 | * Read the controller registers. | 629 | * Read the controller registers. |
630 | */ | 630 | */ |
631 | assert(NULL != qc->ap->ops->tf_read); | 631 | WARN_ON(qc->ap->ops->tf_read == NULL); |
632 | qc->ap->ops->tf_read(qc->ap, tf); | 632 | qc->ap->ops->tf_read(qc->ap, tf); |
633 | 633 | ||
634 | /* | 634 | /* |
@@ -746,7 +746,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) | |||
746 | spin_lock_irqsave(&ap->host_set->lock, flags); | 746 | spin_lock_irqsave(&ap->host_set->lock, flags); |
747 | qc = ata_qc_from_tag(ap, ap->active_tag); | 747 | qc = ata_qc_from_tag(ap, ap->active_tag); |
748 | if (qc) { | 748 | if (qc) { |
749 | assert(qc->scsicmd == cmd); | 749 | WARN_ON(qc->scsicmd != cmd); |
750 | qc->flags |= ATA_QCFLAG_EH_SCHEDULED; | 750 | qc->flags |= ATA_QCFLAG_EH_SCHEDULED; |
751 | qc->err_mask |= AC_ERR_TIMEOUT; | 751 | qc->err_mask |= AC_ERR_TIMEOUT; |
752 | ret = EH_NOT_HANDLED; | 752 | ret = EH_NOT_HANDLED; |
@@ -780,14 +780,14 @@ int ata_scsi_error(struct Scsi_Host *host) | |||
780 | ap = (struct ata_port *) &host->hostdata[0]; | 780 | ap = (struct ata_port *) &host->hostdata[0]; |
781 | 781 | ||
782 | spin_lock_irqsave(&ap->host_set->lock, flags); | 782 | spin_lock_irqsave(&ap->host_set->lock, flags); |
783 | assert(!(ap->flags & ATA_FLAG_IN_EH)); | 783 | WARN_ON(ap->flags & ATA_FLAG_IN_EH); |
784 | ap->flags |= ATA_FLAG_IN_EH; | 784 | ap->flags |= ATA_FLAG_IN_EH; |
785 | assert(ata_qc_from_tag(ap, ap->active_tag) != NULL); | 785 | WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL); |
786 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 786 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
787 | 787 | ||
788 | ap->ops->eng_timeout(ap); | 788 | ap->ops->eng_timeout(ap); |
789 | 789 | ||
790 | assert(host->host_failed == 0 && list_empty(&host->eh_cmd_q)); | 790 | WARN_ON(host->host_failed || !list_empty(&host->eh_cmd_q)); |
791 | 791 | ||
792 | scsi_eh_flush_done_q(&ap->eh_done_q); | 792 | scsi_eh_flush_done_q(&ap->eh_done_q); |
793 | 793 | ||
@@ -813,7 +813,7 @@ static void __ata_eh_qc_complete(struct ata_queued_cmd *qc) | |||
813 | spin_lock_irqsave(&ap->host_set->lock, flags); | 813 | spin_lock_irqsave(&ap->host_set->lock, flags); |
814 | qc->scsidone = ata_eh_scsidone; | 814 | qc->scsidone = ata_eh_scsidone; |
815 | __ata_qc_complete(qc); | 815 | __ata_qc_complete(qc); |
816 | assert(!ata_tag_valid(qc->tag)); | 816 | WARN_ON(ata_tag_valid(qc->tag)); |
817 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 817 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
818 | 818 | ||
819 | scsi_eh_finish_cmd(scmd, &ap->eh_done_q); | 819 | scsi_eh_finish_cmd(scmd, &ap->eh_done_q); |