Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2534221yba; Mon, 6 May 2019 07:37:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrPiFyHIAC5XvapGL3TEXUeI/4oLTUK9oIdc/Dn19R9CPmEHq6NLf3lm22AkpN16s+LVVo X-Received: by 2002:a62:69c2:: with SMTP id e185mr33566263pfc.119.1557153457030; Mon, 06 May 2019 07:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153457; cv=none; d=google.com; s=arc-20160816; b=Y5zSa3s+RiUfNW5ydSqQegZo4bN+fPmaSeUq+ZFTMdKRi2uynztw6+xY4ItP8mCpUC WgfYLdS7fb1C/QZ9zhulvKUdaBPX3MbnKy/Psk89viROnu1pepohA2znZdjb0s+2oa5q u1vEkb2OqFBfzVQ7ecMj/V61EL3ZW8x6jEeKSDG97L9N1mSVAUWL6B4X2Nzh+S1P66QT if6OnwHuEQxNllK5xOJBvOUXsdHYzjQ/Dd7Ajq0+KAxxyobgCebz7fS4WugHMUjpaOcm eBbSGHIfU8ypIzvCJ+5sM5ccDFxFVMpgfgDbAALxoGbNmQ+YoZ/eQALMwIvy//9hp5ZS jlhg== 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=jQT5fk5dX9Rtac6RuO3hH0/ji0O5tJWwQT8+ENM+YE8=; b=CDbnwE1bDLR+SFSRhszfnVE1x2zuWV9Tb8VIjWf0rEvs8Da66nmfT2l2GYpNGneCU9 6ODlXpXVckvbr4GmBmCbb6JrWnXUzx1EpIbKBw/Dk7Gaa4ekz5AXRyxyXNCT5Uf65Sta +Y2taoUzmTRR2QmkaArpY1iMKqlW34iiHwHOcxEsJWkNhlxusVc0BDbU0aBeGIr4o3o+ /30xV4E9j8vu2iDPFPZbTItPAJbXpn0pfVo0N0KfoCf/QByLndhyUklaU9rAeZovKTy+ S0TfgpDoek4/Zlbxxs9vvipuaa8LljU8/JhoWZdFjrH1AWaiYgA2V2xMcHM1W/7GuG8o ZrIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ggR59tEC; 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 d138si14803508pfd.178.2019.05.06.07.37.21; Mon, 06 May 2019 07:37:37 -0700 (PDT) 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=ggR59tEC; 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 S1726709AbfEFOej (ORCPT + 99 others); Mon, 6 May 2019 10:34:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:54364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726699AbfEFOeh (ORCPT ); Mon, 6 May 2019 10:34:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 B5F6921019; Mon, 6 May 2019 14:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153277; bh=mM1dMY4wEQFHJP5ZF0f4aj7mhZdeDuWVVaAbt1qSCq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggR59tEC3sACZyIHZclP7J5neyG2FuBnOcCVioA+wdct/6pGh971kZ4J2cgHjnyL1 tAc443aVQmLp9e4o+zobno9cMK52EdHgRZKvm4d+B6OZlk5/vSGxNX4f0IftHFGNOO L44hXNNR9kPZ5njuwjj9ZTdkgfu7zY7yYrFO/JYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Enric Balletbo i Serra , Evan Green , Benson Leung , Guenter Roeck , Stephen Boyd , Alexandre Belloni , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 029/122] rtc: cros-ec: Fail suspend/resume if wake IRQ cant be configured Date: Mon, 6 May 2019 16:31:27 +0200 Message-Id: <20190506143057.381838909@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit d6752e185c3168771787a02dc6a55f32260943cc ] If we encounter a failure during suspend where this RTC was programmed to wakeup the system from suspend, but that wakeup couldn't be configured because the system didn't support wakeup interrupts, we'll run into the following warning: Unbalanced IRQ 166 wake disable WARNING: CPU: 7 PID: 3071 at kernel/irq/manage.c:669 irq_set_irq_wake+0x108/0x278 This happens because the suspend process isn't aborted when the RTC fails to configure the wakeup IRQ. Instead, we continue suspending the system and then another suspend callback fails the suspend process and "unwinds" the previously suspended drivers by calling their resume callbacks. When we get back to resuming this RTC driver, we'll call disable_irq_wake() on an IRQ that hasn't been configured for wake. Let's just fail suspend/resume here if we can't configure the system to wake and the user has chosen to wakeup with this device. This fixes this warning and makes the code more robust in case there are systems out there that can't wakeup from suspend on this line but the user has chosen to do so. Cc: Enric Balletbo i Serra Cc: Evan Green Cc: Benson Leung Cc: Guenter Roeck Signed-off-by: Stephen Boyd Acked-By: Benson Leung Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin (Microsoft) --- drivers/rtc/rtc-cros-ec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c index e5444296075e..4d6bf9304ceb 100644 --- a/drivers/rtc/rtc-cros-ec.c +++ b/drivers/rtc/rtc-cros-ec.c @@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev) struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); if (device_may_wakeup(dev)) - enable_irq_wake(cros_ec_rtc->cros_ec->irq); + return enable_irq_wake(cros_ec_rtc->cros_ec->irq); return 0; } @@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev) struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev); if (device_may_wakeup(dev)) - disable_irq_wake(cros_ec_rtc->cros_ec->irq); + return disable_irq_wake(cros_ec_rtc->cros_ec->irq); return 0; } -- 2.20.1