[PATCH 18/18] [PATCH] libata-link: update Power Management to handle PMP links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Update Power Management to consider PMP links.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>
---
 drivers/ata/libata-core.c |   20 +++++++++++++-------
 drivers/ata/libata-eh.c   |   16 ++++++++++------
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index cc21698..0c94b65 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5195,6 +5195,7 @@ static int ata_host_request_pm(struct at
 
 	for (i = 0; i < host->n_ports; i++) {
 		struct ata_port *ap = host->ports[i];
+		struct ata_link *link;
 
 		/* Previous resume operation might still be in
 		 * progress.  Wait for PM_PENDING to clear.
@@ -5214,8 +5215,10 @@ static int ata_host_request_pm(struct at
 		}
 
 		ap->pflags |= ATA_PFLAG_PM_PENDING;
-		ap->link.eh_info.action |= action;
-		ap->link.eh_info.flags |= ehi_flags;
+		__ata_port_for_each_link(link, ap) {
+			link->eh_info.action |= action;
+			link->eh_info.flags |= ehi_flags;
+		}
 
 		ata_port_schedule_eh(ap);
 
@@ -5262,15 +5265,18 @@ int ata_host_suspend(struct ata_host *ho
 	 */
 	for (i = 0; i < host->n_ports; i++) {
 		struct ata_port *ap = host->ports[i];
+		struct ata_link *link;
 		struct ata_device *dev;
 
-		ata_link_for_each_dev(dev, &ap->link) {
-			if (ata_dev_ready(dev)) {
-				ata_port_printk(ap, KERN_WARNING,
+		ata_port_for_each_link(link, ap) {
+			ata_link_for_each_dev(dev, link) {
+				if (ata_dev_ready(dev)) {
+					ata_port_printk(ap, KERN_WARNING,
 						"suspend failed, device %d "
 						"still active\n", dev->devno);
-				rc = -EBUSY;
-				goto fail;
+					rc = -EBUSY;
+					goto fail;
+				}
 			}
 		}
 	}
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 1389a1f..ead460b 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2378,17 +2378,21 @@ static void ata_eh_handle_port_resume(st
 	/* give devices time to request EH */
 	timeout = jiffies + HZ; /* 1s max */
 	while (1) {
+		struct ata_link *link;
 		struct ata_device *dev;
 
-		ata_link_for_each_dev(dev, &ap->link) {
-			unsigned int action = ata_eh_dev_action(dev);
+		ata_port_for_each_link(link, ap) {
+			ata_link_for_each_dev(dev, link) {
+				unsigned int action = ata_eh_dev_action(dev);
 
-			if ((dev->flags & ATA_DFLAG_SUSPENDED) &&
-			    !(action & ATA_EH_RESUME))
-				break;
+				if ((dev->flags & ATA_DFLAG_SUSPENDED) &&
+				    !(action & ATA_EH_RESUME))
+					goto out_of_loop;
+			}
 		}
+	out_of_loop:
 
-		if (dev == NULL || time_after(jiffies, timeout))
+		if (link == NULL || time_after(jiffies, timeout))
 			break;
 		msleep(10);
 	}
-- 
1.4.2.3


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux