From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-ide@vger.kernel.org, Forrest Zhao <forrest.zhao@gmail.com>
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 01/16] libata-link: separate out ata_eh_handle_dev_fail()
Date: Sun, 1 Jul 2007 19:05:58 +0900 [thread overview]
Message-ID: <11832843582930-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11832843581399-git-send-email-htejun@gmail.com>
Separate out ata_eh_handle_dev_fail() from ata_eh_recover(). This is
in preparation of ata_link and PMP support.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/ata/libata-eh.c | 96 +++++++++++++++++++++++++---------------------
1 files changed, 52 insertions(+), 44 deletions(-)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 1c8f465..5e82231 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2008,6 +2008,57 @@ static int ata_eh_skip_recovery(struct ata_port *ap)
return 1;
}
+static void ata_eh_handle_dev_fail(struct ata_device *dev, int err)
+{
+ struct ata_port *ap = dev->ap;
+ struct ata_eh_context *ehc = &ap->eh_context;
+
+ ehc->tries[dev->devno]--;
+
+ switch (err) {
+ case -ENODEV:
+ /* device missing or wrong IDENTIFY data, schedule probing */
+ ehc->i.probe_mask |= (1 << dev->devno);
+ case -EINVAL:
+ /* give it just one more chance */
+ ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
+ case -EIO:
+ if (ehc->tries[dev->devno] == 1) {
+ /* This is the last chance, better to slow
+ * down than lose it.
+ */
+ sata_down_spd_limit(ap);
+ ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+ }
+ }
+
+ if (ata_dev_enabled(dev) && !ehc->tries[dev->devno]) {
+ /* disable device if it has used up all its chances */
+ ata_dev_disable(dev);
+
+ /* detach if offline */
+ if (ata_port_offline(ap))
+ ata_eh_detach_dev(dev);
+
+ /* probe if requested */
+ if ((ehc->i.probe_mask & (1 << dev->devno)) &&
+ !(ehc->did_probe_mask & (1 << dev->devno))) {
+ ata_eh_detach_dev(dev);
+ ata_dev_init(dev);
+
+ ehc->tries[dev->devno] = ATA_EH_DEV_TRIES;
+ ehc->did_probe_mask |= (1 << dev->devno);
+ ehc->i.action |= ATA_EH_SOFTRESET;
+ }
+ } else {
+ /* soft didn't work? be haaaaard */
+ if (ehc->i.flags & ATA_EHI_DID_RESET)
+ ehc->i.action |= ATA_EH_HARDRESET;
+ else
+ ehc->i.action |= ATA_EH_SOFTRESET;
+ }
+}
+
/**
* ata_eh_recover - recover host port after error
* @ap: host port to recover
@@ -2108,50 +2159,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
goto out;
dev_fail:
- ehc->tries[dev->devno]--;
-
- switch (rc) {
- case -ENODEV:
- /* device missing or wrong IDENTIFY data, schedule probing */
- ehc->i.probe_mask |= (1 << dev->devno);
- case -EINVAL:
- /* give it just one more chance */
- ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
- case -EIO:
- if (ehc->tries[dev->devno] == 1) {
- /* This is the last chance, better to slow
- * down than lose it.
- */
- sata_down_spd_limit(ap);
- ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
- }
- }
-
- if (ata_dev_enabled(dev) && !ehc->tries[dev->devno]) {
- /* disable device if it has used up all its chances */
- ata_dev_disable(dev);
-
- /* detach if offline */
- if (ata_port_offline(ap))
- ata_eh_detach_dev(dev);
-
- /* probe if requested */
- if ((ehc->i.probe_mask & (1 << dev->devno)) &&
- !(ehc->did_probe_mask & (1 << dev->devno))) {
- ata_eh_detach_dev(dev);
- ata_dev_init(dev);
-
- ehc->tries[dev->devno] = ATA_EH_DEV_TRIES;
- ehc->did_probe_mask |= (1 << dev->devno);
- ehc->i.action |= ATA_EH_SOFTRESET;
- }
- } else {
- /* soft didn't work? be haaaaard */
- if (ehc->i.flags & ATA_EHI_DID_RESET)
- ehc->i.action |= ATA_EH_HARDRESET;
- else
- ehc->i.action |= ATA_EH_SOFTRESET;
- }
+ ata_eh_handle_dev_fail(dev, rc);
if (ata_port_nr_enabled(ap)) {
ata_port_printk(ap, KERN_WARNING, "failed to recover some "
--
1.5.0.3
next prev parent reply other threads:[~2007-07-01 10:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-01 10:05 [PATCHSET 2/4] libata: implement ata_link, take 4 Tejun Heo
2007-07-01 10:05 ` [PATCH 02/16] libata-link: add PMP related ATA constants Tejun Heo
2007-07-01 10:05 ` Tejun Heo [this message]
2007-07-11 1:47 ` [PATCH 01/16] libata-link: separate out ata_eh_handle_dev_fail() Jeff Garzik
2007-07-01 10:05 ` [PATCH 04/16] libata-link: implement and use link/device iterators Tejun Heo
2007-07-01 10:05 ` [PATCH 03/16] libata-link: introduce ata_link Tejun Heo
2007-07-01 10:05 ` [PATCH 06/16] libata-link: linkify EH action helpers Tejun Heo
2007-07-01 10:05 ` [PATCH 07/16] libata-link: linkify reset Tejun Heo
2007-07-01 10:05 ` [PATCH 05/16] libata-link: linkify PHY-related functions Tejun Heo
2007-07-01 10:06 ` [PATCH 11/16] libata-link: implement ata_link_abort() Tejun Heo
2007-07-01 10:06 ` [PATCH 09/16] libata-link: make two port flags HRST_TO_RESUME and SKIP_D2H_BSY link flags Tejun Heo
2007-07-01 10:06 ` [PATCH 08/16] libata-link: linkify config/EH related functions Tejun Heo
2007-07-01 10:06 ` [PATCH 10/16] libata-link: separate out link initialization functions Tejun Heo
2007-07-11 1:52 ` Jeff Garzik
2007-07-01 10:06 ` [PATCH 12/16] libata-link: add PMP links Tejun Heo
2007-07-01 10:06 ` [PATCH 15/16] libata-link: update hotplug to handle " Tejun Heo
2007-07-11 1:59 ` Jeff Garzik
2007-07-11 2:45 ` Tejun Heo
2007-07-01 10:06 ` [PATCH 16/16] libata-link: update Power Management " Tejun Heo
2007-07-11 1:59 ` Jeff Garzik
2007-07-01 10:06 ` [PATCH 13/16] libata-link: update ata_scsi_error() " Tejun Heo
2007-07-01 10:06 ` [PATCH 14/16] libata-link: update EH to deal with " Tejun Heo
2007-07-11 1:54 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11832843582930-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=forrest.zhao@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).