Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER

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 <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211020184859.2705451-11-f.fainelli@gmail.com

authored by

Florian Fainelli and committed by
Marc Zyngier
3ac268d5 945486bf

+18 -7
+3 -1
drivers/irqchip/Kconfig
··· 123 123 select GENERIC_IRQ_EFFECTIVE_AFF_MASK 124 124 125 125 config BCM7120_L2_IRQ 126 - bool 126 + tristate "Broadcom STB 7120-style L2 interrupt controller driver" 127 + depends on ARCH_BRCMSTB || BMIPS_GENERIC 128 + default ARCH_BRCMSTB || BMIPS_GENERIC 127 129 select GENERIC_IRQ_CHIP 128 130 select IRQ_DOMAIN 129 131
+15 -6
drivers/irqchip/irq-bcm7120-l2.c
··· 220 220 { 221 221 unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; 222 222 struct bcm7120_l2_intc_data *data; 223 + struct platform_device *pdev; 223 224 struct irq_chip_generic *gc; 224 225 struct irq_chip_type *ct; 225 226 int ret = 0; ··· 231 230 if (!data) 232 231 return -ENOMEM; 233 232 234 - data->num_parent_irqs = of_irq_count(dn); 233 + pdev = of_find_device_by_node(dn); 234 + if (!pdev) { 235 + ret = -ENODEV; 236 + goto out_free_data; 237 + } 238 + 239 + data->num_parent_irqs = platform_irq_count(pdev); 235 240 if (data->num_parent_irqs <= 0) { 236 241 pr_err("invalid number of parent interrupts\n"); 237 242 ret = -ENOMEM; ··· 336 329 if (data->map_base[idx]) 337 330 iounmap(data->map_base[idx]); 338 331 } 332 + out_free_data: 339 333 kfree(data); 340 334 return ret; 341 335 } ··· 355 347 "BCM3380 L2"); 356 348 } 357 349 358 - IRQCHIP_DECLARE(bcm7120_l2_intc, "brcm,bcm7120-l2-intc", 359 - bcm7120_l2_intc_probe_7120); 360 - 361 - IRQCHIP_DECLARE(bcm3380_l2_intc, "brcm,bcm3380-l2-intc", 362 - bcm7120_l2_intc_probe_3380); 350 + IRQCHIP_PLATFORM_DRIVER_BEGIN(bcm7120_l2) 351 + IRQCHIP_MATCH("brcm,bcm7120-l2-intc", bcm7120_l2_intc_probe_7120) 352 + IRQCHIP_MATCH("brcm,bcm3380-l2-intc", bcm7120_l2_intc_probe_3380) 353 + IRQCHIP_PLATFORM_DRIVER_END(bcm7120_l2) 354 + MODULE_DESCRIPTION("Broadcom STB 7120-style L2 interrupt controller driver"); 355 + MODULE_LICENSE("GPL v2");