Browse Source

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>
Charles Keepax 11 years ago
parent
commit
30a2af3a32
2 changed files with 14 additions and 7 deletions
  1. 12 7
      drivers/mfd/arizona-irq.c
  2. 2 0
      include/linux/mfd/arizona/core.h

+ 12 - 7
drivers/mfd/arizona-irq.c

@@ -188,16 +188,17 @@ int arizona_irq_init(struct arizona *arizona)
 	int flags = IRQF_ONESHOT;
 	int flags = IRQF_ONESHOT;
 	int ret, i;
 	int ret, i;
 	const struct regmap_irq_chip *aod, *irq;
 	const struct regmap_irq_chip *aod, *irq;
-	bool ctrlif_error = true;
 	struct irq_data *irq_data;
 	struct irq_data *irq_data;
 
 
+	arizona->ctrlif_error = true;
+
 	switch (arizona->type) {
 	switch (arizona->type) {
 #ifdef CONFIG_MFD_WM5102
 #ifdef CONFIG_MFD_WM5102
 	case WM5102:
 	case WM5102:
 		aod = &wm5102_aod;
 		aod = &wm5102_aod;
 		irq = &wm5102_irq;
 		irq = &wm5102_irq;
 
 
-		ctrlif_error = false;
+		arizona->ctrlif_error = false;
 		break;
 		break;
 #endif
 #endif
 #ifdef CONFIG_MFD_WM5110
 #ifdef CONFIG_MFD_WM5110
@@ -213,7 +214,7 @@ int arizona_irq_init(struct arizona *arizona)
 			break;
 			break;
 		}
 		}
 
 
-		ctrlif_error = false;
+		arizona->ctrlif_error = false;
 		break;
 		break;
 #endif
 #endif
 #ifdef CONFIG_MFD_WM8997
 #ifdef CONFIG_MFD_WM8997
@@ -221,7 +222,7 @@ int arizona_irq_init(struct arizona *arizona)
 		aod = &wm8997_aod;
 		aod = &wm8997_aod;
 		irq = &wm8997_irq;
 		irq = &wm8997_irq;
 
 
-		ctrlif_error = false;
+		arizona->ctrlif_error = false;
 		break;
 		break;
 #endif
 #endif
 	default:
 	default:
@@ -308,7 +309,7 @@ int arizona_irq_init(struct arizona *arizona)
 	}
 	}
 
 
 	/* Handle control interface errors in the core */
 	/* Handle control interface errors in the core */
-	if (ctrlif_error) {
+	if (arizona->ctrlif_error) {
 		i = arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR);
 		i = arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR);
 		ret = request_threaded_irq(i, NULL, arizona_ctrlif_err,
 		ret = request_threaded_irq(i, NULL, arizona_ctrlif_err,
 					   IRQF_ONESHOT,
 					   IRQF_ONESHOT,
@@ -353,7 +354,9 @@ int arizona_irq_init(struct arizona *arizona)
 	return 0;
 	return 0;
 
 
 err_main_irq:
 err_main_irq:
-	free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR), arizona);
+	if (arizona->ctrlif_error)
+		free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR),
+			 arizona);
 err_ctrlif:
 err_ctrlif:
 	free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona);
 	free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona);
 err_boot_done:
 err_boot_done:
@@ -369,7 +372,9 @@ err:
 
 
 int arizona_irq_exit(struct arizona *arizona)
 int arizona_irq_exit(struct arizona *arizona)
 {
 {
-	free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR), arizona);
+	if (arizona->ctrlif_error)
+		free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_CTRLIF_ERR),
+			 arizona);
 	free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona);
 	free_irq(arizona_map_irq(arizona, ARIZONA_IRQ_BOOT_DONE), arizona);
 	regmap_del_irq_chip(irq_create_mapping(arizona->virq, 1),
 	regmap_del_irq_chip(irq_create_mapping(arizona->virq, 1),
 			    arizona->irq_chip);
 			    arizona->irq_chip);

+ 2 - 0
include/linux/mfd/arizona/core.h

@@ -132,6 +132,8 @@ struct arizona {
 	struct mutex clk_lock;
 	struct mutex clk_lock;
 	int clk32k_ref;
 	int clk32k_ref;
 
 
+	bool ctrlif_error;
+
 	struct snd_soc_dapm_context *dapm;
 	struct snd_soc_dapm_context *dapm;
 };
 };