diff options
author | Albert Lee <albertcc@tw.ibm.com> | 2005-12-05 02:38:02 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-06 04:49:22 -0500 |
commit | a22e2eb0710798009b8e696ae911aef745089dd6 (patch) | |
tree | 93421443499249db0301868e07f24156c456cf7a /drivers/scsi/libata-core.c | |
parent | c14b8331ec4843e4f2b67a4d847a0d812a50e43c (diff) |
[PATCH] libata: move err_mask to ata_queued_cmd
- remove err_mask from the parameter list of the complete functions
- move err_mask to ata_queued_cmd
- initialize qc->err_mask when needed
- for each function call to ata_qc_complete(), replace the err_mask parameter with qc->err_mask.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
===============
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 0a959566f964..f56b4daf4189 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1053,9 +1053,9 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc, | |||
1053 | 1053 | ||
1054 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { | 1054 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { |
1055 | /* timeout handling */ | 1055 | /* timeout handling */ |
1056 | unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap)); | 1056 | qc->err_mask |= ac_err_mask(ata_chk_status(qc->ap)); |
1057 | 1057 | ||
1058 | if (!err_mask) { | 1058 | if (!qc->err_mask) { |
1059 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", | 1059 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", |
1060 | qc->ap->id, qc->tf.command); | 1060 | qc->ap->id, qc->tf.command); |
1061 | } else { | 1061 | } else { |
@@ -1064,7 +1064,7 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc, | |||
1064 | rc = -EIO; | 1064 | rc = -EIO; |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | ata_qc_complete(qc, err_mask); | 1067 | ata_qc_complete(qc); |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | return rc; | 1070 | return rc; |
@@ -1175,6 +1175,7 @@ retry: | |||
1175 | qc->cursg_ofs = 0; | 1175 | qc->cursg_ofs = 0; |
1176 | qc->cursect = 0; | 1176 | qc->cursect = 0; |
1177 | qc->nsect = 1; | 1177 | qc->nsect = 1; |
1178 | qc->err_mask = 0; | ||
1178 | goto retry; | 1179 | goto retry; |
1179 | } | 1180 | } |
1180 | } | 1181 | } |
@@ -2777,7 +2778,7 @@ skip_map: | |||
2777 | * None. (grabs host lock) | 2778 | * None. (grabs host lock) |
2778 | */ | 2779 | */ |
2779 | 2780 | ||
2780 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 2781 | void ata_poll_qc_complete(struct ata_queued_cmd *qc) |
2781 | { | 2782 | { |
2782 | struct ata_port *ap = qc->ap; | 2783 | struct ata_port *ap = qc->ap; |
2783 | unsigned long flags; | 2784 | unsigned long flags; |
@@ -2785,7 +2786,7 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
2785 | spin_lock_irqsave(&ap->host_set->lock, flags); | 2786 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2786 | ap->flags &= ~ATA_FLAG_NOINTR; | 2787 | ap->flags &= ~ATA_FLAG_NOINTR; |
2787 | ata_irq_on(ap); | 2788 | ata_irq_on(ap); |
2788 | ata_qc_complete(qc, err_mask); | 2789 | ata_qc_complete(qc); |
2789 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 2790 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
2790 | } | 2791 | } |
2791 | 2792 | ||
@@ -2885,7 +2886,8 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2885 | 2886 | ||
2886 | ap->hsm_task_state = HSM_ST_IDLE; | 2887 | ap->hsm_task_state = HSM_ST_IDLE; |
2887 | 2888 | ||
2888 | ata_poll_qc_complete(qc, 0); | 2889 | assert(qc->err_mask == 0); |
2890 | ata_poll_qc_complete(qc); | ||
2889 | 2891 | ||
2890 | /* another command may start at this point */ | 2892 | /* another command may start at this point */ |
2891 | 2893 | ||
@@ -3261,7 +3263,8 @@ static void ata_pio_error(struct ata_port *ap) | |||
3261 | 3263 | ||
3262 | ap->hsm_task_state = HSM_ST_IDLE; | 3264 | ap->hsm_task_state = HSM_ST_IDLE; |
3263 | 3265 | ||
3264 | ata_poll_qc_complete(qc, AC_ERR_ATA_BUS); | 3266 | qc->err_mask |= AC_ERR_ATA_BUS; |
3267 | ata_poll_qc_complete(qc); | ||
3265 | } | 3268 | } |
3266 | 3269 | ||
3267 | static void ata_pio_task(void *_data) | 3270 | static void ata_pio_task(void *_data) |
@@ -3363,7 +3366,8 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3363 | ap->id, qc->tf.command, drv_stat, host_stat); | 3366 | ap->id, qc->tf.command, drv_stat, host_stat); |
3364 | 3367 | ||
3365 | /* complete taskfile transaction */ | 3368 | /* complete taskfile transaction */ |
3366 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 3369 | qc->err_mask |= ac_err_mask(drv_stat); |
3370 | ata_qc_complete(qc); | ||
3367 | break; | 3371 | break; |
3368 | } | 3372 | } |
3369 | 3373 | ||
@@ -3462,7 +3466,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3462 | return qc; | 3466 | return qc; |
3463 | } | 3467 | } |
3464 | 3468 | ||
3465 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask) | 3469 | int ata_qc_complete_noop(struct ata_queued_cmd *qc) |
3466 | { | 3470 | { |
3467 | return 0; | 3471 | return 0; |
3468 | } | 3472 | } |
@@ -3521,7 +3525,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
3521 | * spin_lock_irqsave(host_set lock) | 3525 | * spin_lock_irqsave(host_set lock) |
3522 | */ | 3526 | */ |
3523 | 3527 | ||
3524 | void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 3528 | void ata_qc_complete(struct ata_queued_cmd *qc) |
3525 | { | 3529 | { |
3526 | int rc; | 3530 | int rc; |
3527 | 3531 | ||
@@ -3538,7 +3542,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
3538 | qc->flags &= ~ATA_QCFLAG_ACTIVE; | 3542 | qc->flags &= ~ATA_QCFLAG_ACTIVE; |
3539 | 3543 | ||
3540 | /* call completion callback */ | 3544 | /* call completion callback */ |
3541 | rc = qc->complete_fn(qc, err_mask); | 3545 | rc = qc->complete_fn(qc); |
3542 | 3546 | ||
3543 | /* if callback indicates not to complete command (non-zero), | 3547 | /* if callback indicates not to complete command (non-zero), |
3544 | * return immediately | 3548 | * return immediately |
@@ -3976,7 +3980,8 @@ inline unsigned int ata_host_intr (struct ata_port *ap, | |||
3976 | ap->ops->irq_clear(ap); | 3980 | ap->ops->irq_clear(ap); |
3977 | 3981 | ||
3978 | /* complete taskfile transaction */ | 3982 | /* complete taskfile transaction */ |
3979 | ata_qc_complete(qc, ac_err_mask(status)); | 3983 | qc->err_mask |= ac_err_mask(status); |
3984 | ata_qc_complete(qc); | ||
3980 | break; | 3985 | break; |
3981 | 3986 | ||
3982 | default: | 3987 | default: |
@@ -4111,7 +4116,8 @@ static void atapi_packet_task(void *_data) | |||
4111 | err_out_status: | 4116 | err_out_status: |
4112 | status = ata_chk_status(ap); | 4117 | status = ata_chk_status(ap); |
4113 | err_out: | 4118 | err_out: |
4114 | ata_poll_qc_complete(qc, __ac_err_mask(status)); | 4119 | qc->err_mask |= __ac_err_mask(status); |
4120 | ata_poll_qc_complete(qc); | ||
4115 | } | 4121 | } |
4116 | 4122 | ||
4117 | 4123 | ||