Commit ac8fd122 authored by afzal mohammed's avatar afzal mohammed Committed by Thomas Bogendoerfer
Browse files

MIPS: Replace setup_irq() by request_irq()

request_irq() is preferred over setup_irq(). Invocations of setup_irq()
occur after memory allocators are ready.

Per tglx[1], setup_irq() existed in olden days when allocators were not
ready by the time early interrupts were initialized.

Hence replace setup_irq() by request_irq().

remove_irq() has been replaced by free_irq() as well.

There were build error's during previous version, couple of which was
reported by kbuild test robot <lkp@intel.com> of which one was reported
by Thomas Bogendoerfer <tsbogend@alpha.franken.de> as well. There were a
few more issues including build errors, those also have been fixed.

[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos



Signed-off-by: default avatarafzal mohammed <afzal.mohd.ma@gmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 792a402c
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -72,13 +72,6 @@ static struct clock_event_device au1x_rtcmatch2_clockdev = {
	.cpumask	= cpu_possible_mask,
};

static struct irqaction au1x_rtcmatch2_irqaction = {
	.handler	= au1x_rtcmatch2_irq,
	.flags		= IRQF_TIMER,
	.name		= "timer",
	.dev_id		= &au1x_rtcmatch2_clockdev,
};

static int __init alchemy_time_init(unsigned int m2int)
{
	struct clock_event_device *cd = &au1x_rtcmatch2_clockdev;
@@ -130,7 +123,9 @@ static int __init alchemy_time_init(unsigned int m2int)
	cd->min_delta_ns = clockevent_delta2ns(9, cd);
	cd->min_delta_ticks = 9;	/* ~0.28ms */
	clockevents_register_device(cd);
	setup_irq(m2int, &au1x_rtcmatch2_irqaction);
	if (request_irq(m2int, au1x_rtcmatch2_irq, IRQF_TIMER, "timer",
			&au1x_rtcmatch2_clockdev))
		pr_err("Failed to register timer interrupt\n");

	printk(KERN_INFO "Alchemy clocksource installed\n");

+8 −8
Original line number Diff line number Diff line
@@ -83,12 +83,6 @@ static struct irq_chip ar7_sec_irq_type = {
	.irq_ack = ar7_ack_sec_irq,
};

static struct irqaction ar7_cascade_action = {
	.handler = no_action,
	.name = "AR7 cascade interrupt",
	.flags = IRQF_NO_THREAD,
};

static void __init ar7_irq_init(int base)
{
	int i;
@@ -116,8 +110,14 @@ static void __init ar7_irq_init(int base)
						 handle_level_irq);
	}

	setup_irq(2, &ar7_cascade_action);
	setup_irq(ar7_irq_base, &ar7_cascade_action);
	if (request_irq(2, no_action, IRQF_NO_THREAD, "AR7 cascade interrupt",
			NULL))
		pr_err("Failed to request irq 2 (AR7 cascade interrupt)\n");
	if (request_irq(ar7_irq_base, no_action, IRQF_NO_THREAD,
			"AR7 cascade interrupt", NULL)) {
		pr_err("Failed to request irq %d (AR7 cascade interrupt)\n",
		       ar7_irq_base);
	}
	set_c0_status(IE_IRQ0);
}

+3 −6
Original line number Diff line number Diff line
@@ -64,11 +64,6 @@ static irqreturn_t ar2315_ahb_err_handler(int cpl, void *dev_id)
	return IRQ_HANDLED;
}

static struct irqaction ar2315_ahb_err_interrupt  = {
	.handler	= ar2315_ahb_err_handler,
	.name		= "ar2315-ahb-error",
};

static void ar2315_misc_irq_handler(struct irq_desc *desc)
{
	u32 pending = ar2315_rst_reg_read(AR2315_ISR) &
@@ -159,7 +154,9 @@ void __init ar2315_arch_init_irq(void)
		panic("Failed to add IRQ domain");

	irq = irq_create_mapping(domain, AR2315_MISC_IRQ_AHB);
	setup_irq(irq, &ar2315_ahb_err_interrupt);
	if (request_irq(irq, ar2315_ahb_err_handler, 0, "ar2315-ahb-error",
			NULL))
		pr_err("Failed to register ar2315-ahb-error interrupt\n");

	irq_set_chained_handler_and_data(AR2315_IRQ_MISC,
					 ar2315_misc_irq_handler, domain);
+3 −6
Original line number Diff line number Diff line
@@ -68,11 +68,6 @@ static irqreturn_t ar5312_ahb_err_handler(int cpl, void *dev_id)
	return IRQ_HANDLED;
}

static struct irqaction ar5312_ahb_err_interrupt  = {
	.handler = ar5312_ahb_err_handler,
	.name    = "ar5312-ahb-error",
};

static void ar5312_misc_irq_handler(struct irq_desc *desc)
{
	u32 pending = ar5312_rst_reg_read(AR5312_ISR) &
@@ -154,7 +149,9 @@ void __init ar5312_arch_init_irq(void)
		panic("Failed to add IRQ domain");

	irq = irq_create_mapping(domain, AR5312_MISC_IRQ_AHB_PROC);
	setup_irq(irq, &ar5312_ahb_err_interrupt);
	if (request_irq(irq, ar5312_ahb_err_handler, 0, "ar5312-ahb-error",
			NULL))
		pr_err("Failed to register ar5312-ahb-error interrupt\n");

	irq_set_chained_handler_and_data(AR5312_IRQ_MISC,
					 ar5312_misc_irq_handler, domain);
+16 −25
Original line number Diff line number Diff line
@@ -399,26 +399,6 @@ static struct irq_chip bcm63xx_external_irq_chip = {
	.irq_set_type	= bcm63xx_external_irq_set_type,
};

static struct irqaction cpu_ip2_cascade_action = {
	.handler	= no_action,
	.name		= "cascade_ip2",
	.flags		= IRQF_NO_THREAD,
};

#ifdef CONFIG_SMP
static struct irqaction cpu_ip3_cascade_action = {
	.handler	= no_action,
	.name		= "cascade_ip3",
	.flags		= IRQF_NO_THREAD,
};
#endif

static struct irqaction cpu_ext_cascade_action = {
	.handler	= no_action,
	.name		= "cascade_extirq",
	.flags		= IRQF_NO_THREAD,
};

static void bcm63xx_init_irq(void)
{
	int irq_bits;
@@ -531,7 +511,7 @@ static void bcm63xx_init_irq(void)

void __init arch_init_irq(void)
{
	int i;
	int i, irq;

	bcm63xx_init_irq();
	mips_cpu_irq_init();
@@ -544,14 +524,25 @@ void __init arch_init_irq(void)
					 handle_edge_irq);

	if (!is_ext_irq_cascaded) {
		for (i = 3; i < 3 + ext_irq_count; ++i)
			setup_irq(MIPS_CPU_IRQ_BASE + i, &cpu_ext_cascade_action);
		for (i = 3; i < 3 + ext_irq_count; ++i) {
			irq = MIPS_CPU_IRQ_BASE + i;
			if (request_irq(irq, no_action, IRQF_NO_THREAD,
					"cascade_extirq", NULL)) {
				pr_err("Failed to request irq %d (cascade_extirq)\n",
				       irq);
			}
		}
	}

	setup_irq(MIPS_CPU_IRQ_BASE + 2, &cpu_ip2_cascade_action);
	irq = MIPS_CPU_IRQ_BASE + 2;
	if (request_irq(irq, no_action, IRQF_NO_THREAD,	"cascade_ip2", NULL))
		pr_err("Failed to request irq %d (cascade_ip2)\n", irq);
#ifdef CONFIG_SMP
	if (is_ext_irq_cascaded) {
		setup_irq(MIPS_CPU_IRQ_BASE + 3, &cpu_ip3_cascade_action);
		irq = MIPS_CPU_IRQ_BASE + 3;
		if (request_irq(irq, no_action,	IRQF_NO_THREAD, "cascade_ip3",
				NULL))
			pr_err("Failed to request irq %d (cascade_ip3)\n", irq);
		bcm63xx_internal_irq_chip.irq_set_affinity =
			bcm63xx_internal_set_affinity;

Loading