Message ID | 20240228020040.25815-1-qingliang.li@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84397-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3084183dyb; Tue, 27 Feb 2024 18:01:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhHjnGcXUJs2eHAV8yNFaRtcyynC6w1Ju9jeorbErU8NVU1ZKRvbdPW18OB69LgEv4wBz+7OCt8RStVSbyyaJ3GV199Q== X-Google-Smtp-Source: AGHT+IFLulATpGvsJTaiohb/gRYNai9YLerAyYbcP2bgbMXfT8D+7y2rf4gUbQcYyjG20KRfD2OM X-Received: by 2002:a17:903:41c4:b0:1db:ecf1:3b83 with SMTP id u4-20020a17090341c400b001dbecf13b83mr1277965ple.23.1709085691045; Tue, 27 Feb 2024 18:01:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709085691; cv=pass; d=google.com; s=arc-20160816; b=ZCMtA2br1GlcfR1uBArF03d6ZZqdaZhSepqF5xbouHcBZxRiDzB94hXK9KIZcXh4NY 1X5g9/uKyJ/KpR5lRvDAz/u+zuHx6FY4xbktkBlcAvuEza2m8ZGchtvoMEidLZM0CLUz 7kFluCU80kmsylflwKVA8XhXrvG5JjOUIh0RXy+Ev69V01XC7yh5QC6Xs1eKy60BLvhD wGo7l0JyAorrjElfierUXPBDnct2/kNAgbOn9sigMauNTmhjHGrWUqlwA6Yij34q/tLE 7Ksd58ACUXcK8aAEsx/224BcROk7Vb78PvmYrs+lnESYI3q3LM8l4IbpBa49GbmeCSwe zsow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ps+ctjgSHlaJ48jdpOUAWUiCS3YICM9/AZhDjh4oT8Q=; fh=OLM581R7CDLLgThkYJDlKr/X2rYQqoO4/P8lj/b1mqs=; b=OVymY3K4xRADb2USRvLZiLKxIbcvkDEi2M/M8htljcWyJxgf9OvXY1++lUXSpx8yFO Jwp60LBnGV7/aC5L/yp2Pcrg4JObXaIp5NjrSoBzCR3vb3jFr/kg+oLey2xd+KGlktnJ gNtJjHTQOeq1SYvWpsEwCa31HW3/sC2c6udkB6FjzJTbaMZipfBpuGI9zi18x+GrX+hE JrZpTpZ3k2zaOY4JPBRSeLni/Y5C1WcQcucTmo0lhIVA6NoSfABNtxYJaxwoCFPNOqNJ FsaAPsNmSKhloA56L+PWiOPUuD9oGb+7HKrrmeO5P4weIdSvyosE/75xoLXbfLF7l0sy jUYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=se3mPeBI; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-84397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84397-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g4-20020a170902740400b001d8f2354fdfsi2357421pll.87.2024.02.27.18.01.30 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 18:01:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=se3mPeBI; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-84397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84397-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D5F2B28D50E for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 02:01:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4687D1D53C; Wed, 28 Feb 2024 02:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="se3mPeBI" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 754AB2107; Wed, 28 Feb 2024 02:00:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709085653; cv=none; b=JEU+Ykrk98pUDp4+CyAH/DDl5tqcDooJnRHSLvCa/CRUJQpYiHYyrYXnp/geRkHNkYjUW4xOvOl5Z1Dsa+FjjI+YFc2nioVLdhtdNL8HTcHPhtgb96UK+nKgHkmMF5v9Lw57Oeu35XRwP3dd9Rgq53Xu/3W55YQga6H1toXTTIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709085653; c=relaxed/simple; bh=KxH+FSKqPnen96UL7oC2xIPLR9KE5bLwWqMqNe1vbh4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ropg1tOCKwVZ/p+0Ngesf5efHlc7bw1t2eJCZvN0Py0g5yBpHrZOyaqt1kLE44cijDPj7GnVX8i9Tz6IJckYAeXPjyDiQZ/2ME9B7iAs8p6Q/akJ9BYOpozGEs7qlyyAP1rh23kykQMuHmM2e0lltKfXaW9f5/JyZh92vmpDquE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=se3mPeBI; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 2f72af6ad5dd11ee935d6952f98a51a9-20240228 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=ps+ctjgSHlaJ48jdpOUAWUiCS3YICM9/AZhDjh4oT8Q=; b=se3mPeBIF+PqBgOAxPuFZkNwfjcE8pqrOpefA1S7oaRR6MrD2V8ghgdm6q36NWfIcH6M1qbuvQ3ihY2SEpCmf8RNdzt/CuKrST/mnsusTngh4tV+Fqf9UgAqrvQI12zPllEghGwV2Nx9h0D2KVGjIz+FaxxYNW2JBdGOWlqb/1I=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:bcae47ab-630f-484c-8287-b5ed9edab26c,IP:0,U RL:0,TC:0,Content:0,EDM:-30,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-30 X-CID-META: VersionHash:6f543d0,CLOUDID:95876484-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:2,IP:nil,UR L:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES: 1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 2f72af6ad5dd11ee935d6952f98a51a9-20240228 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from <qingliang.li@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 386241137; Wed, 28 Feb 2024 10:00:45 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 28 Feb 2024 10:00:44 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 28 Feb 2024 10:00:43 +0800 From: Qingliang Li <qingliang.li@mediatek.com> To: "Rafael J . Wysocki" <rafael@kernel.org>, Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Johan Hovold <johan+linaro@kernel.org>, Tony Lindgren <tony@atomide.com> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, Qingliang Li <qingliang.li@mediatek.com> Subject: [PATCH] PM: wakeirq: fix wake irq warning in system suspend stage Date: Wed, 28 Feb 2024 10:00:40 +0800 Message-ID: <20240228020040.25815-1-qingliang.li@mediatek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792106237749449117 X-GMAIL-MSGID: 1792106237749449117 |
Series |
PM: wakeirq: fix wake irq warning in system suspend stage
|
|
Commit Message
Qingliang Li
Feb. 28, 2024, 2 a.m. UTC
When driver registers the wake irq with reverse enable ordering,
the wake irq will be re-enabled when entering system suspend, triggering
an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be
enabled in both dev_pm_enable_wake_irq_complete() and dev_pm_arm_wake_irq()
To fix this issue, complete the setting of WAKE_IRQ_DEDICATED_ENABLED flag
in dev_pm_enable_wake_irq_complete() to avoid redundant irq enablement.
Fixes: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming")
Signed-off-by: Qingliang Li <qingliang.li@mediatek.com>
---
drivers/base/power/wakeirq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
Hi, On 28/02/24 07:30, Qingliang Li wrote: > When driver registers the wake irq with reverse enable ordering, > the wake irq will be re-enabled when entering system suspend, triggering > an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be > enabled in both dev_pm_enable_wake_irq_complete() and dev_pm_arm_wake_irq() > > To fix this issue, complete the setting of WAKE_IRQ_DEDICATED_ENABLED flag > in dev_pm_enable_wake_irq_complete() to avoid redundant irq enablement. Just trying to understand, why not in dev_pm_arm_wake_irq ? Is it cuz it's called much after dev_pm_enable_wake_irq_complete ? Not sure what's the exact call order, but I am assuming dev_pm_enable_wake_irq_complete is more of a runtime thing and dev_pm_arm_wake_irq happens finally at system suspend? > > Fixes: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming") > Signed-off-by: Qingliang Li <qingliang.li@mediatek.com> > --- $subject: Most recent convention used for this file is: "PM: sleep: wakeirq: ..." > drivers/base/power/wakeirq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c > index 42171f766dcb..5a5a9e978e85 100644 > --- a/drivers/base/power/wakeirq.c > +++ b/drivers/base/power/wakeirq.c > @@ -313,8 +313,10 @@ void dev_pm_enable_wake_irq_complete(struct device *dev) > return; > > if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED && > - wirq->status & WAKE_IRQ_DEDICATED_REVERSE) > + wirq->status & WAKE_IRQ_DEDICATED_REVERSE) { > enable_irq(wirq->irq); > + wirq->status |= WAKE_IRQ_DEDICATED_ENABLED; > + } But this does make sense to make sure status is updated, You can pick my R-by. Reviewed-by: Dhruva Gole <d-gole@ti.com>
On Wed, Feb 28, 2024 at 10:00:40AM +0800, Qingliang Li wrote: > When driver registers the wake irq with reverse enable ordering, > the wake irq will be re-enabled when entering system suspend, triggering > an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be > enabled in both dev_pm_enable_wake_irq_complete() and dev_pm_arm_wake_irq() > > To fix this issue, complete the setting of WAKE_IRQ_DEDICATED_ENABLED flag > in dev_pm_enable_wake_irq_complete() to avoid redundant irq enablement. > > Fixes: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming") > Signed-off-by: Qingliang Li <qingliang.li@mediatek.com> > --- > drivers/base/power/wakeirq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c > index 42171f766dcb..5a5a9e978e85 100644 > --- a/drivers/base/power/wakeirq.c > +++ b/drivers/base/power/wakeirq.c > @@ -313,8 +313,10 @@ void dev_pm_enable_wake_irq_complete(struct device *dev) > return; > > if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED && > - wirq->status & WAKE_IRQ_DEDICATED_REVERSE) > + wirq->status & WAKE_IRQ_DEDICATED_REVERSE) { > enable_irq(wirq->irq); > + wirq->status |= WAKE_IRQ_DEDICATED_ENABLED; > + } > } > > /** > -- > 2.25.1 > Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot
On Wed, 2024-02-28 at 11:34 +0530, Dhruva Gole wrote: > > External email : Please do not click links or open attachments until > you have verified the sender or the content. > Hi, > > On 28/02/24 07:30, Qingliang Li wrote: > > When driver registers the wake irq with reverse enable ordering, > > the wake irq will be re-enabled when entering system suspend, > triggering > > an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be > > enabled in both dev_pm_enable_wake_irq_complete() and > dev_pm_arm_wake_irq() > > > > To fix this issue, complete the setting of > WAKE_IRQ_DEDICATED_ENABLED flag > > in dev_pm_enable_wake_irq_complete() to avoid redundant irq > enablement. > > > Just trying to understand, why not in dev_pm_arm_wake_irq ? > Is it cuz it's called much after dev_pm_enable_wake_irq_complete ? > Not sure what's the exact call order, but I am assuming > dev_pm_enable_wake_irq_complete is more of a runtime thing and > dev_pm_arm_wake_irq happens finally at system suspend? You are right, the involvement of 'dev_pm_enable_wake_irq_complete' is due to the driver selecting 'pm_runtime_force_suspend' as the callback function for system suspend. In this scenario, the call sequence during system suspend is as follows: dpm_suspend_start -> dpm_run_callback -> pm_runtime_force_suspend -> dev_pm_enable_wake_irq_check/complete suspend_enter -> dpm_suspend_noirq -> dev_pm_arm_wake_irq Based on the above, if the driver (i) chooses pm_runtime_force_suspend as the system suspend callback function and (ii) registers wake irq with reverse enable ordering, the wake irq will be enabled twice during system suspend. > > > > > Fixes: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming") > > Signed-off-by: Qingliang Li <qingliang.li@mediatek.com> > > --- > > $subject: Most recent convention used for this file is: > "PM: sleep: wakeirq: ..." I'm sorry, but what is the problem with the description of the "Fixed" field? I didn't get your point and I wrote it according to the previous patches. > > > drivers/base/power/wakeirq.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/power/wakeirq.c > b/drivers/base/power/wakeirq.c > > index 42171f766dcb..5a5a9e978e85 100644 > > --- a/drivers/base/power/wakeirq.c > > +++ b/drivers/base/power/wakeirq.c > > @@ -313,8 +313,10 @@ void dev_pm_enable_wake_irq_complete(struct > device *dev) > > return; > > > > if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED && > > - wirq->status & WAKE_IRQ_DEDICATED_REVERSE) > > + wirq->status & WAKE_IRQ_DEDICATED_REVERSE) { > > enable_irq(wirq->irq); > > +wirq->status |= WAKE_IRQ_DEDICATED_ENABLED; > > +} > > But this does make sense to make sure status is updated, > You can pick my R-by. > > Reviewed-by: Dhruva Gole <d-gole@ti.com> > > -- > Thanks and Regards, > Dhruva Gole
Hello, On 28/02/24 14:03, Qingliang Li (黎晴亮) wrote: > On Wed, 2024-02-28 at 11:34 +0530, Dhruva Gole wrote: >> >> External email : Please do not click links or open attachments until >> you have verified the sender or the content. >> Hi, >> >> On 28/02/24 07:30, Qingliang Li wrote: >>> When driver registers the wake irq with reverse enable ordering, >>> the wake irq will be re-enabled when entering system suspend, >> triggering >>> an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be >>> enabled in both dev_pm_enable_wake_irq_complete() and >> dev_pm_arm_wake_irq() >>> >>> To fix this issue, complete the setting of >> WAKE_IRQ_DEDICATED_ENABLED flag >>> in dev_pm_enable_wake_irq_complete() to avoid redundant irq >> enablement. >> >> >> Just trying to understand, why not in dev_pm_arm_wake_irq ? >> Is it cuz it's called much after dev_pm_enable_wake_irq_complete ? >> Not sure what's the exact call order, but I am assuming >> dev_pm_enable_wake_irq_complete is more of a runtime thing and >> dev_pm_arm_wake_irq happens finally at system suspend? > > You are right, the involvement of 'dev_pm_enable_wake_irq_complete' is > due to the driver selecting 'pm_runtime_force_suspend' as the callback > function for system suspend. In this scenario, the call sequence during > system suspend is as follows: > dpm_suspend_start -> dpm_run_callback -> pm_runtime_force_suspend -> > dev_pm_enable_wake_irq_check/complete > suspend_enter -> dpm_suspend_noirq -> dev_pm_arm_wake_irq OK this is what I expected, thanks for clarifying! > > Based on the above, if the driver (i) chooses pm_runtime_force_suspend > as the system suspend callback function and (ii) registers wake irq > with reverse enable ordering, the wake irq will be enabled twice during > system suspend. Yep, makes sense > >> >>> >>> Fixes: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming") >>> Signed-off-by: Qingliang Li <qingliang.li@mediatek.com> >>> --- >> >> $subject: Most recent convention used for this file is: >> "PM: sleep: wakeirq: ..." > > I'm sorry, but what is the problem with the description of the "Fixed" > field? I didn't get your point and I wrote it according to the previous > patches. I am not talking about your "Fixed", I am taking about the subject line of the patch. You've used "PM: wakeirq: fix wake ..." Instead use "PM: sleep: wakeirq: fix wake ..." No strong objections here, it's just a nit. [..snip..]
On Wed, Feb 28, 2024 at 9:33 AM Qingliang Li (黎晴亮) <Qingliang.Li@mediatek.com> wrote: > > On Wed, 2024-02-28 at 11:34 +0530, Dhruva Gole wrote: > > > > External email : Please do not click links or open attachments until > > you have verified the sender or the content. > > Hi, > > > > On 28/02/24 07:30, Qingliang Li wrote: > > > When driver registers the wake irq with reverse enable ordering, > > > the wake irq will be re-enabled when entering system suspend, > > triggering > > > an 'Unbalanced enable for IRQ xxx' warning. The wake irq will be > > > enabled in both dev_pm_enable_wake_irq_complete() and > > dev_pm_arm_wake_irq() > > > > > > To fix this issue, complete the setting of > > WAKE_IRQ_DEDICATED_ENABLED flag > > > in dev_pm_enable_wake_irq_complete() to avoid redundant irq > > enablement. > > > > > > Just trying to understand, why not in dev_pm_arm_wake_irq ? > > Is it cuz it's called much after dev_pm_enable_wake_irq_complete ? > > Not sure what's the exact call order, but I am assuming > > dev_pm_enable_wake_irq_complete is more of a runtime thing and > > dev_pm_arm_wake_irq happens finally at system suspend? > > You are right, the involvement of 'dev_pm_enable_wake_irq_complete' is > due to the driver selecting 'pm_runtime_force_suspend' as the callback > function for system suspend. In this scenario, the call sequence during > system suspend is as follows: > dpm_suspend_start -> dpm_run_callback -> pm_runtime_force_suspend -> > dev_pm_enable_wake_irq_check/complete > suspend_enter -> dpm_suspend_noirq -> dev_pm_arm_wake_irq > > Based on the above, if the driver (i) chooses pm_runtime_force_suspend > as the system suspend callback function and (ii) registers wake irq > with reverse enable ordering, the wake irq will be enabled twice during > system suspend. It would be good to put the above information into the patch changelog, as it actually explains the problem. Thanks!
diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index 42171f766dcb..5a5a9e978e85 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -313,8 +313,10 @@ void dev_pm_enable_wake_irq_complete(struct device *dev) return; if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED && - wirq->status & WAKE_IRQ_DEDICATED_REVERSE) + wirq->status & WAKE_IRQ_DEDICATED_REVERSE) { enable_irq(wirq->irq); + wirq->status |= WAKE_IRQ_DEDICATED_ENABLED; + } } /**