aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/libata-scsi.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-02-11 19:11:13 +0900
committerJeff Garzik <jgarzik@pobox.com>2006-02-11 17:51:57 -0500
commita46314744d8fadb91451bf2e5d2fd949c4a752d8 (patch)
tree46757778593f4d24d4b69a5cefd522d22d60abcf /drivers/scsi/libata-scsi.c
parent4bd00f6a201897af4cd50250a761e6bc4b2221ec (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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 9d67c676833..26f07a2617f 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)
/*
* Read the controller registers.
*/
- assert(NULL != qc->ap->ops->tf_read);
+ WARN_ON(qc->ap->ops->tf_read == NULL);
qc->ap->ops->tf_read(qc->ap, tf);
/*
@@ -628,7 +628,7 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc)
/*
* Read the controller registers.
*/
- assert(NULL != qc->ap->ops->tf_read);
+ WARN_ON(qc->ap->ops->tf_read == NULL);
qc->ap->ops->tf_read(qc->ap, tf);
/*
@@ -746,7 +746,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
spin_lock_irqsave(&ap->host_set->lock, flags);
qc = ata_qc_from_tag(ap, ap->active_tag);
if (qc) {
- assert(qc->scsicmd == cmd);
+ WARN_ON(qc->scsicmd != cmd);
qc->flags |= ATA_QCFLAG_EH_SCHEDULED;
qc->err_mask |= AC_ERR_TIMEOUT;
ret = EH_NOT_HANDLED;
@@ -780,14 +780,14 @@ int ata_scsi_error(struct Scsi_Host *host)
ap = (struct ata_port *) &host->hostdata[0];
spin_lock_irqsave(&ap->host_set->lock, flags);
- assert(!(ap->flags & ATA_FLAG_IN_EH));
+ WARN_ON(ap->flags & ATA_FLAG_IN_EH);
ap->flags |= ATA_FLAG_IN_EH;
- assert(ata_qc_from_tag(ap, ap->active_tag) != NULL);
+ WARN_ON(ata_qc_from_tag(ap, ap->active_tag) == NULL);
spin_unlock_irqrestore(&ap->host_set->lock, flags);
ap->ops->eng_timeout(ap);
- assert(host->host_failed == 0 && list_empty(&host->eh_cmd_q));
+ WARN_ON(host->host_failed || !list_empty(&host->eh_cmd_q));
scsi_eh_flush_done_q(&ap->eh_done_q);
@@ -813,7 +813,7 @@ static void __ata_eh_qc_complete(struct ata_queued_cmd *qc)
spin_lock_irqsave(&ap->host_set->lock, flags);
qc->scsidone = ata_eh_scsidone;
__ata_qc_complete(qc);
- assert(!ata_tag_valid(qc->tag));
+ WARN_ON(ata_tag_valid(qc->tag));
spin_unlock_irqrestore(&ap->host_set->lock, flags);
scsi_eh_finish_cmd(scmd, &ap->eh_done_q);