Skip to contentSkip to conversation

mfd: cros_ec: register shutdown function for debugfs

PATCH New Benson Leung 1 participant 1 message Dec 16, 2017

Subsystems (2)
lore
Share & tools
lore

Benson Leung

author maintainer
#0 lore raw

PATCH 1/1 mfd: cros_ec: register shutdown function for debugfs

From: Daniel Hung-yu Wu <[email protected]>

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.

This patch registers a shutdown callback used to cancel the debugfs log worker thread.

[resent this patch after rename of this file from platform/chrome to
mfd]

---
 drivers/mfd/cros_ec_dev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mfd/cros_ec_dev.c +9 -0
index e4fafdd96e5e..065666182ba2 100644
@@ -461,6 +461,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[] = {
 	{ DRV_NAME, 0 },
 	{ /* sentinel */ },
@@ -499,6 +507,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.15.1.504.g5279b80103-goog