From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbeDELd6 (ORCPT ); Thu, 5 Apr 2018 07:33:58 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:33966 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751603AbeDELdY (ORCPT ); Thu, 5 Apr 2018 07:33:24 -0400 From: Enric Balletbo i Serra To: lee.jones@linaro.org Cc: groeck@chromium.org, andy.shevchenko@gmail.com, kernel@collabora.com, gwendal@chromium.org, linux-kernel@vger.kernel.org, Daniel Hung-yu Wu , Daniel Hung-yu Wu Subject: [PATCH v5 6/8] mfd: cros_ec_dev: register shutdown function for debugfs Date: Thu, 5 Apr 2018 13:33:11 +0200 Message-Id: <20180405113313.27340-7-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180405113313.27340-1-enric.balletbo@collabora.com> References: <20180405113313.27340-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Enric Balletbo i Serra Reviewed-by: Andy Shevchenko Acked-by: Lee Jones --- Changes in v5: None Changes in v4: - [6/8] Add Acked-by Lee Jones. Changes in v3: - [6/8] Add the Reviewed-by Andy Shevchenko. Changes in v2: - [6/8] This patch is new in this series. drivers/mfd/cros_ec_dev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index 535ffa3cf497..8f51b115f478 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -543,6 +543,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 */ }, @@ -585,6 +593,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.16.3