Re: [PATCH 1/3] irqchip: xilinx: Avoid __init macro usage for xilinx_intc_of_init
From: Marc Zyngier
Date: Tue Apr 27 2021 - 08:17:51 EST
On Tue, 27 Apr 2021 12:31:34 +0100,
Anirudha Sarangi <anirudha.sarangi@xxxxxxxxxx> wrote:
>
> This patch ensures that xilinx_intc_of_init API is not allocated into
> the .init.text section. Since this API calls the API set_handle_irq
> which uses __init macro to be put into .init.text section, this patch
> makes changes to ensure that set_handle_irq also does not stay in
> .init.text section.
> This patch is in preparation for the patch through which the xilinx
> intc driver will be loaded and unloaded as a module.
>
> Signed-off-by: Anirudha Sarangi <anirudha.sarangi@xxxxxxxxxx>
> ---
> drivers/irqchip/irq-xilinx-intc.c | 4 ++--
> include/linux/irq.h | 2 +-
> kernel/irq/handle.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
> index 1d3d273309bd..642733a6cbdf 100644
> --- a/drivers/irqchip/irq-xilinx-intc.c
> +++ b/drivers/irqchip/irq-xilinx-intc.c
> @@ -177,8 +177,8 @@ static void xil_intc_irq_handler(struct irq_desc *desc)
> chained_irq_exit(chip, desc);
> }
>
> -static int __init xilinx_intc_of_init(struct device_node *intc,
> - struct device_node *parent)
> +static int xilinx_intc_of_init(struct device_node *intc,
> + struct device_node *parent)
> {
> struct xintc_irq_chip *irqc;
> int ret, irq;
> diff --git a/include/linux/irq.h b/include/linux/irq.h
> index 2efde6a79b7e..252fab8074de 100644
> --- a/include/linux/irq.h
> +++ b/include/linux/irq.h
> @@ -1250,7 +1250,7 @@ int ipi_send_mask(unsigned int virq, const struct cpumask *dest);
> * Returns 0 on success, or -EBUSY if an IRQ handler has already been
> * registered.
> */
> -int __init set_handle_irq(void (*handle_irq)(struct pt_regs *));
> +int set_handle_irq(void (*handle_irq)(struct pt_regs *));
>
> /*
> * Allows interrupt handlers to find the irqchip that's been registered as the
> diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
> index 762a928e18f9..a0b18e8f5af0 100644
> --- a/kernel/irq/handle.c
> +++ b/kernel/irq/handle.c
> @@ -218,7 +218,7 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
> }
>
> #ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
> -int __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
> +int set_handle_irq(void (*handle_irq)(struct pt_regs *))
> {
> if (handle_arch_irq)
> return -EBUSY;
No, never.
This function is for a root interrupt controller. You will never be
able to use this from a module. If you are calling this from something
that isn't marked __init, this is a terrible bug.
M.
--
Without deviation from the norm, progress is not possible.