Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14299
b: refs/heads/master
c: 64f043d
h: refs/heads/master
i:
  14297: 21547bc
  14295: 6b3738c
v: v3
  • Loading branch information
Jeff Garzik committed Nov 17, 2005
1 parent 8080c88 commit 0d4be45
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 556c66db0794b9b85481cb5e3cb57688eabad982
refs/heads/master: 64f043d80752a8e5f0d55255e7bb9a1a05af206f
32 changes: 28 additions & 4 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,30 @@ static unsigned int ata_pio_modes(const struct ata_device *adev)
return modes;
}

static int ata_qc_wait_err(struct ata_queued_cmd *qc,
struct completion *wait)
{
int rc = 0;

if (wait_for_completion_timeout(wait, 30 * HZ) < 1) {
/* timeout handling */
unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap));

if (!err_mask) {
printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n",
qc->ap->id, qc->tf.command);
} else {
printk(KERN_WARNING "ata%u: qc timeout (cmd %x)\n",
qc->ap->id, qc->tf.command);
rc = -EIO;
}

ata_qc_complete(qc, err_mask);
}

return rc;
}

/**
* ata_dev_identify - obtain IDENTIFY x DEVICE page
* @ap: port on which device we wish to probe resides
Expand Down Expand Up @@ -1125,7 +1149,7 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
if (rc)
goto err_out;
else
wait_for_completion(&wait);
ata_qc_wait_err(qc, &wait);

spin_lock_irqsave(&ap->host_set->lock, flags);
ap->ops->tf_read(ap, &qc->tf);
Expand Down Expand Up @@ -2269,7 +2293,7 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev)
if (rc)
ata_port_disable(ap);
else
wait_for_completion(&wait);
ata_qc_wait_err(qc, &wait);

DPRINTK("EXIT\n");
}
Expand Down Expand Up @@ -2317,7 +2341,7 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev)
if (rc)
goto err_out;

wait_for_completion(&wait);
ata_qc_wait_err(qc, &wait);

swap_buf_le16(dev->id, ATA_ID_WORDS);

Expand Down Expand Up @@ -2373,7 +2397,7 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev)
if (rc)
ata_port_disable(ap);
else
wait_for_completion(&wait);
ata_qc_wait_err(qc, &wait);

DPRINTK("EXIT\n");
}
Expand Down

0 comments on commit 0d4be45

Please sign in to comment.