Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3093483pxm; Mon, 28 Feb 2022 11:52:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2h0omk6uX6GwnbELeh4zpgiDlOS4thyer4E+K7Tn4SP0XetCwIRf+BNg1zPp2Ne6wu6f6 X-Received: by 2002:a17:90a:7305:b0:1bd:6972:faf5 with SMTP id m5-20020a17090a730500b001bd6972faf5mr3207752pjk.131.1646077951661; Mon, 28 Feb 2022 11:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646077951; cv=none; d=google.com; s=arc-20160816; b=pe/Mqi4F6noR5H6JWyE8+lJPDYoMB8RL5vy2eVpUa5assSaRwdNAifTrVTvIsOjKrU YsKp84Vje5tzJWRs9BTYdreP4PbdELdVzGFZy9aVyZoGz3tHRtHVFGoVyFg7RrxAyht3 Elqp+pD6kEv4mCu9A7fS85pcCRa8pZ2z3gHo7OBBAyxLBB4wiM1F7TLJJGRdFevD3SZs OheBBkyEr4ka5tdcEIR0Y1VdPXxuLaKArQL3bYxQJwUxygn1Cg1oSavdDP8yExcDvqoB YYij/fRb0w5x/aHPmDAuwSltPRsaJwDtg/84wON9FrdGLzLTRbOiOHwADTkdFnDCEogv FPeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=J9gn+lq1OxgspfBuH8uvwct2hS/UCwEfO2G29M1/3f8=; b=lF+mtX0NtAszWtGn4Tbm03mliFVa3fNv7kLoRY5M/cnbBNHGCQUik8gc+XQttemuRJ Z/GQV1R34fsIar+zS3PMWSU0kWcxEq7I1rNBgCkqjIzw2T9lmAKsdCTbBkzpo5f6OLSV b7YVnnoSVKAWbSYJaB+uqodwWueKT2zutsCMO/UevxEcPSEbJxUbmnjnhEcPDvMW8EYj T6jGsmHifVtleTP8iEWi55tssThv5n4KJxUlmpRnO7RwIObESMotM+GRMo1nTZr1gicE UoEuPaifi83S+2y6hzC6tuIoPYuoGFjUjETaL2JburEV/b/Rx/wGS97Z51XwZX1fXM/K +rgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cxPiqNfp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=XTMe+aOE; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w18-20020a1709027b9200b001516b8bdb16si3305524pll.365.2022.02.28.11.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 11:52:31 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cxPiqNfp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=XTMe+aOE; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD9DCBDE55; Mon, 28 Feb 2022 11:27:23 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240624AbiB1SDn (ORCPT + 99 others); Mon, 28 Feb 2022 13:03:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239680AbiB1RxS (ORCPT ); Mon, 28 Feb 2022 12:53:18 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E767BAA2EC for ; Mon, 28 Feb 2022 09:40:47 -0800 (PST) Date: Mon, 28 Feb 2022 17:40:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1646070043; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J9gn+lq1OxgspfBuH8uvwct2hS/UCwEfO2G29M1/3f8=; b=cxPiqNfpSdXlqHi5fadnPig8ssk3b+7bgpM2d0i2Bup5Qe13CMvtyXzQK1nJkwn9sreZIy ZksYcRVkfo17ShTL+2xmWqgN5DASMTnnNsmTK7RUCKJnYse8lu1AMmEdy9cjo7ZXhzvvWY iYltHyJ4VTjPRcokM7YJLRBMY8NDzQtyLrx9azSGJrasqEPBKt++jLLZM9glsprEzV4nrs PhBikcR5cjJuvxbvzUzOXP1QPPHZMvYoveFGAsCNA5xQzlig4iISQyuN26nrRMtJK6exH1 DeBGtmhgzPPX2PRWwv88efsgbi1GlBtGrNhJtYR1uoYMertwg0aNJ0DcAEpqrA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1646070043; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J9gn+lq1OxgspfBuH8uvwct2hS/UCwEfO2G29M1/3f8=; b=XTMe+aOEpn/wQJu05p6eNIW2Jgnk2hKHTPDezjHd8iC9/lSyremxQq550tRK7BQso2nveM I25tfiX58kGKd1Aw== From: "irqchip-bot for Marc Zyngier" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [irqchip: irq/irqchip-next] irqchip/qcom-pdc: Kill PDC_NO_PARENT_IRQ Cc: Marc Zyngier , tglx@linutronix.de In-Reply-To: <20220224101226.88373-2-maz@kernel.org> References: <20220224101226.88373-2-maz@kernel.org> MIME-Version: 1.0 Message-ID: <164607004262.16921.13704832568538557968.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/irqchip-next branch of irqchip: Commit-ID: 9fbc4f3979658ad30f3239d6a3660892976a8206 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/9fbc4f3979658ad30f3239d6a3660892976a8206 Author: Marc Zyngier AuthorDate: Thu, 24 Feb 2022 10:12:22 Committer: Marc Zyngier CommitterDate: Mon, 28 Feb 2022 17:32:25 irqchip/qcom-pdc: Kill PDC_NO_PARENT_IRQ PDC_NO_PARENT_IRQ is pretty pointless, as all it indicates is that the PDC terminates the interrupt hierarchy. Which is exactly the same as not having a mapping in the GIC space. This is also bad practice to treat the absence of a hwirq as a hwirq itself. Just explicitly use the region mapping pointer, and drop the definition. Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220224101226.88373-2-maz@kernel.org --- drivers/irqchip/qcom-pdc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 173e652..3b214c4 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -30,14 +30,14 @@ #define IRQ_ENABLE_BANK 0x10 #define IRQ_i_CFG 0x110 -#define PDC_NO_PARENT_IRQ ~0UL - struct pdc_pin_region { u32 pin_base; u32 parent_base; u32 cnt; }; +#define pin_to_hwirq(r, p) ((r)->parent_base + (p) - (r)->pin_base) + static DEFINE_RAW_SPINLOCK(pdc_lock); static void __iomem *pdc_base; static struct pdc_pin_region *pdc_region; @@ -186,19 +186,17 @@ static struct irq_chip qcom_pdc_gic_chip = { .irq_set_affinity = irq_chip_set_affinity_parent, }; -static irq_hw_number_t get_parent_hwirq(int pin) +static struct pdc_pin_region *get_pin_region(int pin) { int i; - struct pdc_pin_region *region; for (i = 0; i < pdc_region_cnt; i++) { - region = &pdc_region[i]; - if (pin >= region->pin_base && - pin < region->pin_base + region->cnt) - return (region->parent_base + pin - region->pin_base); + if (pin >= pdc_region[i].pin_base && + pin < pdc_region[i].pin_base + pdc_region[i].cnt) + return &pdc_region[i]; } - return PDC_NO_PARENT_IRQ; + return NULL; } static int qcom_pdc_translate(struct irq_domain *d, struct irq_fwspec *fwspec, @@ -221,7 +219,8 @@ static int qcom_pdc_alloc(struct irq_domain *domain, unsigned int virq, { struct irq_fwspec *fwspec = data; struct irq_fwspec parent_fwspec; - irq_hw_number_t hwirq, parent_hwirq; + struct pdc_pin_region *region; + irq_hw_number_t hwirq; unsigned int type; int ret; @@ -234,8 +233,8 @@ static int qcom_pdc_alloc(struct irq_domain *domain, unsigned int virq, if (ret) return ret; - parent_hwirq = get_parent_hwirq(hwirq); - if (parent_hwirq == PDC_NO_PARENT_IRQ) + region = get_pin_region(hwirq); + if (!region) return irq_domain_disconnect_hierarchy(domain->parent, virq); if (type & IRQ_TYPE_EDGE_BOTH) @@ -247,7 +246,7 @@ static int qcom_pdc_alloc(struct irq_domain *domain, unsigned int virq, parent_fwspec.fwnode = domain->parent->fwnode; parent_fwspec.param_count = 3; parent_fwspec.param[0] = 0; - parent_fwspec.param[1] = parent_hwirq; + parent_fwspec.param[1] = pin_to_hwirq(region, hwirq); parent_fwspec.param[2] = type; return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, @@ -265,7 +264,8 @@ static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq, { struct irq_fwspec *fwspec = data; struct irq_fwspec parent_fwspec; - irq_hw_number_t hwirq, parent_hwirq; + struct pdc_pin_region *region; + irq_hw_number_t hwirq; unsigned int type; int ret; @@ -281,8 +281,8 @@ static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq, if (ret) return ret; - parent_hwirq = get_parent_hwirq(hwirq); - if (parent_hwirq == PDC_NO_PARENT_IRQ) + region = get_pin_region(hwirq); + if (!region) return irq_domain_disconnect_hierarchy(domain->parent, virq); if (type & IRQ_TYPE_EDGE_BOTH) @@ -294,7 +294,7 @@ static int qcom_pdc_gpio_alloc(struct irq_domain *domain, unsigned int virq, parent_fwspec.fwnode = domain->parent->fwnode; parent_fwspec.param_count = 3; parent_fwspec.param[0] = 0; - parent_fwspec.param[1] = parent_hwirq; + parent_fwspec.param[1] = pin_to_hwirq(region, hwirq); parent_fwspec.param[2] = type; return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs,