From patchwork Fri Sep 15 10:22:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 140341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp944047vqi; Fri, 15 Sep 2023 03:34:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwWa5NLt/FDUIh/gXZ83RfpB66ab1aDmOe5SV1bYt2SCNkQBvcUlNzTyWVM1ni3sHOqVgA X-Received: by 2002:a17:90b:3583:b0:268:7be6:29a5 with SMTP id mm3-20020a17090b358300b002687be629a5mr988392pjb.9.1694774063157; Fri, 15 Sep 2023 03:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694774063; cv=none; d=google.com; s=arc-20160816; b=izHMpPXG2KIYa75tJqVhwm5DmO02Gogq4mIYWtInNKv7XCEqM3SAoRB22Uqx/5Ridf fbtVogQ41w27utGWSJOLFQHieOAJXzqJbybpPRUttoQIB8N3VmKGnywMsDerfE8qD49n kNeqXbtxSJK1lH/uF5r71PnAX1ZGEKTidCp/m4NmF0lkY2p3V8i+mn0i73OILBpz4YJM c8Sr6hovSpq7ljATtYMwnZEYj62zHGp+dtF2nicFhG4v4Q5V++AmNtj+1YFoR4cqfP7O dBndmn1EPOtrT+cQy4f40RfqfL2EqYKc1tWLhuw1/kb+/Fzfx3nr5DyglGn/rnQndeY1 bmAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=rGB5ospMeNRyHw6rmDraba4QZgIkKCAr+wpRpIY5FCo=; fh=y8d0C5dLtGb8zs8KQUIJy2R9+5DBPV29N8a8eZxYvuU=; b=lOeQqmJNTn4/MEj4ROEQmbjdg1bjhnxYxNiIH3Ly96iprz8cupi5674jHxLKC+B3gS YDrbCaZj32YY0WXnvgcbOLxIcn14UcBcTXzfwie3lE3uNfXoFcy0ucKvWEs4SpPhNjRp t1h/Fr68S0sSJgriuKVF5JEFYUuxhXGJzbMucWHnPqjN1TyDzNI07oisapJh3InSY3Ue lgp1Qg8FADYTdYEzEFsVZh51bpnDi1B3pl1niqeJzd21swiw/HRBhKcNaZVKu2MDWqY1 4D/2xj+9FSQsPnlMc3Eg8+tN80Nk3+9x5ToFGkpCfDLaGAqIuPAXu8sLzqk824GzftpQ zYug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id j10-20020a17090a734a00b002680e08a877si5075838pjs.186.2023.09.15.03.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D22688436B40; Fri, 15 Sep 2023 03:23:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234435AbjIOKXZ (ORCPT + 32 others); Fri, 15 Sep 2023 06:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234300AbjIOKXC (ORCPT ); Fri, 15 Sep 2023 06:23:02 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EC8C1FD4; Fri, 15 Sep 2023 03:22:56 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id D27AE24E18D; Fri, 15 Sep 2023 18:22:54 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Sep 2023 18:22:54 +0800 Received: from ubuntu.localdomain (113.72.144.67) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Sep 2023 18:22:53 +0800 From: Minda Chen To: Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Emil Renner Berthing CC: , , , , =?utf-8?q?P?= =?utf-8?q?ali_Roh=C3=A1r?= , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v6 10/19] PCI: microchip: Add num_events field to struct plda_pcie_rp Date: Fri, 15 Sep 2023 18:22:34 +0800 Message-ID: <20230915102243.59775-11-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230915102243.59775-1-minda.chen@starfivetech.com> References: <20230915102243.59775-1-minda.chen@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.144.67] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:23:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777099408269965401 X-GMAIL-MSGID: 1777099408269965401 Avoid using NUM_EVENTS macros in common codes. Signed-off-by: Minda Chen --- drivers/pci/controller/plda/pcie-microchip-host.c | 7 ++++--- drivers/pci/controller/plda/pcie-plda.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index 81aac2d72a2f..d9dd63084e2b 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -648,7 +648,7 @@ static void plda_handle_event(struct irq_desc *desc) events = mc_get_events(port); - for_each_set_bit(bit, &events, NUM_EVENTS) + for_each_set_bit(bit, &events, port->num_events) generic_handle_domain_irq(port->event_domain, bit); chained_irq_exit(chip, desc); @@ -811,7 +811,7 @@ static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port) return -EINVAL; } - port->event_domain = irq_domain_add_linear(pcie_intc_node, NUM_EVENTS, + port->event_domain = irq_domain_add_linear(pcie_intc_node, port->num_events, &mc_event_domain_ops, port); if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); @@ -914,7 +914,7 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r if (irq < 0) return -ENODEV; - for (i = 0; i < NUM_EVENTS; i++) { + for (i = 0; i < port->num_events; i++) { event_irq = irq_create_mapping(port->event_domain, i); if (!event_irq) { dev_err(dev, "failed to map hwirq %d\n", i); @@ -1006,6 +1006,7 @@ static int mc_host_probe(struct platform_device *pdev) bridge_base_addr = port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; plda->bridge_addr = bridge_base_addr; + plda->num_events = NUM_EVENTS; /* Allow enabling MSI by disabling MSI-X */ val = readl(bridge_base_addr + PCIE_PCI_IRQ_DW0); diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h index 32a913d4101f..5b09ffed623c 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -150,6 +150,7 @@ struct plda_pcie_rp { raw_spinlock_t lock; struct plda_msi msi; void __iomem *bridge_addr; + int num_events; }; irqreturn_t plda_event_handler(int irq, void *dev_id);