From patchwork Fri Mar 15 20:07:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10855563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F20C613B5 for ; Fri, 15 Mar 2019 20:08:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D55E12AC62 for ; Fri, 15 Mar 2019 20:08:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C58932AC64; Fri, 15 Mar 2019 20:08:08 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CA6E2AC62 for ; Fri, 15 Mar 2019 20:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jPYR2cyEwCJuTkyfW8DxJmSORsTSPAIeZ7KQyByLvd4=; b=GPnrCHyvXIR1F3 9tOsz/42ayFAH0kKo4tRCM4QzEqwFYNsq0QKKxtMNxKAIGd5X9VORnvBAYMWo8YoFB/R1NnjLxzGo nBm7394wvbnOqOnd4txIFhyos6MdTh9tPI0DA+Yh5HpIV7tZ3BWUnC+0H1201UQllQ/Yc6+SHqw4n Icopf3DNoamRhrvAVWiZKgx9mAyJZlEfgcZhkKekYewHFv+7WxNkUmbDAr+Mza+Ffob8UYWJ+SnB3 7HUr5s9hnOqqterrc1Ae/QYDB50JGM49Mf0bcS92TPtsHaqE861QV3id+BQHrpdFJpWmxlK00Q24/ irzi2A95Otv9XjJJq10Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4t7e-0007Zd-OP; Fri, 15 Mar 2019 20:08:06 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4t7a-0007ZE-LW for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2019 20:08:04 +0000 Received: by mail-pf1-x444.google.com with SMTP id j5so7092047pfa.2 for ; Fri, 15 Mar 2019 13:08:01 -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:mime-version :content-transfer-encoding; bh=zJTJtCHTW4gN40l0qZRJ+gEBkunAEWcQrIjrIGSaUec=; b=cxnaaYgBBcKpejC5EFkzlUM5OuzOz5131423UVGdwAgD518MUgEA/on76nZbVOceFQ qNXxj534HxlKOQz90jV/fCWSzlyW2DoBY61YBvb8dhaHnmQSQbgasNkxkZmE+HmzDe5U NhUCujCDkUPF0TwHVXJ0MLDF6qNpxoBBJF1qY= 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:mime-version :content-transfer-encoding; bh=zJTJtCHTW4gN40l0qZRJ+gEBkunAEWcQrIjrIGSaUec=; b=PQAnlsuGAYngVgq5dYNrXhfWbrntcZPKpf1JannSfb7WAkQDu455dmnMQmF3rpcMdz gQ8V9sDJH+S8AYFQ63TViYfAcGm0ix3xv/Zvy+hkgJxPtTeRfduuJT87UoZOnJpj3Wh+ sGXBKPIvHM0UAD2VEJhYtroadDg97ZaKvcsmq78t1/lnPTDpdMAp/29MC9qLP3rn8pgt wIsA/ywc6R3WKTmWCWuqthgmxi2Hwd9+a8Uj0XsJik2YXE+Ecp95cIHTgjDxBC2vfdqt xPC7dJSNd6wSmirN/lW2rFF3JZs7qvVxgZFNqQavMeNy3yz8L9Ohtj6AhyMlHFva6VJ2 S4Uw== X-Gm-Message-State: APjAAAWaLMUHzGAUqBBSbfDQt3Bi2Wbg4N1f4HU/Egug8jKKh9FiVNIa +k0WR/47YBvqtGhUr7iGu4boSg== X-Google-Smtp-Source: APXvYqx+uoTEcnILylmeJLMr0tqgnbguvI2GmOKclhq14KKCLYHWbEqAEqlg1sERc0negByM3xU8Vw== X-Received: by 2002:a63:2a82:: with SMTP id q124mr5139459pgq.402.1552680481392; Fri, 15 Mar 2019 13:08:01 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id f15sm3758376pfa.11.2019.03.15.13.08.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 13:08:00 -0700 (PDT) From: Stephen Boyd To: Thomas Gleixner Subject: [PATCH] genirq: Respect IRQCHIP_SKIP_SET_WAKE in irq_chip_set_wake_parent() Date: Fri, 15 Mar 2019 13:07:59 -0700 Message-Id: <20190315200759.139479-1-swboyd@chromium.org> X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_130802_707882_B000E165 X-CRM114-Status: GOOD ( 12.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lina Iyer Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This function returns an error if a child interrupt controller calls irq_chip_set_wake_parent() but that parent interrupt controller has the IRQCHIP_SKIP_SET_WAKE flag. Let's return 0 for success instead because there isn't anything to do. There's also the possibility that a parent indicates that we should skip it, but the grandparent has an .irq_set_wake callback. Let's iterate through the parent chain as long as the IRQCHIP_SKIP_SET_WAKE flag isn't set so we can find the first parent that needs to handle the wake configuration. This fixes a problem on my Qualcomm sdm845 device where I'm trying to enable wake on an irq from the gpio controller that's a child of the qcom pdc interrupt controller. The qcom pdc interrupt controller has the IRQCHIP_SKIP_SET_WAKE flag set, and so does the grandparent (ARM GIC), causing this function to return a failure because the parent controller doesn't have the .irq_set_wake callback set. Cc: Lina Iyer Cc: Marc Zyngier Signed-off-by: Stephen Boyd --- kernel/irq/chip.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 3faef4a77f71..280d612ba71b 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1448,7 +1448,13 @@ int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, void *vcpu_info) */ int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on) { - data = data->parent_data; + for (data = data->parent_data; data; data = data->parent_data) + if (!(data->chip->flags & IRQCHIP_SKIP_SET_WAKE)) + break; + + if (!data) + return 0; + if (data->chip->irq_set_wake) return data->chip->irq_set_wake(data, on);