All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Hung-yu Wu <hywu@google.com>
To: Olof Johansson <olof@lixom.net>, Lee Jones <lee.jones@linaro.org>
Cc: hywu@chromium.org, drinkcat@chromium.org, kyan@chromium.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] CHROMIUM: ec: register shutdown function to clear delayed works
Date: Wed, 2 Nov 2016 15:36:56 +0800	[thread overview]
Message-ID: <20161102073653.GA5351@google.com> (raw)

This patch applies on top of "mfd: cros_ec: Add EC console read structures
definitions" (https://patchwork.kernel.org/patch/9294887/).

Reboot or shutdown during delayed works could corrupt
communication with EC, and certain I2C controller may not
be able to recover from the error state.

BUG=chrome-os-partner:58823
TEST=factory run-in test for 200+ times

Signed-off-by: Daniel Hung-yu Wu <hywu@chromium.org>
---
 drivers/platform/chrome/cros_ec_dev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c
index 7d51f69..137c0ce 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/platform/chrome/cros_ec_dev.c
@@ -308,6 +308,14 @@ static int ec_device_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void ec_device_shutdown(struct platform_device *pdev)
+{
+	struct cros_ec_dev *ec = dev_get_drvdata(&pdev->dev);
+
+	/* Be sure to clear up debugfs delayed works */
+	cros_ec_debugfs_remove(ec);
+}
+
 static const struct platform_device_id cros_ec_id[] = {
 	{ "cros-ec-ctl", 0 },
 	{ /* sentinel */ },
@@ -320,6 +328,7 @@ static struct platform_driver cros_ec_dev_driver = {
 	},
 	.probe = ec_device_probe,
 	.remove = ec_device_remove,
+	.shutdown = ec_device_shutdown,
 };
 
 static int __init cros_ec_dev_init(void)
-- 
2.8.0.rc3.226.g39d4020

             reply	other threads:[~2016-11-02  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  7:36 Daniel Hung-yu Wu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-10-24  7:53 [PATCH] CHROMIUM: ec: register shutdown function to clear delayed works Daniel Hung-yu Wu
2016-10-26 14:04 ` Lee Jones
2016-10-26 14:22   ` Lee Jones
2016-11-02  7:59     ` Daniel Hung-yu Wu

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=20161102073653.GA5351@google.com \
    --to=hywu@google.com \
    --cc=drinkcat@chromium.org \
    --cc=hywu@chromium.org \
    --cc=kyan@chromium.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.