Received: by 10.223.185.116 with SMTP id b49csp3581150wrg; Mon, 26 Feb 2018 02:28:41 -0800 (PST) X-Google-Smtp-Source: AG47ELvrgmzyQTlaxd9M2+05b5pSV5X23W075NR2PyDLoO5bBu0UfRLbJUO+/2crLxPhANVlHs3u X-Received: by 2002:a17:902:4827:: with SMTP id s36-v6mr4594213pld.269.1519640921129; Mon, 26 Feb 2018 02:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519640921; cv=none; d=google.com; s=arc-20160816; b=GiLIjT9D8PoG2JFMJR9d1xErW9r/8SR7WWEkeG1Jc8e2kRo4tGUZ3tRPszJyt/YBRL dY1jkGUSLwLn5EMvTTonAxX26SAvQYd7HfveEOLkjEKLzgkC/8cP1sXZARuamBwBvayO bjtihJ4j017Z0HMMVdLAq7r0BV/A2tPPzwFjsELyxazxkQO32YF0hya5rnbIQ5xDDDIP XCHRSV1uwqAj9ajpEqZQHT+uLxt8gomtJcIaOG0HLJDcUNzaBUwBMhWb6fBbSlJeVriz Ui92Ua8kDkgrzVsEjElszKi9eAWJDNzMjtSXuSInlLw01vsSS1coENcj+h7RxMqOnbTv iRWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZeFQ2JkRPI9CafWqUjPpSiLLbzs2KR0FcXpBgYwkmQI=; b=wBlLYACGiZXCuombDDYSYejyx7n0wBpm2Z3v5gXHrcObho3019+Woa1nJGRg++wB73 fDlluJbtFY0QX9h4cyLa2XzM+bg57kO2eqxnBOVGALMBAqcPS8jgzFNDJ8AnptYzpv5O 0cCMgXCPN2bd+jN4IQ3m6Yx5astQBdwypPWc/Dfiakd9WgWfys07FcWcO7IDoeQqtOTF EOyJCDfdZGTX8cYe/eNQm5PbvUoFcP6p7XUL7qWyOa8y22ZdNbz2ENhuFoNQr4BiViQC OHbQ5uS31GkTbB/hVRLtyVaZTdrcYIrtz0eEn75XkUC5x7vPCsLM7bWUek1/HnilCh5T VDFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si6558218pfl.127.2018.02.26.02.28.27; Mon, 26 Feb 2018 02:28:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752671AbeBZK0Z (ORCPT + 99 others); Mon, 26 Feb 2018 05:26:25 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48336 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbeBZK0R (ORCPT ); Mon, 26 Feb 2018 05:26:17 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id CC0F8277268 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, Douglas Anderson , Benson Leung , Olof Johansson Subject: [PATCH v3 3/8] mfd: cros_ec: Don't try to grab log when suspended Date: Mon, 26 Feb 2018 11:26:01 +0100 Message-Id: <20180226102606.15093-4-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180226102606.15093-1-enric.balletbo@collabora.com> References: <20180226102606.15093-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson We should stop our worker thread while we're suspended. If we don't then we'll get messages like: cros-ec-spi spi5.0: spi transfer failed: -108 cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108 cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed Signed-off-by: Douglas Anderson Signed-off-by: Enric Balletbo i Serra Reviewed-by: Andy Shevchenko --- Changes in v3: - [3/8] Add Reviewed-by Andy Shevchenko. Changes in v2: - [3/8] That patch is new in this series. drivers/mfd/cros_ec_dev.c | 4 ++++ drivers/platform/chrome/cros_ec_debugfs.c | 20 ++++++++++++++++++++ include/linux/mfd/cros_ec.h | 2 ++ 3 files changed, 26 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index e4fafdd96e5e..f98e5beffca6 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -471,6 +471,8 @@ static __maybe_unused int ec_device_suspend(struct device *dev) { struct cros_ec_dev *ec = dev_get_drvdata(dev); + cros_ec_debugfs_suspend(ec); + lb_suspend(ec); return 0; @@ -480,6 +482,8 @@ static __maybe_unused int ec_device_resume(struct device *dev) { struct cros_ec_dev *ec = dev_get_drvdata(dev); + cros_ec_debugfs_resume(ec); + lb_resume(ec); return 0; diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index 0e88e18362c1..0328856ec3a2 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -398,3 +398,23 @@ void cros_ec_debugfs_remove(struct cros_ec_dev *ec) cros_ec_cleanup_console_log(ec->debug_info); } EXPORT_SYMBOL(cros_ec_debugfs_remove); + +void cros_ec_debugfs_suspend(struct cros_ec_dev *ec) +{ + /* + * cros_ec_debugfs_init() failures are non-fatal; it's also possible + * that we initted things but decided that console log wasn't supported. + * We'll use the same set of checks that cros_ec_debugfs_remove() + + * cros_ec_cleanup_console_log() end up using to handle those cases. + */ + if (ec->debug_info && ec->debug_info->log_buffer.buf) + cancel_delayed_work_sync(&ec->debug_info->log_poll_work); +} +EXPORT_SYMBOL(cros_ec_debugfs_suspend); + +void cros_ec_debugfs_resume(struct cros_ec_dev *ec) +{ + if (ec->debug_info && ec->debug_info->log_buffer.buf) + schedule_delayed_work(&ec->debug_info->log_poll_work, 0); +} +EXPORT_SYMBOL(cros_ec_debugfs_resume); diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index c61535979b8f..804b3ddbf819 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -325,6 +325,8 @@ extern struct attribute_group cros_ec_vbc_attr_group; /* debugfs stuff */ int cros_ec_debugfs_init(struct cros_ec_dev *ec); void cros_ec_debugfs_remove(struct cros_ec_dev *ec); +void cros_ec_debugfs_suspend(struct cros_ec_dev *ec); +void cros_ec_debugfs_resume(struct cros_ec_dev *ec); /* ACPI GPE handler */ #ifdef CONFIG_ACPI -- 2.16.1