libata-eh.c (f1545154a5c96590b1992aac8ee1e2c445e301ed) libata-eh.c (fccb6ea5c240b9f29baa55448488fd6aee49f5a5)
1/*
2 * libata-eh.c - libata error handling
3 *
4 * Maintained by: Jeff Garzik <jgarzik@pobox.com>
5 * Please ALWAYS copy linux-ide@vger.kernel.org
6 * on emails.
7 *
8 * Copyright 2006 Tejun Heo <htejun@gmail.com>

--- 1700 unchanged lines hidden (view full) ---

1709
1710 for (i = 0; i < ATA_MAX_DEVICES; i++)
1711 classes[i] = ATA_DEV_NONE;
1712
1713 rc = 0;
1714 } else
1715 ata_port_printk(ap, KERN_ERR,
1716 "prereset failed (errno=%d)\n", rc);
1/*
2 * libata-eh.c - libata error handling
3 *
4 * Maintained by: Jeff Garzik <jgarzik@pobox.com>
5 * Please ALWAYS copy linux-ide@vger.kernel.org
6 * on emails.
7 *
8 * Copyright 2006 Tejun Heo <htejun@gmail.com>

--- 1700 unchanged lines hidden (view full) ---

1709
1710 for (i = 0; i < ATA_MAX_DEVICES; i++)
1711 classes[i] = ATA_DEV_NONE;
1712
1713 rc = 0;
1714 } else
1715 ata_port_printk(ap, KERN_ERR,
1716 "prereset failed (errno=%d)\n", rc);
1717 return rc;
1717 goto out;
1718 }
1719 }
1720
1721 /* prereset() might have modified ehc->i.action */
1722 if (ehc->i.action & ATA_EH_HARDRESET)
1723 reset = hardreset;
1724 else if (ehc->i.action & ATA_EH_SOFTRESET)
1725 reset = softreset;
1726 else {
1727 /* prereset told us not to reset, bang classes and return */
1728 for (i = 0; i < ATA_MAX_DEVICES; i++)
1729 classes[i] = ATA_DEV_NONE;
1718 }
1719 }
1720
1721 /* prereset() might have modified ehc->i.action */
1722 if (ehc->i.action & ATA_EH_HARDRESET)
1723 reset = hardreset;
1724 else if (ehc->i.action & ATA_EH_SOFTRESET)
1725 reset = softreset;
1726 else {
1727 /* prereset told us not to reset, bang classes and return */
1728 for (i = 0; i < ATA_MAX_DEVICES; i++)
1729 classes[i] = ATA_DEV_NONE;
1730 return 0;
1730 rc = 0;
1731 goto out;
1731 }
1732
1733 /* did prereset() screw up? if so, fix up to avoid oopsing */
1734 if (!reset) {
1735 if (softreset)
1736 reset = softreset;
1737 else
1738 reset = hardreset;

--- 19 unchanged lines hidden (view full) ---

1758 ata_eh_followup_srst_needed(rc, classify, classes)) {
1759 /* okay, let's do follow-up softreset */
1760 reset = softreset;
1761
1762 if (!reset) {
1763 ata_port_printk(ap, KERN_ERR,
1764 "follow-up softreset required "
1765 "but no softreset avaliable\n");
1732 }
1733
1734 /* did prereset() screw up? if so, fix up to avoid oopsing */
1735 if (!reset) {
1736 if (softreset)
1737 reset = softreset;
1738 else
1739 reset = hardreset;

--- 19 unchanged lines hidden (view full) ---

1759 ata_eh_followup_srst_needed(rc, classify, classes)) {
1760 /* okay, let's do follow-up softreset */
1761 reset = softreset;
1762
1763 if (!reset) {
1764 ata_port_printk(ap, KERN_ERR,
1765 "follow-up softreset required "
1766 "but no softreset avaliable\n");
1766 return -EINVAL;
1767 rc = -EINVAL;
1768 goto out;
1767 }
1768
1769 ata_eh_about_to_do(ap, NULL, ATA_EH_RESET_MASK);
1770 rc = ata_do_reset(ap, reset, classes, deadline);
1771
1772 if (rc == 0 && classify &&
1773 classes[0] == ATA_DEV_UNKNOWN) {
1774 ata_port_printk(ap, KERN_ERR,
1775 "classification failed\n");
1769 }
1770
1771 ata_eh_about_to_do(ap, NULL, ATA_EH_RESET_MASK);
1772 rc = ata_do_reset(ap, reset, classes, deadline);
1773
1774 if (rc == 0 && classify &&
1775 classes[0] == ATA_DEV_UNKNOWN) {
1776 ata_port_printk(ap, KERN_ERR,
1777 "classification failed\n");
1776 return -EINVAL;
1778 rc = -EINVAL;
1779 goto out;
1777 }
1778 }
1779
1780 if (rc && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
1781 unsigned long now = jiffies;
1782
1783 if (time_before(now, deadline)) {
1784 unsigned long delta = deadline - jiffies;

--- 28 unchanged lines hidden (view full) ---

1813
1814 if (postreset)
1815 postreset(ap, classes);
1816
1817 /* reset successful, schedule revalidation */
1818 ata_eh_done(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK);
1819 ehc->i.action |= ATA_EH_REVALIDATE;
1820 }
1780 }
1781 }
1782
1783 if (rc && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
1784 unsigned long now = jiffies;
1785
1786 if (time_before(now, deadline)) {
1787 unsigned long delta = deadline - jiffies;

--- 28 unchanged lines hidden (view full) ---

1816
1817 if (postreset)
1818 postreset(ap, classes);
1819
1820 /* reset successful, schedule revalidation */
1821 ata_eh_done(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK);
1822 ehc->i.action |= ATA_EH_REVALIDATE;
1823 }
1821
1824 out:
1825 /* clear hotplug flag */
1826 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
1822 return rc;
1823}
1824
1825static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1826 struct ata_device **r_failed_dev)
1827{
1828 struct ata_eh_context *ehc = &ap->eh_context;
1829 struct ata_device *dev;

--- 479 unchanged lines hidden ---
1827 return rc;
1828}
1829
1830static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1831 struct ata_device **r_failed_dev)
1832{
1833 struct ata_eh_context *ehc = &ap->eh_context;
1834 struct ata_device *dev;

--- 479 unchanged lines hidden ---