Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709069 > unrolled thread

[PATCH 3/8] mfd: cros_ec: Stop the debugfs work when suspended

Started byThierry Escande <thierry.escande@collabora.com>
First post2017-08-11 00:20 +0200
Last post2017-08-11 06:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/8] mfd: cros_ec: Stop the debugfs work when suspended Thierry Escande <thierry.escande@collabora.com> - 2017-08-11 00:20 +0200
    Re: [PATCH 3/8] mfd: cros_ec: Stop the debugfs work when suspended Benson Leung <bleung@google.com> - 2017-08-11 06:00 +0200

#1709069 — [PATCH 3/8] mfd: cros_ec: Stop the debugfs work when suspended

FromThierry Escande <thierry.escande@collabora.com>
Date2017-08-11 00:20 +0200
Subject[PATCH 3/8] mfd: cros_ec: Stop the debugfs work when suspended
Message-ID<ud3Y5-3tF-15@gated-at.bofh.it>
From: Douglas Anderson <dianders@chromium.org>

This patch stops the debugfs worker thread when the device is suspended.
This change avoids messages like:

  cros-ec-spi spi5.0: spi transfer failed: -108
  cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108
  cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
---
 drivers/platform/chrome/cros_ec_debugfs.c | 18 ++++++++++++++++++
 drivers/platform/chrome/cros_ec_debugfs.h |  2 ++
 drivers/platform/chrome/cros_ec_dev.c     |  4 ++++
 3 files changed, 24 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 4cc66f4..515f411 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -399,3 +399,21 @@ void cros_ec_debugfs_remove(struct cros_ec_dev *ec)
 	debugfs_remove_recursive(ec->debug_info->dir);
 	cros_ec_cleanup_console_log(ec->debug_info);
 }
+
+void cros_ec_debugfs_suspend(struct cros_ec_dev *ec)
+{
+	/*
+	 * cros_ec_debugfs_init() failures are non-fatal; it's also possible
+	 * that we initted things but decided that console log wasn't supported.
+	 * We'll use the same set of checks that cros_ec_debugfs_remove() +
+	 * cros_ec_cleanup_console_log() end up using to handle those cases.
+	 */
+	if (ec->debug_info && ec->debug_info->log_buffer.buf)
+		cancel_delayed_work_sync(&ec->debug_info->log_poll_work);
+}
+
+void cros_ec_debugfs_resume(struct cros_ec_dev *ec)
+{
+	if (ec->debug_info && ec->debug_info->log_buffer.buf)
+		schedule_delayed_work(&ec->debug_info->log_poll_work, 0);
+}
diff --git a/drivers/platform/chrome/cros_ec_debugfs.h b/drivers/platform/chrome/cros_ec_debugfs.h
index 1ff3a50..d29e410 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.h
+++ b/drivers/platform/chrome/cros_ec_debugfs.h
@@ -23,5 +23,7 @@
 /* debugfs stuff */
 int cros_ec_debugfs_init(struct cros_ec_dev *ec);
 void cros_ec_debugfs_remove(struct cros_ec_dev *ec);
+void cros_ec_debugfs_suspend(struct cros_ec_dev *ec);
+void cros_ec_debugfs_resume(struct cros_ec_dev *ec);
 
 #endif  /* _DRV_CROS_EC_DEBUGFS_H_ */
diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c
index cf6c4f0..2571f5e 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/platform/chrome/cros_ec_dev.c
@@ -470,6 +470,8 @@ static __maybe_unused int ec_device_suspend(struct device *dev)
 {
 	struct cros_ec_dev *ec = dev_get_drvdata(dev);
 
+	cros_ec_debugfs_suspend(ec);
+
 	lb_suspend(ec);
 
 	return 0;
@@ -481,6 +483,8 @@ static __maybe_unused int ec_device_resume(struct device *dev)
 
 	lb_resume(ec);
 
+	cros_ec_debugfs_resume(ec);
+
 	return 0;
 }
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1709228

FromBenson Leung <bleung@google.com>
Date2017-08-11 06:00 +0200
Message-ID<ud9h7-6MB-5@gated-at.bofh.it>
In reply to#1709069

[Multipart message — attachments visible in raw view] — view raw

Hi Thierry,

On Fri, Aug 11, 2017 at 12:16:45AM +0200, Thierry Escande wrote:
> From: Douglas Anderson <dianders@chromium.org>
> 
> This patch stops the debugfs worker thread when the device is suspended.
> This change avoids messages like:
> 
>   cros-ec-spi spi5.0: spi transfer failed: -108
>   cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108
>   cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Thierry Escande <thierry.escande@collabora.com>

Looks good. Applied.

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web