linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benson Leung <bleung@google.com>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	olof@lixom.net, bleung@chromium.org,
	linux-kernel@vger.kernel.org
Cc: lee.jones@linaro.org, Jeffery Yu <jefferyy@nvidia.com>,
	Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH RESEND 13/13] platform/chrome: cros_ec_lightbar - Avoid I2C xfer to EC during suspend
Date: Fri, 23 Jun 2017 15:22:46 -0700	[thread overview]
Message-ID: <62f4fd24-3c4f-0e68-656b-699a028f760d@google.com> (raw)
In-Reply-To: <20170516161319.13257-14-enric.balletbo@collabora.com>


[-- Attachment #1.1: Type: text/plain, Size: 3975 bytes --]

Hi Enric,

On 05/16/2017 09:13 AM, Enric Balletbo i Serra wrote:
> From: Jeffery Yu <jefferyy@nvidia.com>
> 
> A Mutex lock in cros_ec_cmd_xfer which may be held by frozen
> Userspace thread during system suspending. So should not
> call this routine in suspend thread.
> 
> Signed-off-by: Jeffery Yu <jefferyy@nvidia.com>
> Signed-off-by: Guenter Roeck <groeck@chromium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

Signed-off-by: Benson Leung <bleung@chromium.org>

Applied.
> ---
>  drivers/platform/chrome/cros_ec_dev.c      | 12 ++++--------
>  drivers/platform/chrome/cros_ec_lightbar.c | 13 +++++++++----
>  2 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c
> index 7c26223..b9bf086 100644
> --- a/drivers/platform/chrome/cros_ec_dev.c
> +++ b/drivers/platform/chrome/cros_ec_dev.c
> @@ -437,8 +437,7 @@ static int ec_device_probe(struct platform_device *pdev)
>  		cros_ec_sensors_register(ec);
>  
>  	/* Take control of the lightbar from the EC. */
> -	if (ec_has_lightbar(ec))
> -		lb_manual_suspend_ctrl(ec, 1);
> +	lb_manual_suspend_ctrl(ec, 1);
>  
>  	return 0;
>  
> @@ -452,8 +451,7 @@ static int ec_device_remove(struct platform_device *pdev)
>  	struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);
>  
>  	/* Let the EC take over the lightbar again. */
> -	if (ec_has_lightbar(ec))
> -		lb_manual_suspend_ctrl(ec, 0);
> +	lb_manual_suspend_ctrl(ec, 0);
>  
>  	cros_ec_debugfs_remove(ec);
>  
> @@ -472,8 +470,7 @@ static int ec_device_suspend(struct device *dev)
>  {
>  	struct cros_ec_dev *ec = dev_get_drvdata(dev);
>  
> -	if (ec_has_lightbar(ec))
> -		lb_suspend(ec);
> +	lb_suspend(ec);
>  
>  	return 0;
>  }
> @@ -482,8 +479,7 @@ static int ec_device_resume(struct device *dev)
>  {
>  	struct cros_ec_dev *ec = dev_get_drvdata(dev);
>  
> -	if (ec_has_lightbar(ec))
> -		lb_resume(ec);
> +	lb_resume(ec);
>  
>  	return 0;
>  }
> diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
> index e570c1e..fd2b047 100644
> --- a/drivers/platform/chrome/cros_ec_lightbar.c
> +++ b/drivers/platform/chrome/cros_ec_lightbar.c
> @@ -43,6 +43,7 @@ static unsigned long lb_interval_jiffies = 50 * HZ / 1000;
>   * If this is true, we won't do anything during suspend/resume.
>   */
>  static bool userspace_control;
> +static struct cros_ec_dev *ec_with_lightbar;
>  
>  static ssize_t interval_msec_show(struct device *dev,
>  				  struct device_attribute *attr, char *buf)
> @@ -384,6 +385,9 @@ int lb_manual_suspend_ctrl(struct cros_ec_dev *ec, uint8_t enable)
>  	struct cros_ec_command *msg;
>  	int ret;
>  
> +	if (ec != ec_with_lightbar)
> +		return 0;
> +
>  	msg = alloc_lightbar_cmd_msg(ec);
>  	if (!msg)
>  		return -ENOMEM;
> @@ -413,7 +417,7 @@ int lb_manual_suspend_ctrl(struct cros_ec_dev *ec, uint8_t enable)
>  
>  int lb_suspend(struct cros_ec_dev *ec)
>  {
> -	if (userspace_control)
> +	if (userspace_control || ec != ec_with_lightbar)
>  		return 0;
>  
>  	return lb_send_empty_cmd(ec, LIGHTBAR_CMD_SUSPEND);
> @@ -421,7 +425,7 @@ int lb_suspend(struct cros_ec_dev *ec)
>  
>  int lb_resume(struct cros_ec_dev *ec)
>  {
> -	if (userspace_control)
> +	if (userspace_control || ec != ec_with_lightbar)
>  		return 0;
>  
>  	return lb_send_empty_cmd(ec, LIGHTBAR_CMD_RESUME);
> @@ -606,9 +610,10 @@ static umode_t cros_ec_lightbar_attrs_are_visible(struct kobject *kobj,
>  		return 0;
>  
>  	/* Only instantiate this stuff if the EC has a lightbar */
> -	if (ec_has_lightbar(ec))
> +	if (ec_has_lightbar(ec)) {
> +		ec_with_lightbar = ec;
>  		return a->mode;
> -
> +	}
>  	return 0;
>  }
>  
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2017-06-23 22:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 16:13 [PATCH RESEND 00/13] platform/chrome: Add console debugfs, lpc and lightbar programming support Enric Balletbo i Serra
2017-05-16 16:13 ` [PATCH RESEND 01/13] mfd: cros_ec: Add helper for event notifier Enric Balletbo i Serra
2017-06-16 20:45   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 02/13] mfd: cros_ec: Add EC console read structures definitions Enric Balletbo i Serra
2017-06-16 20:47   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 03/13] mfd: cros_ec: add debugfs, console log file Enric Balletbo i Serra
2017-06-16 19:42   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 04/13] mfd: cros_ec: Add support for dumping panic information Enric Balletbo i Serra
2017-06-22 23:38   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 05/13] platform/chrome: cros_ec_lpc: Add R/W helpers to LPC protocol variants Enric Balletbo i Serra
2017-05-22 11:09   ` Lee Jones
2017-06-22 19:02   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 06/13] platform/chrome: cros_ec_lpc: Add support for mec1322 EC Enric Balletbo i Serra
2017-05-22 11:09   ` Lee Jones
2017-06-22 19:01   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 07/13] platform/chrome: cros_ec_lpc: Add support for GOOG004 ACPI device Enric Balletbo i Serra
2017-06-22 19:39   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 08/13] platform/chrome: cros_ec_lpc: Add power management ops Enric Balletbo i Serra
2017-06-22 19:46   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP events support over ACPI Enric Balletbo i Serra
2017-06-22 19:35   ` Benson Leung
2017-06-23  7:35     ` Thierry Escande
2017-06-23 17:54       ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 10/13] platform/chrome: cros_ec_lightbar - Add lightbar program feature to sysfs Enric Balletbo i Serra
2017-06-22 23:43   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 11/13] platform/chrome: cros_ec_lightbar - Control of suspend/resume lightbar sequence Enric Balletbo i Serra
2017-06-23 22:08   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 12/13] platform/chrome: cros_ec_lightbar - Add userspace lightbar control bit to EC Enric Balletbo i Serra
2017-06-23 22:12   ` Benson Leung
2017-05-16 16:13 ` [PATCH RESEND 13/13] platform/chrome: cros_ec_lightbar - Avoid I2C xfer to EC during suspend Enric Balletbo i Serra
2017-06-23 22:22   ` Benson Leung [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62f4fd24-3c4f-0e68-656b-699a028f760d@google.com \
    --to=bleung@google.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=jefferyy@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).