Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753397AbdHKOYo (ORCPT ); Fri, 11 Aug 2017 10:24:44 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48489 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752765AbdHKOXN (ORCPT ); Fri, 11 Aug 2017 10:23:13 -0400 From: Thierry Escande To: Benson Leung , Lee Jones , Jonathan Cameron Cc: Joseph Lo , Gwendal Grignou , Douglas Anderson , Daniel Hung-yu Wu , Vincent Palatin , Wei-Ning Huang , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH v2 4/8] platform/chrome: cros_ec: register shutdown function for debugfs Date: Fri, 11 Aug 2017 16:23:01 +0200 Message-Id: <1502461385-27564-5-git-send-email-thierry.escande@collabora.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502461385-27564-1-git-send-email-thierry.escande@collabora.com> References: <1502461385-27564-1-git-send-email-thierry.escande@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset = "utf-8" Content-Transfert-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1335 Lines: 44 From: Daniel Hung-yu Wu 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. Signed-off-by: Daniel Hung-yu Wu Signed-off-by: Thierry Escande --- 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 2571f5e..225d8e9 100644 --- a/drivers/platform/chrome/cros_ec_dev.c +++ b/drivers/platform/chrome/cros_ec_dev.c @@ -460,6 +460,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 */ }, @@ -502,6 +510,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.7.4