Message ID | 20230911040217.253905-14-dlemoal@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Fix libata suspend/resume handling and code cleanup | expand |
On 9/11/23 06:02, Damien Le Moal wrote: > Remove ata_port_resume_async() and replace it with a modified > ata_port_resume() taking an additional bool argument indicating if > ata EH resume operation should be executed synchronously or > asynchronously. With this change, the variable ata_port_resume_ehi is > not longer necessary and its value (ATA_EHI_XXX flags) passed directly > to ata_port_request_pm(). > > Signed-off-by: Damien Le Moal <dlemoal@kernel.org> > --- > drivers/ata/libata-core.c | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes
On Mon, Sep 11, 2023 at 01:02:11PM +0900, Damien Le Moal wrote: > Remove ata_port_resume_async() and replace it with a modified > ata_port_resume() taking an additional bool argument indicating if > ata EH resume operation should be executed synchronously or > asynchronously. With this change, the variable ata_port_resume_ehi is > not longer necessary and its value (ATA_EHI_XXX flags) passed directly > to ata_port_request_pm(). > > Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6fd9ea2b210d..8fa5fbae14f3 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5223,22 +5223,17 @@ static int ata_port_pm_poweroff(struct device *dev) return 0; } -static const unsigned int ata_port_resume_ehi = ATA_EHI_NO_AUTOPSY - | ATA_EHI_QUIET; - -static void ata_port_resume(struct ata_port *ap, pm_message_t mesg) +static void ata_port_resume(struct ata_port *ap, pm_message_t mesg, + bool async) { - ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, false); -} - -static void ata_port_resume_async(struct ata_port *ap, pm_message_t mesg) -{ - ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, true); + ata_port_request_pm(ap, mesg, ATA_EH_RESET, + ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, + async); } static int ata_port_pm_resume(struct device *dev) { - ata_port_resume_async(to_ata_port(dev), PMSG_RESUME); + ata_port_resume(to_ata_port(dev), PMSG_RESUME, true); pm_runtime_disable(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); @@ -5277,7 +5272,7 @@ static int ata_port_runtime_suspend(struct device *dev) static int ata_port_runtime_resume(struct device *dev) { - ata_port_resume(to_ata_port(dev), PMSG_AUTO_RESUME); + ata_port_resume(to_ata_port(dev), PMSG_AUTO_RESUME, false); return 0; } @@ -5307,7 +5302,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_suspend); void ata_sas_port_resume(struct ata_port *ap) { - ata_port_resume_async(ap, PMSG_RESUME); + ata_port_resume(ap, PMSG_RESUME, true); } EXPORT_SYMBOL_GPL(ata_sas_port_resume);
Remove ata_port_resume_async() and replace it with a modified ata_port_resume() taking an additional bool argument indicating if ata EH resume operation should be executed synchronously or asynchronously. With this change, the variable ata_port_resume_ehi is not longer necessary and its value (ATA_EHI_XXX flags) passed directly to ata_port_request_pm(). Signed-off-by: Damien Le Moal <dlemoal@kernel.org> --- drivers/ata/libata-core.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)