aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-06 05:36:23 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:31 -0400
commitcc0680a580b5be81a1ca321b58f8e9b80b5c1052 (patch)
tree57454cdfdc9890f4e8d9f532e9cd240c7361951f /drivers/ata/libata-eh.c
parent955e57dfde4ff75e4d7329ac7a3d645b16015309 (diff)
libata-link: linkify reset
Make reset methods and related functions deal with ata_link instead of ata_port. * ata_do_reset() * ata_eh_reset() * all prereset/reset/postreset methods and related functions This patch introduces no behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index fc4b6413b192..0a9ce34a0e64 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1737,16 +1737,16 @@ static void ata_eh_report(struct ata_port *ap)
1737 } 1737 }
1738} 1738}
1739 1739
1740static int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset, 1740static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
1741 unsigned int *classes, unsigned long deadline) 1741 unsigned int *classes, unsigned long deadline)
1742{ 1742{
1743 struct ata_device *dev; 1743 struct ata_device *dev;
1744 int rc; 1744 int rc;
1745 1745
1746 ata_link_for_each_dev(dev, &ap->link) 1746 ata_link_for_each_dev(dev, link)
1747 classes[dev->devno] = ATA_DEV_UNKNOWN; 1747 classes[dev->devno] = ATA_DEV_UNKNOWN;
1748 1748
1749 rc = reset(ap, classes, deadline); 1749 rc = reset(link, classes, deadline);
1750 if (rc) 1750 if (rc)
1751 return rc; 1751 return rc;
1752 1752
@@ -1754,12 +1754,12 @@ static int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset,
1754 * is complete and convert all ATA_DEV_UNKNOWN to 1754 * is complete and convert all ATA_DEV_UNKNOWN to
1755 * ATA_DEV_NONE. 1755 * ATA_DEV_NONE.
1756 */ 1756 */
1757 ata_link_for_each_dev(dev, &ap->link) 1757 ata_link_for_each_dev(dev, link)
1758 if (classes[dev->devno] != ATA_DEV_UNKNOWN) 1758 if (classes[dev->devno] != ATA_DEV_UNKNOWN)
1759 break; 1759 break;
1760 1760
1761 if (dev) { 1761 if (dev) {
1762 ata_link_for_each_dev(dev, &ap->link) { 1762 ata_link_for_each_dev(dev, link) {
1763 if (classes[dev->devno] == ATA_DEV_UNKNOWN) 1763 if (classes[dev->devno] == ATA_DEV_UNKNOWN)
1764 classes[dev->devno] = ATA_DEV_NONE; 1764 classes[dev->devno] = ATA_DEV_NONE;
1765 } 1765 }
@@ -1780,11 +1780,10 @@ static int ata_eh_followup_srst_needed(int rc, int classify,
1780 return 0; 1780 return 0;
1781} 1781}
1782 1782
1783static int ata_eh_reset(struct ata_port *ap, int classify, 1783static int ata_eh_reset(struct ata_link *link, int classify,
1784 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 1784 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
1785 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 1785 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
1786{ 1786{
1787 struct ata_link *link = &ap->link;
1788 struct ata_eh_context *ehc = &link->eh_context; 1787 struct ata_eh_context *ehc = &link->eh_context;
1789 unsigned int *classes = ehc->classes; 1788 unsigned int *classes = ehc->classes;
1790 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 1789 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
@@ -1810,10 +1809,10 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1810 ehc->i.action |= ATA_EH_HARDRESET; 1809 ehc->i.action |= ATA_EH_HARDRESET;
1811 1810
1812 if (prereset) { 1811 if (prereset) {
1813 rc = prereset(ap, jiffies + ATA_EH_PRERESET_TIMEOUT); 1812 rc = prereset(link, jiffies + ATA_EH_PRERESET_TIMEOUT);
1814 if (rc) { 1813 if (rc) {
1815 if (rc == -ENOENT) { 1814 if (rc == -ENOENT) {
1816 ata_port_printk(ap, KERN_DEBUG, 1815 ata_link_printk(link, KERN_DEBUG,
1817 "port disabled. ignoring.\n"); 1816 "port disabled. ignoring.\n");
1818 ehc->i.action &= ~ATA_EH_RESET_MASK; 1817 ehc->i.action &= ~ATA_EH_RESET_MASK;
1819 1818
@@ -1822,7 +1821,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1822 1821
1823 rc = 0; 1822 rc = 0;
1824 } else 1823 } else
1825 ata_port_printk(ap, KERN_ERR, 1824 ata_link_printk(link, KERN_ERR,
1826 "prereset failed (errno=%d)\n", rc); 1825 "prereset failed (errno=%d)\n", rc);
1827 goto out; 1826 goto out;
1828 } 1827 }
@@ -1854,7 +1853,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1854 1853
1855 /* shut up during boot probing */ 1854 /* shut up during boot probing */
1856 if (verbose) 1855 if (verbose)
1857 ata_port_printk(ap, KERN_INFO, "%s resetting port\n", 1856 ata_link_printk(link, KERN_INFO, "%s resetting link\n",
1858 reset == softreset ? "soft" : "hard"); 1857 reset == softreset ? "soft" : "hard");
1859 1858
1860 /* mark that this EH session started with reset */ 1859 /* mark that this EH session started with reset */
@@ -1863,7 +1862,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1863 else 1862 else
1864 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 1863 ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
1865 1864
1866 rc = ata_do_reset(ap, reset, classes, deadline); 1865 rc = ata_do_reset(link, reset, classes, deadline);
1867 1866
1868 if (reset == hardreset && 1867 if (reset == hardreset &&
1869 ata_eh_followup_srst_needed(rc, classify, classes)) { 1868 ata_eh_followup_srst_needed(rc, classify, classes)) {
@@ -1871,7 +1870,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1871 reset = softreset; 1870 reset = softreset;
1872 1871
1873 if (!reset) { 1872 if (!reset) {
1874 ata_port_printk(ap, KERN_ERR, 1873 ata_link_printk(link, KERN_ERR,
1875 "follow-up softreset required " 1874 "follow-up softreset required "
1876 "but no softreset avaliable\n"); 1875 "but no softreset avaliable\n");
1877 rc = -EINVAL; 1876 rc = -EINVAL;
@@ -1879,11 +1878,11 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1879 } 1878 }
1880 1879
1881 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); 1880 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK);
1882 rc = ata_do_reset(ap, reset, classes, deadline); 1881 rc = ata_do_reset(link, reset, classes, deadline);
1883 1882
1884 if (rc == 0 && classify && 1883 if (rc == 0 && classify &&
1885 classes[0] == ATA_DEV_UNKNOWN) { 1884 classes[0] == ATA_DEV_UNKNOWN) {
1886 ata_port_printk(ap, KERN_ERR, 1885 ata_link_printk(link, KERN_ERR,
1887 "classification failed\n"); 1886 "classification failed\n");
1888 rc = -EINVAL; 1887 rc = -EINVAL;
1889 goto out; 1888 goto out;
@@ -1896,7 +1895,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1896 if (time_before(now, deadline)) { 1895 if (time_before(now, deadline)) {
1897 unsigned long delta = deadline - jiffies; 1896 unsigned long delta = deadline - jiffies;
1898 1897
1899 ata_port_printk(ap, KERN_WARNING, "reset failed " 1898 ata_link_printk(link, KERN_WARNING, "reset failed "
1900 "(errno=%d), retrying in %u secs\n", 1899 "(errno=%d), retrying in %u secs\n",
1901 rc, (jiffies_to_msecs(delta) + 999) / 1000); 1900 rc, (jiffies_to_msecs(delta) + 999) / 1000);
1902 1901
@@ -1925,7 +1924,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1925 link->sata_spd = (sstatus >> 4) & 0xf; 1924 link->sata_spd = (sstatus >> 4) & 0xf;
1926 1925
1927 if (postreset) 1926 if (postreset)
1928 postreset(ap, classes); 1927 postreset(link, classes);
1929 1928
1930 /* reset successful, schedule revalidation */ 1929 /* reset successful, schedule revalidation */
1931 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK); 1930 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
@@ -2202,7 +2201,7 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2202 if (ehc->i.action & ATA_EH_RESET_MASK) { 2201 if (ehc->i.action & ATA_EH_RESET_MASK) {
2203 ata_eh_freeze_port(ap); 2202 ata_eh_freeze_port(ap);
2204 2203
2205 rc = ata_eh_reset(ap, ata_port_nr_vacant(ap), prereset, 2204 rc = ata_eh_reset(&ap->link, ata_port_nr_vacant(ap), prereset,
2206 softreset, hardreset, postreset); 2205 softreset, hardreset, postreset);
2207 if (rc) { 2206 if (rc) {
2208 ata_port_printk(ap, KERN_ERR, 2207 ata_port_printk(ap, KERN_ERR,