summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/arizona-irq.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-07-15 06:21:50 -0400
committerLee Jones <lee.jones@linaro.org>2014-07-28 06:01:47 -0400
commit30a2af3a320d5c0598cde08ba6e5d22a724f82e4 (patch)
treea2f1b1e2928618a6649784f4a002821efc4e05a9 /drivers/mfd/arizona-irq.c
parent6e440d27aa2212c714c8b061dea2d64cff0bc482 (diff)
mfd: arizona: Only free the CTRLIF_ERR IRQ if we requested it
We only request the control interface error IRQ if we set ctrlif_error, as such we should only free it in that situation. Otherwise we will attempt to free an IRQ we never requested and get a warning from the IRQ core. This patch moves the ctrlif_error variable into the arizona structure and checks it in all cases we free the control interface error IRQ. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/arizona-irq.c')
-rw-r--r--drivers/mfd/arizona-irq.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index e780bc40165d..d420dbc0e2b0 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -188,16 +188,17 @@ int arizona_irq_init(struct arizona *arizona)
188 int flags = IRQF_ONESHOT; 188 int flags = IRQF_ONESHOT;
189 int ret, i; 189 int ret, i;
190 const struct regmap_irq_chip *aod, *irq; 190 const struct regmap_irq_chip *aod, *irq;
191 bool ctrlif_error = true;
192 struct irq_data *irq_data; 191 struct irq_data *irq_data;
193 192
193 arizona->ctrlif_error = true;
194
194 switch (arizona->type) { 195 switch (arizona->type) {
195#ifdef CONFIG_MFD_WM5102 196#ifdef CONFIG_MFD_WM5102
196 case WM5102: 197 case WM5102:
197 aod = &wm5102_aod; 198 aod = &wm5102_aod;
198 irq = &wm5102_irq; 199 irq = &wm5102_irq;
199 200
200 ctrlif_error = false; 201 arizona->ctrlif_error = false;
201 break; 202 break;
202#endif 203#endif
203#ifdef CONFIG_MFD_WM5110 204#ifdef CONFIG_MFD_WM5110
@@ -213,7 +214,7 @@ int arizona_irq_init(struct arizona *arizona)
213 break; 214 break;
214 } 215 }
215 216
216 ctrlif_error = false; 217 arizona->ctrlif_error = false;
217 break; 218 break;
218#endif 219#endif
219#ifdef CONFIG_MFD_WM8997 220#ifdef CONFIG_MFD_WM8997
@@ -221,7 +222,7 @@ int arizona_irq_init(struct arizona *arizona)
221 aod = &wm8997_aod; 222 aod = &wm8997_aod;
222 irq = &wm8997_irq; 223 irq = &wm8997_irq;
223 224
224 ctrlif_error = false; 225 arizona->ctrlif_error = false;
225 break; 226 break;
226#endif 227#endif
227 default: 228 default:
@@ -308,7 +309,7 @@ int arizona_irq_init(struct arizona *arizona)
308 } 309 }
309 310
310 /* Handle control interface errors in the core */ 311 /* Handle control interface errors in the core */
311 if (ctrlif_error) { 312 if (arizona->ctrlif_error) {
312 i = arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR); 313 i = arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR);
313 ret = request_threaded_irq(i, NULL, arizona_ctrlif_err, 314 ret = request_threaded_irq(i, NULL, arizona_ctrlif_err,
314 IRQF_ONESHOT, 315 IRQF_ONESHOT,
@@ -353,7 +354,9 @@ int arizona_irq_init(struct arizona *arizona)
353 return 0; 354 return 0;
354 355
355err_main_irq: 356err_main_irq:
356 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR), arizona); 357 if (arizona->ctrlif_error)
358 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR),
359 arizona);
357err_ctrlif: 360err_ctrlif:
358 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona); 361 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona);
359err_boot_done: 362err_boot_done:
@@ -369,7 +372,9 @@ err:
369 372
370int arizona_irq_exit(struct arizona *arizona) 373int arizona_irq_exit(struct arizona *arizona)
371{ 374{
372 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR), arizona); 375 if (arizona->ctrlif_error)
376 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR),
377 arizona);
373 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona); 378 free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona);
374 regmap_del_irq_chip(irq_create_mapping(arizona->virq, 1), 379 regmap_del_irq_chip(irq_create_mapping(arizona->virq, 1),
375 arizona->irq_chip); 380 arizona->irq_chip);