Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1986256imu; Fri, 14 Dec 2018 04:06:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/WWMFJFRpJmKD3Cw7sAK3P9Xv30uCn7ayMw/iNgn7NHmtVKr3WGP4PsGY3LtXe9SdD+bLVj X-Received: by 2002:a63:a611:: with SMTP id t17mr2436995pge.338.1544789201445; Fri, 14 Dec 2018 04:06:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544789201; cv=none; d=google.com; s=arc-20160816; b=nogCSTDkKY0yYM13kbyLuTQrdDpFj787wBjb/pHWoPvUgHkP0/FkOiGYVWCZHZY9Il j+XH+jVigR/qOLSsivAxTDUgF9EsCaWTUKHv70RY0iOnZbNYUj8mJroHzf4DnuAb6eYM u03CN8hl7H0t2DBGtkHrO8qB3sqEHzO7KR24bxdjlUatSImcUK44qlU/6DUzpYkaB6as hR+4LuNV1k8DmRpJDFsyGOFZvywVMh2MBmB189E9sVzIMQLtmqDX3zpxmPMlhtCnFBI9 uPCMnoQXGC/4awiItJaMUu0GA4ba2JDCzTNJAx2vaexeobWy4leRjv47B5bYOA7oQ4JD GSLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y4jOuxl8GeiLYDEdYPIPcX6/pIU+3LuTeBFtC++NuZk=; b=i0eO8vyuH2BvquLSrdtxwgdrCWvZquk4Xum7Tm73gShbCiUeDXq2sb8MD6oqCJP1TR qMV2kxGgJeUsm401a8viqcrU/ZTrBeDk+GvDW+I1MEllF3IXPJuxB+s4cJric0jm+Ed7 bs+/tNTlRvpE8PeZTeZGHJxKDop3pO51IXwiUiZF/7yGd5M40Qph17xrhxgKkwTTFN8b RQojmT/9W73e3iingucjIpaqlXuxewyHiaQlZdYt5idYWdzA5bq7lt8vZceBIuKJCZT1 mQ3FooA0P/SDE7CRWaH8R1wzNMmtv0FStRfPYaBzHQk70OiyRwH5i510QTHk7NmL12tz SQQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p82Lm1Td; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si3953071plg.390.2018.12.14.04.06.26; Fri, 14 Dec 2018 04:06: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; dkim=pass header.i=@kernel.org header.s=default header.b=p82Lm1Td; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730302AbeLNMDY (ORCPT + 99 others); Fri, 14 Dec 2018 07:03:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:46906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729773AbeLNMDW (ORCPT ); Fri, 14 Dec 2018 07:03:22 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06D382146F; Fri, 14 Dec 2018 12:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789001; bh=vgfJmKGE8L7f4+kn8Edt+q6wR/oRI9De36nVEAu0K8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p82Lm1TdwSvTvRZGbMFaf9abMYNIiLRDnHzv7yeo2gy76H4Ic+Q+vYpWl3aysUrb6 LhrkTpfSuvmQC07hxHeJd9siCiMW6OLTlYanSWyYvhhh2KHmNocSpk8Ij0kwOVJZj0 R1B1ak0y7/29Rfeho9dM0jCne1ia0UNeQasKE3Ik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Lindgren , Mark Brown , Sasha Levin Subject: [PATCH 4.19 056/142] spi: omap2-mcspi: Add missing suspend and resume calls Date: Fri, 14 Dec 2018 12:59:01 +0100 Message-Id: <20181214115749.307329891@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 91b9deefedf4c35a01027ce38bed7299605026a3 ] I've been wondering still about omap2-mcspi related suspend and resume flakeyness and looks like we're missing calls to spi_master_suspend() and spi_master_resume(). Adding those and using pm_runtime_force_suspend() and pm_runtime_force_resume() makes things work for suspend and resume and allows us to stop using noirq suspend and resume. And while at it, let's use SET_SYSTEM_SLEEP_PM_OPS to simplify things further. Signed-off-by: Tony Lindgren Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-omap2-mcspi.c | 37 +++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 508c61c669e7..e2be7da74343 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1455,13 +1455,26 @@ static int omap2_mcspi_remove(struct platform_device *pdev) /* work with hotplug and coldplug */ MODULE_ALIAS("platform:omap2_mcspi"); -#ifdef CONFIG_SUSPEND -static int omap2_mcspi_suspend_noirq(struct device *dev) +static int __maybe_unused omap2_mcspi_suspend(struct device *dev) { - return pinctrl_pm_select_sleep_state(dev); + struct spi_master *master = dev_get_drvdata(dev); + struct omap2_mcspi *mcspi = spi_master_get_devdata(master); + int error; + + error = pinctrl_pm_select_sleep_state(dev); + if (error) + dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", + __func__, error); + + error = spi_master_suspend(master); + if (error) + dev_warn(mcspi->dev, "%s: master suspend failed: %i\n", + __func__, error); + + return pm_runtime_force_suspend(dev); } -static int omap2_mcspi_resume_noirq(struct device *dev) +static int __maybe_unused omap2_mcspi_resume(struct device *dev) { struct spi_master *master = dev_get_drvdata(dev); struct omap2_mcspi *mcspi = spi_master_get_devdata(master); @@ -1472,17 +1485,17 @@ static int omap2_mcspi_resume_noirq(struct device *dev) dev_warn(mcspi->dev, "%s: failed to set pins: %i\n", __func__, error); - return 0; -} + error = spi_master_resume(master); + if (error) + dev_warn(mcspi->dev, "%s: master resume failed: %i\n", + __func__, error); -#else -#define omap2_mcspi_suspend_noirq NULL -#define omap2_mcspi_resume_noirq NULL -#endif + return pm_runtime_force_resume(dev); +} static const struct dev_pm_ops omap2_mcspi_pm_ops = { - .suspend_noirq = omap2_mcspi_suspend_noirq, - .resume_noirq = omap2_mcspi_resume_noirq, + SET_SYSTEM_SLEEP_PM_OPS(omap2_mcspi_suspend, + omap2_mcspi_resume) .runtime_resume = omap_mcspi_runtime_resume, }; -- 2.19.1