summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@intel.com>2013-01-25 01:29:35 -0500
committerJeff Garzik <jgarzik@redhat.com>2013-01-25 15:33:33 -0500
commita7ff60dbe0858496531c75b1544666c099a2b200 (patch)
tree2bb707b6682c398fbe35db8d3b775272561ddab0 /drivers/ata/libata-eh.c
parente175435ed281d06ffd56d4edc8a2dd56f8672f07 (diff)
[libata] pm: differentiate system and runtime pm for ata port
We need to do different things for system PM and runtime PM, e.g. we do not need to enable runtime wake for ZPODD when we are doing system suspend, etc. Currently, we use PMSG_SUSPEND for both system suspend and runtime suspend and PMSG_ON for both system resume and runtime resume. Change this by using PMSG_AUTO_SUSPEND for runtime suspend and PMSG_AUTO_RESUME for runtime resume. And since PMSG_ON means no transition, it is changed to PMSG_RESUME for ata port's system resume. The ata_acpi_set_state is modified accordingly, and the sata case and pata case is seperated for easy reading. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 50f3ef04809d..f9476fb3ac43 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -4029,7 +4029,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
4029 /* are we suspending? */ 4029 /* are we suspending? */
4030 spin_lock_irqsave(ap->lock, flags); 4030 spin_lock_irqsave(ap->lock, flags);
4031 if (!(ap->pflags & ATA_PFLAG_PM_PENDING) || 4031 if (!(ap->pflags & ATA_PFLAG_PM_PENDING) ||
4032 ap->pm_mesg.event == PM_EVENT_ON) { 4032 ap->pm_mesg.event & PM_EVENT_RESUME) {
4033 spin_unlock_irqrestore(ap->lock, flags); 4033 spin_unlock_irqrestore(ap->lock, flags);
4034 return; 4034 return;
4035 } 4035 }
@@ -4040,10 +4040,13 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
4040 /* 4040 /*
4041 * If we have a ZPODD attached, check its zero 4041 * If we have a ZPODD attached, check its zero
4042 * power ready status before the port is frozen. 4042 * power ready status before the port is frozen.
4043 * Only needed for runtime suspend.
4043 */ 4044 */
4044 ata_for_each_dev(dev, &ap->link, ENABLED) { 4045 if (PMSG_IS_AUTO(ap->pm_mesg)) {
4045 if (zpodd_dev_enabled(dev)) 4046 ata_for_each_dev(dev, &ap->link, ENABLED) {
4046 zpodd_on_suspend(dev); 4047 if (zpodd_dev_enabled(dev))
4048 zpodd_on_suspend(dev);
4049 }
4047 } 4050 }
4048 4051
4049 /* tell ACPI we're suspending */ 4052 /* tell ACPI we're suspending */
@@ -4057,7 +4060,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
4057 if (ap->ops->port_suspend) 4060 if (ap->ops->port_suspend)
4058 rc = ap->ops->port_suspend(ap, ap->pm_mesg); 4061 rc = ap->ops->port_suspend(ap, ap->pm_mesg);
4059 4062
4060 ata_acpi_set_state(ap, PMSG_SUSPEND); 4063 ata_acpi_set_state(ap, ap->pm_mesg);
4061 out: 4064 out:
4062 /* report result */ 4065 /* report result */
4063 spin_lock_irqsave(ap->lock, flags); 4066 spin_lock_irqsave(ap->lock, flags);
@@ -4097,7 +4100,7 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
4097 /* are we resuming? */ 4100 /* are we resuming? */
4098 spin_lock_irqsave(ap->lock, flags); 4101 spin_lock_irqsave(ap->lock, flags);
4099 if (!(ap->pflags & ATA_PFLAG_PM_PENDING) || 4102 if (!(ap->pflags & ATA_PFLAG_PM_PENDING) ||
4100 ap->pm_mesg.event != PM_EVENT_ON) { 4103 !(ap->pm_mesg.event & PM_EVENT_RESUME)) {
4101 spin_unlock_irqrestore(ap->lock, flags); 4104 spin_unlock_irqrestore(ap->lock, flags);
4102 return; 4105 return;
4103 } 4106 }
@@ -4116,7 +4119,7 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
4116 ata_for_each_dev(dev, link, ALL) 4119 ata_for_each_dev(dev, link, ALL)
4117 ata_ering_clear(&dev->ering); 4120 ata_ering_clear(&dev->ering);
4118 4121
4119 ata_acpi_set_state(ap, PMSG_ON); 4122 ata_acpi_set_state(ap, ap->pm_mesg);
4120 4123
4121 if (ap->ops->port_resume) 4124 if (ap->ops->port_resume)
4122 rc = ap->ops->port_resume(ap); 4125 rc = ap->ops->port_resume(ap);