Skip to content

Commit ac8fd12

Browse files
afzalmamtsbogend
authored andcommitted
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 <[email protected]> of which one was reported by Thomas Bogendoerfer <[email protected]> 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: afzal mohammed <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 792a402 commit ac8fd12

File tree

42 files changed

+240
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+240
-413
lines changed

arch/mips/alchemy/common/time.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ static struct clock_event_device au1x_rtcmatch2_clockdev = {
7272
.cpumask = cpu_possible_mask,
7373
};
7474

75-
static struct irqaction au1x_rtcmatch2_irqaction = {
76-
.handler = au1x_rtcmatch2_irq,
77-
.flags = IRQF_TIMER,
78-
.name = "timer",
79-
.dev_id = &au1x_rtcmatch2_clockdev,
80-
};
81-
8275
static int __init alchemy_time_init(unsigned int m2int)
8376
{
8477
struct clock_event_device *cd = &au1x_rtcmatch2_clockdev;
@@ -130,7 +123,9 @@ static int __init alchemy_time_init(unsigned int m2int)
130123
cd->min_delta_ns = clockevent_delta2ns(9, cd);
131124
cd->min_delta_ticks = 9; /* ~0.28ms */
132125
clockevents_register_device(cd);
133-
setup_irq(m2int, &au1x_rtcmatch2_irqaction);
126+
if (request_irq(m2int, au1x_rtcmatch2_irq, IRQF_TIMER, "timer",
127+
&au1x_rtcmatch2_clockdev))
128+
pr_err("Failed to register timer interrupt\n");
134129

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

arch/mips/ar7/irq.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ static struct irq_chip ar7_sec_irq_type = {
8383
.irq_ack = ar7_ack_sec_irq,
8484
};
8585

86-
static struct irqaction ar7_cascade_action = {
87-
.handler = no_action,
88-
.name = "AR7 cascade interrupt",
89-
.flags = IRQF_NO_THREAD,
90-
};
91-
9286
static void __init ar7_irq_init(int base)
9387
{
9488
int i;
@@ -116,8 +110,14 @@ static void __init ar7_irq_init(int base)
116110
handle_level_irq);
117111
}
118112

119-
setup_irq(2, &ar7_cascade_action);
120-
setup_irq(ar7_irq_base, &ar7_cascade_action);
113+
if (request_irq(2, no_action, IRQF_NO_THREAD, "AR7 cascade interrupt",
114+
NULL))
115+
pr_err("Failed to request irq 2 (AR7 cascade interrupt)\n");
116+
if (request_irq(ar7_irq_base, no_action, IRQF_NO_THREAD,
117+
"AR7 cascade interrupt", NULL)) {
118+
pr_err("Failed to request irq %d (AR7 cascade interrupt)\n",
119+
ar7_irq_base);
120+
}
121121
set_c0_status(IE_IRQ0);
122122
}
123123

arch/mips/ath25/ar2315.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ static irqreturn_t ar2315_ahb_err_handler(int cpl, void *dev_id)
6464
return IRQ_HANDLED;
6565
}
6666

67-
static struct irqaction ar2315_ahb_err_interrupt = {
68-
.handler = ar2315_ahb_err_handler,
69-
.name = "ar2315-ahb-error",
70-
};
71-
7267
static void ar2315_misc_irq_handler(struct irq_desc *desc)
7368
{
7469
u32 pending = ar2315_rst_reg_read(AR2315_ISR) &
@@ -159,7 +154,9 @@ void __init ar2315_arch_init_irq(void)
159154
panic("Failed to add IRQ domain");
160155

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

164161
irq_set_chained_handler_and_data(AR2315_IRQ_MISC,
165162
ar2315_misc_irq_handler, domain);

arch/mips/ath25/ar5312.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ static irqreturn_t ar5312_ahb_err_handler(int cpl, void *dev_id)
6868
return IRQ_HANDLED;
6969
}
7070

71-
static struct irqaction ar5312_ahb_err_interrupt = {
72-
.handler = ar5312_ahb_err_handler,
73-
.name = "ar5312-ahb-error",
74-
};
75-
7671
static void ar5312_misc_irq_handler(struct irq_desc *desc)
7772
{
7873
u32 pending = ar5312_rst_reg_read(AR5312_ISR) &
@@ -154,7 +149,9 @@ void __init ar5312_arch_init_irq(void)
154149
panic("Failed to add IRQ domain");
155150

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

159156
irq_set_chained_handler_and_data(AR5312_IRQ_MISC,
160157
ar5312_misc_irq_handler, domain);

arch/mips/bcm63xx/irq.c

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -399,26 +399,6 @@ static struct irq_chip bcm63xx_external_irq_chip = {
399399
.irq_set_type = bcm63xx_external_irq_set_type,
400400
};
401401

402-
static struct irqaction cpu_ip2_cascade_action = {
403-
.handler = no_action,
404-
.name = "cascade_ip2",
405-
.flags = IRQF_NO_THREAD,
406-
};
407-
408-
#ifdef CONFIG_SMP
409-
static struct irqaction cpu_ip3_cascade_action = {
410-
.handler = no_action,
411-
.name = "cascade_ip3",
412-
.flags = IRQF_NO_THREAD,
413-
};
414-
#endif
415-
416-
static struct irqaction cpu_ext_cascade_action = {
417-
.handler = no_action,
418-
.name = "cascade_extirq",
419-
.flags = IRQF_NO_THREAD,
420-
};
421-
422402
static void bcm63xx_init_irq(void)
423403
{
424404
int irq_bits;
@@ -531,7 +511,7 @@ static void bcm63xx_init_irq(void)
531511

532512
void __init arch_init_irq(void)
533513
{
534-
int i;
514+
int i, irq;
535515

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

546526
if (!is_ext_irq_cascaded) {
547-
for (i = 3; i < 3 + ext_irq_count; ++i)
548-
setup_irq(MIPS_CPU_IRQ_BASE + i, &cpu_ext_cascade_action);
527+
for (i = 3; i < 3 + ext_irq_count; ++i) {
528+
irq = MIPS_CPU_IRQ_BASE + i;
529+
if (request_irq(irq, no_action, IRQF_NO_THREAD,
530+
"cascade_extirq", NULL)) {
531+
pr_err("Failed to request irq %d (cascade_extirq)\n",
532+
irq);
533+
}
534+
}
549535
}
550536

551-
setup_irq(MIPS_CPU_IRQ_BASE + 2, &cpu_ip2_cascade_action);
537+
irq = MIPS_CPU_IRQ_BASE + 2;
538+
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade_ip2", NULL))
539+
pr_err("Failed to request irq %d (cascade_ip2)\n", irq);
552540
#ifdef CONFIG_SMP
553541
if (is_ext_irq_cascaded) {
554-
setup_irq(MIPS_CPU_IRQ_BASE + 3, &cpu_ip3_cascade_action);
542+
irq = MIPS_CPU_IRQ_BASE + 3;
543+
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade_ip3",
544+
NULL))
545+
pr_err("Failed to request irq %d (cascade_ip3)\n", irq);
555546
bcm63xx_internal_irq_chip.irq_set_affinity =
556547
bcm63xx_internal_set_affinity;
557548

arch/mips/cobalt/irq.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,20 @@ asmlinkage void plat_irq_dispatch(void)
4545
spurious_interrupt();
4646
}
4747

48-
static struct irqaction cascade = {
49-
.handler = no_action,
50-
.name = "cascade",
51-
.flags = IRQF_NO_THREAD,
52-
};
53-
5448
void __init arch_init_irq(void)
5549
{
5650
mips_cpu_irq_init();
5751
gt641xx_irq_init();
5852
init_i8259_irqs();
5953

60-
setup_irq(GT641XX_CASCADE_IRQ, &cascade);
61-
setup_irq(I8259_CASCADE_IRQ, &cascade);
54+
if (request_irq(GT641XX_CASCADE_IRQ, no_action, IRQF_NO_THREAD,
55+
"cascade", NULL)) {
56+
pr_err("Failed to request irq %d (cascade)\n",
57+
GT641XX_CASCADE_IRQ);
58+
}
59+
if (request_irq(I8259_CASCADE_IRQ, no_action, IRQF_NO_THREAD,
60+
"cascade", NULL)) {
61+
pr_err("Failed to request irq %d (cascade)\n",
62+
I8259_CASCADE_IRQ);
63+
}
6264
}

arch/mips/dec/setup.c

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,8 @@ int_ptr asic_mask_nr_tbl[DEC_MAX_ASIC_INTS][2] = {
103103
int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_CPU_INR_FPU);
104104
int *fpu_kstat_irq;
105105

106-
static struct irqaction ioirq = {
107-
.handler = no_action,
108-
.name = "cascade",
109-
.flags = IRQF_NO_THREAD,
110-
};
111-
static struct irqaction fpuirq = {
112-
.handler = no_action,
113-
.name = "fpu",
114-
.flags = IRQF_NO_THREAD,
115-
};
116-
117-
static struct irqaction busirq = {
118-
.name = "bus error",
119-
.flags = IRQF_NO_THREAD,
120-
};
121-
122-
static struct irqaction haltirq = {
123-
.handler = dec_intr_halt,
124-
.name = "halt",
125-
.flags = IRQF_NO_THREAD,
126-
};
127-
106+
static irq_handler_t busirq_handler;
107+
static unsigned int busirq_flags = IRQF_NO_THREAD;
128108

129109
/*
130110
* Bus error (DBE/IBE exceptions and bus interrupts) handling setup.
@@ -134,21 +114,21 @@ static void __init dec_be_init(void)
134114
switch (mips_machtype) {
135115
case MACH_DS23100: /* DS2100/DS3100 Pmin/Pmax */
136116
board_be_handler = dec_kn01_be_handler;
137-
busirq.handler = dec_kn01_be_interrupt;
138-
busirq.flags |= IRQF_SHARED;
117+
busirq_handler = dec_kn01_be_interrupt;
118+
busirq_flags |= IRQF_SHARED;
139119
dec_kn01_be_init();
140120
break;
141121
case MACH_DS5000_1XX: /* DS5000/1xx 3min */
142122
case MACH_DS5000_XX: /* DS5000/xx Maxine */
143123
board_be_handler = dec_kn02xa_be_handler;
144-
busirq.handler = dec_kn02xa_be_interrupt;
124+
busirq_handler = dec_kn02xa_be_interrupt;
145125
dec_kn02xa_be_init();
146126
break;
147127
case MACH_DS5000_200: /* DS5000/200 3max */
148128
case MACH_DS5000_2X0: /* DS5000/240 3max+ */
149129
case MACH_DS5900: /* DS5900 bigmax */
150130
board_be_handler = dec_ecc_be_handler;
151-
busirq.handler = dec_ecc_be_interrupt;
131+
busirq_handler = dec_ecc_be_interrupt;
152132
dec_ecc_be_init();
153133
break;
154134
}
@@ -764,20 +744,29 @@ void __init arch_init_irq(void)
764744
int irq_fpu;
765745

766746
irq_fpu = dec_interrupt[DEC_IRQ_FPU];
767-
setup_irq(irq_fpu, &fpuirq);
747+
if (request_irq(irq_fpu, no_action, IRQF_NO_THREAD, "fpu",
748+
NULL))
749+
pr_err("Failed to register fpu interrupt\n");
768750
desc_fpu = irq_to_desc(irq_fpu);
769751
fpu_kstat_irq = this_cpu_ptr(desc_fpu->kstat_irqs);
770752
}
771-
if (dec_interrupt[DEC_IRQ_CASCADE] >= 0)
772-
setup_irq(dec_interrupt[DEC_IRQ_CASCADE], &ioirq);
773-
753+
if (dec_interrupt[DEC_IRQ_CASCADE] >= 0) {
754+
if (request_irq(dec_interrupt[DEC_IRQ_CASCADE], no_action,
755+
IRQF_NO_THREAD, "cascade", NULL))
756+
pr_err("Failed to register cascade interrupt\n");
757+
}
774758
/* Register the bus error interrupt. */
775-
if (dec_interrupt[DEC_IRQ_BUS] >= 0 && busirq.handler)
776-
setup_irq(dec_interrupt[DEC_IRQ_BUS], &busirq);
777-
759+
if (dec_interrupt[DEC_IRQ_BUS] >= 0 && busirq_handler) {
760+
if (request_irq(dec_interrupt[DEC_IRQ_BUS], busirq_handler,
761+
busirq_flags, "bus error", NULL))
762+
pr_err("Failed to register bus error interrupt\n");
763+
}
778764
/* Register the HALT interrupt. */
779-
if (dec_interrupt[DEC_IRQ_HALT] >= 0)
780-
setup_irq(dec_interrupt[DEC_IRQ_HALT], &haltirq);
765+
if (dec_interrupt[DEC_IRQ_HALT] >= 0) {
766+
if (request_irq(dec_interrupt[DEC_IRQ_HALT], dec_intr_halt,
767+
IRQF_NO_THREAD, "halt", NULL))
768+
pr_err("Failed to register halt interrupt\n");
769+
}
781770
}
782771

783772
asmlinkage unsigned int dec_irq_dispatch(unsigned int irq)

arch/mips/emma/markeins/irq.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,6 @@ void emma2rh_gpio_irq_init(void)
153153
handle_edge_irq, "edge");
154154
}
155155

156-
static struct irqaction irq_cascade = {
157-
.handler = no_action,
158-
.flags = IRQF_NO_THREAD,
159-
.name = "cascade",
160-
.dev_id = NULL,
161-
.next = NULL,
162-
};
163-
164156
/*
165157
* the first level int-handler will jump here if it is a emma2rh irq
166158
*/
@@ -236,6 +228,7 @@ void emma2rh_irq_dispatch(void)
236228
void __init arch_init_irq(void)
237229
{
238230
u32 reg;
231+
int irq;
239232

240233
/* by default, interrupts are disabled. */
241234
emma2rh_out32(EMMA2RH_BHIF_INT_EN_0, 0);
@@ -272,9 +265,15 @@ void __init arch_init_irq(void)
272265
mips_cpu_irq_init();
273266

274267
/* setup cascade interrupts */
275-
setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade);
276-
setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade);
277-
setup_irq(MIPS_CPU_IRQ_BASE + 2, &irq_cascade);
268+
irq = EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE;
269+
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade", NULL))
270+
pr_err("Failed to request irq %d (cascade)\n", irq);
271+
irq = EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE;
272+
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade", NULL))
273+
pr_err("Failed to request irq %d (cascade)\n", irq);
274+
irq = MIPS_CPU_IRQ_BASE + 2;
275+
if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade", NULL))
276+
pr_err("Failed to request irq %d (cascade)\n", irq);
278277
}
279278

280279
asmlinkage void plat_irq_dispatch(void)

arch/mips/include/asm/sni.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#ifndef __ASM_SNI_H
1212
#define __ASM_SNI_H
1313

14+
#include <linux/irqreturn.h>
15+
1416
extern unsigned int sni_brd_type;
1517

1618
#define SNI_BRD_10 2
@@ -239,6 +241,6 @@ static inline int sni_eisa_root_init(void)
239241

240242
/* common irq stuff */
241243
extern void (*sni_hwint)(void);
242-
extern struct irqaction sni_isa_irq;
244+
extern irqreturn_t sni_isa_irq_handler(int dummy, void *p);
243245

244246
#endif /* __ASM_SNI_H */

arch/mips/jazz/irq.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,18 @@ static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
125125
return IRQ_HANDLED;
126126
}
127127

128-
static struct irqaction r4030_timer_irqaction = {
129-
.handler = r4030_timer_interrupt,
130-
.flags = IRQF_TIMER,
131-
.name = "R4030 timer",
132-
};
133-
134128
void __init plat_time_init(void)
135129
{
136130
struct clock_event_device *cd = &r4030_clockevent;
137-
struct irqaction *action = &r4030_timer_irqaction;
138131
unsigned int cpu = smp_processor_id();
139132

140133
BUG_ON(HZ != 100);
141134

142135
cd->cpumask = cpumask_of(cpu);
143136
clockevents_register_device(cd);
144-
action->dev_id = cd;
145-
setup_irq(JAZZ_TIMER_IRQ, action);
137+
if (request_irq(JAZZ_TIMER_IRQ, r4030_timer_interrupt, IRQF_TIMER,
138+
"R4030 timer", cd))
139+
pr_err("Failed to register R4030 timer interrupt\n");
146140

147141
/*
148142
* Set clock to 100Hz.

0 commit comments

Comments
 (0)