From patchwork Tue Jun 19 23:43:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 10475637 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B9BE60353 for ; Tue, 19 Jun 2018 23:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23AC728C77 for ; Tue, 19 Jun 2018 23:45:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1708328C85; Tue, 19 Jun 2018 23:45:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91A0328C77 for ; Tue, 19 Jun 2018 23:45:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbeFSXpc (ORCPT ); Tue, 19 Jun 2018 19:45:32 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:37717 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949AbeFSXpa (ORCPT ); Tue, 19 Jun 2018 19:45:30 -0400 Received: by mail-pl0-f68.google.com with SMTP id 31-v6so685666plc.4 for ; Tue, 19 Jun 2018 16:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=PM+MBg+PKev5Z1ZTi5puF0pkUcxiOjDvmt3X5LHlR9w=; b=b83M8Ic041H2zo+yF5A5lgQnMfsfhaHZRI+hBJcEkBnQ9rwL8q1awdJ9tUz9t9uO/9 AQAxoH8u6TUJKL9z0OtAP0xv4VZ82H1ErEdt4tUL42Bcfuws0YDcnKJjQfVR4rZdJzZM yC5o38nNu20JEjnnKPZSarhABPBnvJtF8yi1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PM+MBg+PKev5Z1ZTi5puF0pkUcxiOjDvmt3X5LHlR9w=; b=XtpjxiYBqrPMLpjD/O4P3tWrdVsjrJnCOsjeEatX9elMCz+x8RYTY9p0U+/FzmlfKr 00C/x8mHMFQTQjU1XhD5HIHUoVD2yar2vPPXSVGijj7rhRRSf2PjKXHF05iUdmearXSg GJ1HCJQJj79CvlZ9cHyvxDthCCUkSBsxkTgnmckPyueH/M0iOhEzsEcMuH4+MjG+R41o wjxF/0DdEaHiaEKdwxxA688EmPWmt7Bz80RGT/dW0HzKYwYCNYExWBG/VXQOcnvbohNo DEI4ejAthwI0SxzyO5LCZPRccesBSyxzRXAODL5f6u6VafRZL2101DLJK2l7lMp9/yZb 3LEQ== X-Gm-Message-State: APt69E2Kfv1wvCaGDF8gjbBKM6Cm4aG93up+3xQmOktLcMt21Iax2MuR C0oYAlAB1Xrg+0cTFwfh1Sw/AA== X-Google-Smtp-Source: ADUXVKKfA51c6UKzO6TOfETeWg3VmCkAsoyywakvsyXvr7zsLo+4UNfm/+y3fk6VrQHz+xZKbzmZkg== X-Received: by 2002:a17:902:d716:: with SMTP id w22-v6mr20936100ply.98.1529451930048; Tue, 19 Jun 2018 16:45:30 -0700 (PDT) Received: from evgreen2.mtv.corp.google.com ([2620:0:1000:1511:116f:8bf3:133b:f7fd]) by smtp.gmail.com with ESMTPSA id n85-v6sm987973pfa.146.2018.06.19.16.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jun 2018 16:45:28 -0700 (PDT) From: Evan Green To: Bjorn Andersson , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: swboyd@chromium.org, Evan Green Subject: [PATCH] pinctrl: msm: Pass along set_wake failures Date: Tue, 19 Jun 2018 16:43:49 -0700 Message-Id: <20180619234349.166190-1-evgreen@chromium.org> X-Mailer: git-send-email 2.13.5 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The MSM pinctrl driver quietly swallows errors that occur when trying to call .irq_set_wake. It should instead pass those failures up the chain so the caller can react to them. Swallowing the error for instance causes gpio_keys to think that it was able to successfully set a wake IRQ, when in fact it may not have been, causing the following warning on resume: [ 53.777819] Unbalanced IRQ 9 wake disable [ 53.781979] WARNING: CPU: 0 PID: 1362 at kernel/irq/manage.c:623 irq_set_irq_wake+0xac/0x12c [ 53.794758] Modules linked in: spi_gpio spi_bitbang qcom_q6v5_pil qcom_common cfg80211 ip6table_filter smsc95xx usbnet mii [ 54.016419] [] irq_set_irq_wake+0xac/0x12c [ 54.022252] [] msm_gpio_irq_set_wake+0x48/0x68 [ 54.028447] [] set_irq_wake_real+0x50/0x5c [ 54.034275] [] irq_set_irq_wake+0xcc/0x12c [ 54.040104] [] gpio_keys_resume+0x74/0xd8 [ 54.045846] [] platform_pm_resume+0x54/0x60 [ 54.051771] [] dpm_run_callback+0x104/0x210 [ 54.057694] [] device_resume+0x178/0x1b0 [ 54.063355] [] dpm_resume+0x1c4/0x38c [ 54.068745] [] dpm_resume_end+0x20/0x34 [ 54.074315] [] suspend_devices_and_enter+0x518/0x964 [ 54.081044] [] pm_suspend+0x690/0x6e0 [ 54.086433] [] state_store+0xd4/0xf8 [ 54.091733] [] kobj_attr_store+0x18/0x28 [ 54.097396] [] sysfs_kf_write+0x5c/0x68 [ 54.102961] [] kernfs_fop_write+0x174/0x1b8 [ 54.108887] [] __vfs_write+0x58/0x160 [ 54.114276] [] vfs_write+0xcc/0x184 [ 54.119487] [] SyS_write+0x64/0xb4 Signed-off-by: Evan Green --- drivers/pinctrl/qcom/pinctrl-msm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index 0e22f52b2a19..d48a74ddbc1f 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -779,14 +779,15 @@ static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct msm_pinctrl *pctrl = gpiochip_get_data(gc); unsigned long flags; + int rc; raw_spin_lock_irqsave(&pctrl->lock, flags); - irq_set_irq_wake(pctrl->irq, on); + rc = irq_set_irq_wake(pctrl->irq, on); raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return 0; + return rc; } static void msm_gpio_irq_handler(struct irq_desc *desc)