Skip to contentSkip to conversation

CHROMIUM: ec: register shutdown function to clear delayed works

PATCH New Daniel Hung-yu Wu 1 participant 1 message Nov 2, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CHROMIUM: ec: register shutdown function to clear delayed works

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

---
 drivers/platform/chrome/cros_ec_dev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/platform/chrome/cros_ec_dev.c +9 -0
index 7d51f69..137c0ce 100644
@@ -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)
Signature · 1 line
2.8.0.rc3.226.g39d4020