Commit 6702255d authored by Damien Le Moal's avatar Damien Le Moal

ata: libata-core: Remove ata_port_suspend_async()

ata_port_suspend_async() is only called by ata_sas_port_suspend().
Modify ata_port_suspend() with an additional bool argument indicating an
asynchronous or synchronous suspend to allow removing that helper
function. With this change, the variable ata_port_resume_ehi can also be
removed and its value (ATA_EHI_XXX flags passed directly to
ata_port_request_pm().
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Tested-by: default avatarChia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5b6fba54
...@@ -5166,18 +5166,8 @@ static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, ...@@ -5166,18 +5166,8 @@ static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
ata_port_wait_eh(ap); ata_port_wait_eh(ap);
} }
/* static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg,
* On some hardware, device fails to respond after spun down for suspend. As bool async)
* the device won't be used before being resumed, we don't need to touch the
* device. Ask EH to skip the usual stuff and proceed directly to suspend.
*
* http://thread.gmane.org/gmane.linux.ide/46764
*/
static const unsigned int ata_port_suspend_ehi = ATA_EHI_QUIET
| ATA_EHI_NO_AUTOPSY
| ATA_EHI_NO_RECOVERY;
static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg)
{ {
/* /*
* We are about to suspend the port, so we do not care about * We are about to suspend the port, so we do not care about
...@@ -5187,20 +5177,18 @@ static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg) ...@@ -5187,20 +5177,18 @@ static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg)
*/ */
cancel_delayed_work_sync(&ap->scsi_rescan_task); cancel_delayed_work_sync(&ap->scsi_rescan_task);
ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false);
}
static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg)
{
/* /*
* We are about to suspend the port, so we do not care about * On some hardware, device fails to respond after spun down for
* scsi_rescan_device() calls scheduled by previous resume operations. * suspend. As the device will not be used until being resumed, we
* The next resume will schedule the rescan again. So cancel any rescan * do not need to touch the device. Ask EH to skip the usual stuff
* that is not done yet. * and proceed directly to suspend.
*
* http://thread.gmane.org/gmane.linux.ide/46764
*/ */
cancel_delayed_work_sync(&ap->scsi_rescan_task); ata_port_request_pm(ap, mesg, 0,
ATA_EHI_QUIET | ATA_EHI_NO_AUTOPSY |
ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true); ATA_EHI_NO_RECOVERY,
async);
} }
static int ata_port_pm_suspend(struct device *dev) static int ata_port_pm_suspend(struct device *dev)
...@@ -5210,7 +5198,7 @@ static int ata_port_pm_suspend(struct device *dev) ...@@ -5210,7 +5198,7 @@ static int ata_port_pm_suspend(struct device *dev)
if (pm_runtime_suspended(dev)) if (pm_runtime_suspended(dev))
return 0; return 0;
ata_port_suspend(ap, PMSG_SUSPEND); ata_port_suspend(ap, PMSG_SUSPEND, false);
return 0; return 0;
} }
...@@ -5221,13 +5209,13 @@ static int ata_port_pm_freeze(struct device *dev) ...@@ -5221,13 +5209,13 @@ static int ata_port_pm_freeze(struct device *dev)
if (pm_runtime_suspended(dev)) if (pm_runtime_suspended(dev))
return 0; return 0;
ata_port_suspend(ap, PMSG_FREEZE); ata_port_suspend(ap, PMSG_FREEZE, false);
return 0; return 0;
} }
static int ata_port_pm_poweroff(struct device *dev) static int ata_port_pm_poweroff(struct device *dev)
{ {
ata_port_suspend(to_ata_port(dev), PMSG_HIBERNATE); ata_port_suspend(to_ata_port(dev), PMSG_HIBERNATE, false);
return 0; return 0;
} }
...@@ -5279,7 +5267,7 @@ static int ata_port_runtime_idle(struct device *dev) ...@@ -5279,7 +5267,7 @@ static int ata_port_runtime_idle(struct device *dev)
static int ata_port_runtime_suspend(struct device *dev) static int ata_port_runtime_suspend(struct device *dev)
{ {
ata_port_suspend(to_ata_port(dev), PMSG_AUTO_SUSPEND); ata_port_suspend(to_ata_port(dev), PMSG_AUTO_SUSPEND, false);
return 0; return 0;
} }
...@@ -5309,7 +5297,7 @@ static const struct dev_pm_ops ata_port_pm_ops = { ...@@ -5309,7 +5297,7 @@ static const struct dev_pm_ops ata_port_pm_ops = {
*/ */
void ata_sas_port_suspend(struct ata_port *ap) void ata_sas_port_suspend(struct ata_port *ap)
{ {
ata_port_suspend_async(ap, PMSG_SUSPEND); ata_port_suspend(ap, PMSG_SUSPEND, true);
} }
EXPORT_SYMBOL_GPL(ata_sas_port_suspend); EXPORT_SYMBOL_GPL(ata_sas_port_suspend);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment