diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-11-01 12:08:36 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:46 -0500 |
commit | 1603b5aca4f15b34848fb5594d0c7b6333b99144 (patch) | |
tree | 79272aa41d6510b7256df62e287676885c3960cf /arch/mips/emma2rh | |
parent | c87b6ebaea034c0e0ce86127870cf1511a307b64 (diff) |
[MIPS] IRQ cleanups
This is a big irq cleanup patch.
* Use set_irq_chip() to register irq_chip.
* Initialize .mask, .unmask, .mask_ack field. Functions for these
method are already exist in most case.
* Do not initialize .startup, .shutdown, .enable, .disable fields if
default routines provided by irq_chip_set_defaults() were suitable.
* Remove redundant irq_desc initializations.
* Remove unnecessary local_irq_save/local_irq_restore, spin_lock.
With this cleanup, it would be easy to switch to slightly lightwait
irq flow handlers (handle_level_irq(), etc.) instead of __do_IRQ().
Though whole this patch is quite large, changes in each irq_chip are
not quite simple. Please review and test on your platform. Thanks.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/emma2rh')
-rw-r--r-- | arch/mips/emma2rh/common/irq_emma2rh.c | 34 | ||||
-rw-r--r-- | arch/mips/emma2rh/markeins/irq_markeins.c | 55 |
2 files changed, 17 insertions, 72 deletions
diff --git a/arch/mips/emma2rh/common/irq_emma2rh.c b/arch/mips/emma2rh/common/irq_emma2rh.c index 197ed4c2ba04..bf1b83ba925e 100644 --- a/arch/mips/emma2rh/common/irq_emma2rh.c +++ b/arch/mips/emma2rh/common/irq_emma2rh.c | |||
@@ -56,22 +56,6 @@ static void emma2rh_irq_disable(unsigned int irq) | |||
56 | ll_emma2rh_irq_disable(irq - emma2rh_irq_base); | 56 | ll_emma2rh_irq_disable(irq - emma2rh_irq_base); |
57 | } | 57 | } |
58 | 58 | ||
59 | static unsigned int emma2rh_irq_startup(unsigned int irq) | ||
60 | { | ||
61 | emma2rh_irq_enable(irq); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | #define emma2rh_irq_shutdown emma2rh_irq_disable | ||
66 | |||
67 | static void emma2rh_irq_ack(unsigned int irq) | ||
68 | { | ||
69 | /* disable interrupt - some handler will re-enable the irq | ||
70 | * and if the interrupt is leveled, we will have infinite loop | ||
71 | */ | ||
72 | ll_emma2rh_irq_disable(irq - emma2rh_irq_base); | ||
73 | } | ||
74 | |||
75 | static void emma2rh_irq_end(unsigned int irq) | 59 | static void emma2rh_irq_end(unsigned int irq) |
76 | { | 60 | { |
77 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | 61 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) |
@@ -80,25 +64,19 @@ static void emma2rh_irq_end(unsigned int irq) | |||
80 | 64 | ||
81 | struct irq_chip emma2rh_irq_controller = { | 65 | struct irq_chip emma2rh_irq_controller = { |
82 | .typename = "emma2rh_irq", | 66 | .typename = "emma2rh_irq", |
83 | .startup = emma2rh_irq_startup, | 67 | .ack = emma2rh_irq_disable, |
84 | .shutdown = emma2rh_irq_shutdown, | 68 | .mask = emma2rh_irq_disable, |
85 | .enable = emma2rh_irq_enable, | 69 | .mask_ack = emma2rh_irq_disable, |
86 | .disable = emma2rh_irq_disable, | 70 | .unmask = emma2rh_irq_enable, |
87 | .ack = emma2rh_irq_ack, | ||
88 | .end = emma2rh_irq_end, | 71 | .end = emma2rh_irq_end, |
89 | .set_affinity = NULL /* no affinity stuff for UP */ | ||
90 | }; | 72 | }; |
91 | 73 | ||
92 | void emma2rh_irq_init(u32 irq_base) | 74 | void emma2rh_irq_init(u32 irq_base) |
93 | { | 75 | { |
94 | u32 i; | 76 | u32 i; |
95 | 77 | ||
96 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++) { | 78 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++) |
97 | irq_desc[i].status = IRQ_DISABLED; | 79 | set_irq_chip(i, &emma2rh_irq_controller); |
98 | irq_desc[i].action = NULL; | ||
99 | irq_desc[i].depth = 1; | ||
100 | irq_desc[i].chip = &emma2rh_irq_controller; | ||
101 | } | ||
102 | 80 | ||
103 | emma2rh_irq_base = irq_base; | 81 | emma2rh_irq_base = irq_base; |
104 | } | 82 | } |
diff --git a/arch/mips/emma2rh/markeins/irq_markeins.c b/arch/mips/emma2rh/markeins/irq_markeins.c index 0b36eb001e62..8e5f08a4245d 100644 --- a/arch/mips/emma2rh/markeins/irq_markeins.c +++ b/arch/mips/emma2rh/markeins/irq_markeins.c | |||
@@ -48,19 +48,6 @@ static void emma2rh_sw_irq_disable(unsigned int irq) | |||
48 | ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base); | 48 | ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base); |
49 | } | 49 | } |
50 | 50 | ||
51 | static unsigned int emma2rh_sw_irq_startup(unsigned int irq) | ||
52 | { | ||
53 | emma2rh_sw_irq_enable(irq); | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | #define emma2rh_sw_irq_shutdown emma2rh_sw_irq_disable | ||
58 | |||
59 | static void emma2rh_sw_irq_ack(unsigned int irq) | ||
60 | { | ||
61 | ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base); | ||
62 | } | ||
63 | |||
64 | static void emma2rh_sw_irq_end(unsigned int irq) | 51 | static void emma2rh_sw_irq_end(unsigned int irq) |
65 | { | 52 | { |
66 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | 53 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) |
@@ -69,25 +56,19 @@ static void emma2rh_sw_irq_end(unsigned int irq) | |||
69 | 56 | ||
70 | struct irq_chip emma2rh_sw_irq_controller = { | 57 | struct irq_chip emma2rh_sw_irq_controller = { |
71 | .typename = "emma2rh_sw_irq", | 58 | .typename = "emma2rh_sw_irq", |
72 | .startup = emma2rh_sw_irq_startup, | 59 | .ack = emma2rh_sw_irq_disable, |
73 | .shutdown = emma2rh_sw_irq_shutdown, | 60 | .mask = emma2rh_sw_irq_disable, |
74 | .enable = emma2rh_sw_irq_enable, | 61 | .mask_ack = emma2rh_sw_irq_disable, |
75 | .disable = emma2rh_sw_irq_disable, | 62 | .unmask = emma2rh_sw_irq_enable, |
76 | .ack = emma2rh_sw_irq_ack, | ||
77 | .end = emma2rh_sw_irq_end, | 63 | .end = emma2rh_sw_irq_end, |
78 | .set_affinity = NULL, | ||
79 | }; | 64 | }; |
80 | 65 | ||
81 | void emma2rh_sw_irq_init(u32 irq_base) | 66 | void emma2rh_sw_irq_init(u32 irq_base) |
82 | { | 67 | { |
83 | u32 i; | 68 | u32 i; |
84 | 69 | ||
85 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++) { | 70 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++) |
86 | irq_desc[i].status = IRQ_DISABLED; | 71 | set_irq_chip(i, &emma2rh_sw_irq_controller); |
87 | irq_desc[i].action = NULL; | ||
88 | irq_desc[i].depth = 2; | ||
89 | irq_desc[i].chip = &emma2rh_sw_irq_controller; | ||
90 | } | ||
91 | 72 | ||
92 | emma2rh_sw_irq_base = irq_base; | 73 | emma2rh_sw_irq_base = irq_base; |
93 | } | 74 | } |
@@ -126,14 +107,6 @@ static void emma2rh_gpio_irq_disable(unsigned int irq) | |||
126 | ll_emma2rh_gpio_irq_disable(irq - emma2rh_gpio_irq_base); | 107 | ll_emma2rh_gpio_irq_disable(irq - emma2rh_gpio_irq_base); |
127 | } | 108 | } |
128 | 109 | ||
129 | static unsigned int emma2rh_gpio_irq_startup(unsigned int irq) | ||
130 | { | ||
131 | emma2rh_gpio_irq_enable(irq); | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | #define emma2rh_gpio_irq_shutdown emma2rh_gpio_irq_disable | ||
136 | |||
137 | static void emma2rh_gpio_irq_ack(unsigned int irq) | 110 | static void emma2rh_gpio_irq_ack(unsigned int irq) |
138 | { | 111 | { |
139 | irq -= emma2rh_gpio_irq_base; | 112 | irq -= emma2rh_gpio_irq_base; |
@@ -149,25 +122,19 @@ static void emma2rh_gpio_irq_end(unsigned int irq) | |||
149 | 122 | ||
150 | struct irq_chip emma2rh_gpio_irq_controller = { | 123 | struct irq_chip emma2rh_gpio_irq_controller = { |
151 | .typename = "emma2rh_gpio_irq", | 124 | .typename = "emma2rh_gpio_irq", |
152 | .startup = emma2rh_gpio_irq_startup, | ||
153 | .shutdown = emma2rh_gpio_irq_shutdown, | ||
154 | .enable = emma2rh_gpio_irq_enable, | ||
155 | .disable = emma2rh_gpio_irq_disable, | ||
156 | .ack = emma2rh_gpio_irq_ack, | 125 | .ack = emma2rh_gpio_irq_ack, |
126 | .mask = emma2rh_gpio_irq_disable, | ||
127 | .mask_ack = emma2rh_gpio_irq_ack, | ||
128 | .unmask = emma2rh_gpio_irq_enable, | ||
157 | .end = emma2rh_gpio_irq_end, | 129 | .end = emma2rh_gpio_irq_end, |
158 | .set_affinity = NULL, | ||
159 | }; | 130 | }; |
160 | 131 | ||
161 | void emma2rh_gpio_irq_init(u32 irq_base) | 132 | void emma2rh_gpio_irq_init(u32 irq_base) |
162 | { | 133 | { |
163 | u32 i; | 134 | u32 i; |
164 | 135 | ||
165 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++) { | 136 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++) |
166 | irq_desc[i].status = IRQ_DISABLED; | 137 | set_irq_chip(i, &emma2rh_gpio_irq_controller); |
167 | irq_desc[i].action = NULL; | ||
168 | irq_desc[i].depth = 2; | ||
169 | irq_desc[i].chip = &emma2rh_gpio_irq_controller; | ||
170 | } | ||
171 | 138 | ||
172 | emma2rh_gpio_irq_base = irq_base; | 139 | emma2rh_gpio_irq_base = irq_base; |
173 | } | 140 | } |