Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp688232yba; Wed, 24 Apr 2019 08:04:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaiIE8knTmG94YiKRyK9wteRuUcExx8rs2CGq0Rz7b1pvkKpEG39zM+4VXYWGHrsTUZQAF X-Received: by 2002:a63:cd50:: with SMTP id a16mr12342388pgj.394.1556118249173; Wed, 24 Apr 2019 08:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556118249; cv=none; d=google.com; s=arc-20160816; b=mPrqmz4v2VKZb1lzGq3rKHqSbCdWByQtGBDC+DMGy3ehJ/zrI06ZcOgqYAqWZGKjyy e1iM4pTVbzYyYuUAWw3E7JdKWQkZRDKfzwDY1Kh+atF2NI+JGgoINGEvRKZSosXDu6Iv r2496U55iwvxcdPSPBCKvIY8MlqeObIySKgQgyIG/ucnYVHZGqwT5vxnZxQnKyHiB4KS iq2Bsies1bMBx78zNgJebCur9Vi7LhQfdNGk8+7ubgPISKTqlkHKvxNHchCR73AkufFu R+CBw2zx1kOir/Jx+HGstnZIP8UbsR55n+PXRX56DBKt4ZwZPCvAAUQOarxCztmr0S4a r0dQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1BNbVVlUHJJIcOXsIb2LzcpKTSDsV3tbbKiFGT6l3zU=; b=DHYt4+rtPNFWxTBKWP9X5zcBgsPp7dL4e6aDk3mN1h+rd9+H9d0ylv77tYwIVzAo1H u3B/smrDEn8PXog0k5mvoNilQBaCpzzwK9ouR3gh5xioO8gke0nL1BdeYo3QGFkp1I8L +Hu4IVKbji9ZZl3OKpNax1uPuG5lpTY0FwFLfuIrj2SDIyyii7nowtSCqnRsjeBG2cfa 0qlXosJnuDtBouenQg2nv1AxcHubLvsBz1OtskEWF2ekVMmTWBtnhPMrqXaWoHh/R2do 5xfnu0no18FOIa0ODZNBOaEyDtCnpg3nFLcv1cm53I+vg2YOvzr7g+whbJPTZWv08wYX nhxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O1+mvSsk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si18565960pll.132.2019.04.24.08.03.52; Wed, 24 Apr 2019 08:04:09 -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=O1+mvSsk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730744AbfDXOd5 (ORCPT + 99 others); Wed, 24 Apr 2019 10:33:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:37852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730687AbfDXOdz (ORCPT ); Wed, 24 Apr 2019 10:33:55 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 370552089F; Wed, 24 Apr 2019 14:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556116434; bh=D5foliqRf+QYmfVkErUvdWWa6s5sVbXIsFXb9JvYSLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O1+mvSskfruZXEpBj+i30C4dFZRwgXFQn7gRr3Soo6YlOcCNCSjcjGaUZrUMUrgRV 2FlKpaNhKIWUDtkJCyGUaotT34L9zUg/3F/jKoYUu6OfnEAf5jUxHPIAtvikJiNkDB SfXYCO5a03XLmAkMNqqFg7pJh4DbwWgv+qX7zdRc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephen Boyd , Enric Balletbo i Serra , Evan Green , Benson Leung , Guenter Roeck , Alexandre Belloni , Sasha Levin , linux-rtc@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 05/66] rtc: cros-ec: Fail suspend/resume if wake IRQ can't be configured Date: Wed, 24 Apr 2019 10:32:39 -0400 Message-Id: <20190424143341.27665-5-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190424143341.27665-1-sashal@kernel.org> References: <20190424143341.27665-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd [ 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.19.1