diff mbox series

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

Message ID 20240910101527.603452-5-ukaszb@chromium.org (mailing list archive)
State New
Headers show
Series usb: typec: Implement UCSI driver for ChromeOS | expand

Commit Message

Łukasz Bartosik Sept. 10, 2024, 10:15 a.m. UTC
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(-)

Comments

Heikki Krogerus Sept. 11, 2024, 1:20 p.m. UTC | #1
Hi Łukasz,

On Tue, Sep 10, 2024 at 10:15:23AM +0000, Łukasz Bartosik wrote:
> 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 },

Please merge this into the previous patch.

thanks,
Łukasz Bartosik Sept. 14, 2024, 9:50 p.m. UTC | #2
On Wed, Sep 11, 2024 at 3:21 PM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> Hi Łukasz,
>
> On Tue, Sep 10, 2024 at 10:15:23AM +0000, Łukasz Bartosik wrote:
> > 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 },
>
> Please merge this into the previous patch.
>

I will merge it.

Thanks,
Lukasz

> thanks,

>
> --
> heikki
diff mbox series

Patch

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 },