From patchwork Wed Oct 20 18:48:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12573103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12494C433F5 for ; Wed, 20 Oct 2021 18:56:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEDFA61038 for ; Wed, 20 Oct 2021 18:56:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CEDFA61038 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PdptxS3xuTJyayS4KIC2B1/opHo0GtHX2kwG6fhaeOc=; b=zbVYmNJrOY3tTz Gmeoc4J2YqtVtTH6j5kI5hSSGIz9ahDBD596V0eDKVeItw3x341PYb5GFpY71R4wqaUvYRPGF1evw KxPbma2HT10+J5mumusxoS1KPKPbcZyW5KYqUsez/csfSjQEVXxe54eF/3SGDsX8rrkOVFEdeBSmI Idwv5s0Ms86ERRR0Hl4KgshTQaY4vS2wxgsRyouqtZY1RQGw3K2+mpsvTfT2wuPpufgEAefwWQbOO kbHMoiPXvJMpVJ8szZhYKGKOmP1CjswUWPs0/RHCZ0Q59jhcjr+T8p51hl7WSL8xrenj8aTW9V25A B6j9kf1/4C1Dvs7sinww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGjj-005YEd-Sr; Wed, 20 Oct 2021 18:54:52 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGfj-005W0P-A6 for linux-arm-kernel@lists.infradead.org; Wed, 20 Oct 2021 18:50:46 +0000 Received: by mail-pf1-x42d.google.com with SMTP id t184so3770640pfd.0 for ; Wed, 20 Oct 2021 11:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DgNlnw/X0eZIQ1orBNwNN4B1FWjS3NXzL3tygL/Zpc0=; b=nclhbtnO1d3VUqCjuO6fbVBLJwRCFzgkiQCrv3xYB3HM5GTyWvBhu6RljQKGdK2pK5 FR176iIdQqTr2RIJHZjvYaiVc8DtqG8Kbl30nEEs5hFoUAMhNRAedi+tAgyIhIw2qHbY Ah6th4TjmsOMkzx1p9m/a9z00gKcRY1FsArZ5GN/5oDFODb5uFWozEanMBUoZ6aKDxiG zWu1j9qJbrdumFiOrnH9tMw8uQWqPs5UYM+hatVgL/rBcTBxkszxKOv81hdZ38ezJL2R KPmZAnmi7K4LCsVXzYCCrxAcf2u+tMkzemWMSxWNfVLCrJrwvyHXKpP1nTOWgsGza8/k DSuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DgNlnw/X0eZIQ1orBNwNN4B1FWjS3NXzL3tygL/Zpc0=; b=fkdBU5ljezchxgsjlTF3AOwZfsxVVZLE4m32pFNUIG88t1S3pgxLSyJ0Vmi1xG2lhR BPZvIFyG1i/r0QxLMZPfHWDy2m290AmaOD695cMTTvkuHg4PThxFUgH3zgO2psTz24hL AA0lmL1GWf7oE+Jqa7hd+V1BMQyNfKHRnLYoc/3e+eOzg6PWABVFGIhJap1Slgs4kc2z FDy0sKy3gkIrEL6mS0umSzQ45yhs/kPWhaoiMKCtl1Y0SK2HYKM5g2oT/iOMDpIzempq zHXLjMw/JTYK++aeRGSEiJpuXJNe0J73++JHqSFKKY4VmLl6v65zZvfNhIA+fb5FW3sz 0QKQ== X-Gm-Message-State: AOAM532cbA7ThRrtbuyH/NLiKkn3D/pi7r1Q0oW1Z7K8AsIKzxLdxqeB wStvWdi/Ix5MtS/tVFmX5so= X-Google-Smtp-Source: ABdhPJxxYfaTpM34yX+EnA7h6FN0DD/aOb+FRn6t5KRFu0Tua/JQSghv55UaM3L5Rms0kPaDPlsd8A== X-Received: by 2002:a05:6a00:2389:b0:44d:6d57:a38e with SMTP id f9-20020a056a00238900b0044d6d57a38emr1053648pfc.50.1634755842459; Wed, 20 Oct 2021 11:50:42 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id o127sm3267863pfb.216.2021.10.20.11.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:50:41 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...), Russell King , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Thomas Gleixner , Marc Zyngier , Rob Herring , Frank Rowand , linux-arm-kernel@lists.infradead.org (moderated list:ARM SUB-ARCHITECTURES), linux-mips@vger.kernel.org (open list:MIPS), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE) Subject: [PATCH v6 10/13] irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER Date: Wed, 20 Oct 2021 11:48:56 -0700 Message-Id: <20211020184859.2705451-11-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211020184859.2705451-1-f.fainelli@gmail.com> References: <20211020184859.2705451-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_115043_419524_2F839354 X-CRM114-Status: GOOD ( 20.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow the user selection and building of this interrupt controller driver as a module since it is used on ARM/ARM64 based systems as a second level interrupt controller hanging off the ARM GIC and is therefore loadable during boot. To avoid using of_irq_count() which is not exported towards module, switch the driver to use the platform_device provided by the irqchip platform driver code and resolve the number of interrupts using platform_irq_count(). Signed-off-by: Florian Fainelli --- drivers/irqchip/Kconfig | 4 +++- drivers/irqchip/irq-bcm7120-l2.c | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index dfe54bf9b35f..c7320bed5668 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -123,7 +123,9 @@ config BCM7038_L1_IRQ select GENERIC_IRQ_EFFECTIVE_AFF_MASK config BCM7120_L2_IRQ - bool + tristate "Broadcom STB 7120-style L2 interrupt controller driver" + depends on ARCH_BRCMSTB || BMIPS_GENERIC + default ARCH_BRCMSTB || BMIPS_GENERIC select GENERIC_IRQ_CHIP select IRQ_DOMAIN diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index f23d7651ea84..d80e67a6aad2 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c @@ -220,6 +220,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, { unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; struct bcm7120_l2_intc_data *data; + struct platform_device *pdev; struct irq_chip_generic *gc; struct irq_chip_type *ct; int ret = 0; @@ -230,7 +231,13 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, if (!data) return -ENOMEM; - data->num_parent_irqs = of_irq_count(dn); + pdev = of_find_device_by_node(dn); + if (!pdev) { + ret = -ENODEV; + goto out_free_data; + } + + data->num_parent_irqs = platform_irq_count(pdev); if (data->num_parent_irqs <= 0) { pr_err("invalid number of parent interrupts\n"); ret = -ENOMEM; @@ -329,6 +336,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, if (data->map_base[idx]) iounmap(data->map_base[idx]); } +out_free_data: kfree(data); return ret; } @@ -347,8 +355,9 @@ static int __init bcm7120_l2_intc_probe_3380(struct device_node *dn, "BCM3380 L2"); } -IRQCHIP_DECLARE(bcm7120_l2_intc, "brcm,bcm7120-l2-intc", - bcm7120_l2_intc_probe_7120); - -IRQCHIP_DECLARE(bcm3380_l2_intc, "brcm,bcm3380-l2-intc", - bcm7120_l2_intc_probe_3380); +IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7120_l2) +IRQCHIP_MATCH("brcm,bcm7120-l2-intc", bcm7120_l2_intc_probe_7120) +IRQCHIP_MATCH("brcm,bcm3380-l2-intc", bcm7120_l2_intc_probe_3380) +IRQCHIP_PLATFORM_DRIVER_END(bcm7120_l2) +MODULE_DESCRIPTION("Broadcom STB 7120-style L2 interrupt controller driver"); +MODULE_LICENSE("GPL v2");