lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Jun 2020 17:23:39 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Prashant Malani <pmalani@...omium.org>
Cc:     linux-kernel@...r.kernel.org, Guenter Roeck <groeck@...omium.org>,
        Benson Leung <bleung@...omium.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>
Subject: Re: [PATCH v4 2/2] platform/chrome: cros_ec_typec: Add PM support

On Mon, Jun 29, 2020 at 02:13:29PM -0700, Prashant Malani wrote:
> Define basic suspend resume functions for cros-ec-typec. On suspend, we
> simply ensure that any pending port update work is completed, and on
> resume, we re-poll the port state to account for any
> changes/disconnections that might have occurred during suspend.
> 
> Signed-off-by: Prashant Malani <pmalani@...omium.org>
> Reviewed-by: Guenter Roeck <groeck@...omium.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
> 
> Changes in v4:
> - No changes (added Reviewed-by received in v3).
> 
> Changes in v3:
> - Remove superfluous DEV_PM_OPS #define.
> 
> Changes in v2:
> - Remove #ifdef-ery, add __maybe_unused tag to functions.
> 
>  drivers/platform/chrome/cros_ec_typec.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 69c4118e280c..cb95d190f06a 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -720,11 +720,35 @@ static int cros_typec_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> +static int __maybe_unused cros_typec_suspend(struct device *dev)
> +{
> +	struct cros_typec_data *typec = dev_get_drvdata(dev);
> +
> +	cancel_work_sync(&typec->port_work);
> +
> +	return 0;
> +}
> +
> +static int __maybe_unused cros_typec_resume(struct device *dev)
> +{
> +	struct cros_typec_data *typec = dev_get_drvdata(dev);
> +
> +	/* Refresh port state. */
> +	schedule_work(&typec->port_work);
> +
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops cros_typec_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(cros_typec_suspend, cros_typec_resume)
> +};
> +
>  static struct platform_driver cros_typec_driver = {
>  	.driver	= {
>  		.name = DRV_NAME,
>  		.acpi_match_table = ACPI_PTR(cros_typec_acpi_id),
>  		.of_match_table = of_match_ptr(cros_typec_of_match),
> +		.pm = &cros_typec_pm_ops,
>  	},
>  	.probe = cros_typec_probe,
>  };

thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ