[PATCH v6 4/8] usb: typec: cros_ec_ucsi: Use complete instead of resume

Łukasz Bartosik
2024-09-10T10:15:42Z

From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

On platforms using cros_ec_lpc, resume is split into .resume_early and
.complete. To avoid missing EC events, use .complete to schedule work
when resuming.

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org>
---
drivers/usb/typec/ucsi/cros_ec_ucsi.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
index 20e608097fc6..422b3b14028c 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -241,15 +241,18 @@ static int __maybe_unused cros_ucsi_suspend(struct device *dev)
return 0;
}

-static int __maybe_unused cros_ucsi_resume(struct device *dev)
+static void __maybe_unused cros_ucsi_complete(struct device *dev)
{
struct cros_ucsi_data *udata = dev_get_drvdata(dev);
-
- return ucsi_resume(udata->ucsi);
+ ucsi_resume(udata->ucsi);
}

-static SIMPLE_DEV_PM_OPS(cros_ucsi_pm_ops, cros_ucsi_suspend,
- cros_ucsi_resume);
+static const struct dev_pm_ops cros_ucsi_pm_ops = {
+#ifdef CONFIG_PM_SLEEP
+ .suspend = cros_ucsi_suspend,
+ .complete = cros_ucsi_complete,
+#endif
+};

static const struct platform_device_id cros_ucsi_id[] = {
{ KBUILD_MODNAME, 0 },
--
2.46.0.598.g6f2099f65c-goog