[PATCH 5/5] misc: rtsx_usb: / memstick: rtsx_usb_ms: Avoid long delay before system suspend
From: Kai-Heng Feng
Date: Mon Jul 23 2018 - 06:28:23 EST
There's a long power-on delay at the end of rtsx_usb_ms_set_param().
This delay is noticeable right before system suspend.
To prevent already suspended memstick host from getting powered on by PM
core, use DPM_FLAG_SMART_SUSPEND to avoid the situation.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
drivers/memstick/host/rtsx_usb_ms.c | 4 ++++
drivers/misc/cardreader/rtsx_usb.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/memstick/host/rtsx_usb_ms.c b/drivers/memstick/host/rtsx_usb_ms.c
index 622497554a5a..85eaf688962f 100644
--- a/drivers/memstick/host/rtsx_usb_ms.c
+++ b/drivers/memstick/host/rtsx_usb_ms.c
@@ -772,6 +772,10 @@ static int rtsx_usb_ms_drv_probe(struct platform_device *pdev)
msh->set_param = rtsx_usb_ms_set_param;
msh->caps = MEMSTICK_CAP_PAR4;
+ /* DPM_FLAG_LEAVE_SUSPENDED is not needed, the parent device will wake
+ * up memstick host.
+ */
+ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_SUSPEND);
pm_runtime_set_active(ms_dev(host));
pm_runtime_enable(ms_dev(host));
diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
index fed83453e5c5..3c1942f9653f 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -671,6 +671,7 @@ static int rtsx_usb_probe(struct usb_interface *intf,
goto out_init_fail;
#ifdef CONFIG_PM
+ dev_pm_set_driver_flags(&intf->dev, DPM_FLAG_SMART_SUSPEND | DPM_FLAG_LEAVE_SUSPENDED);
intf->needs_remote_wakeup = 1;
usb_enable_autosuspend(usb_dev);
#endif
--
2.17.1