[PATCH ath-next 2/2] wifi: ath12k: ahb: Fix IRQ status flag cleanup
Aaradhana Sahu
aaradhana.sahu at oss.qualcomm.com
Mon Nov 23 22:57:38 PST 2026
Clear IRQ_NOAUTOEN and IRQ_DISABLE_UNLAZY status flags for all
configured external IRQs during cleanup to avoid leaving stale
flags on IRQs requested successfully before a subsequent IRQ
configuration failure.
Update ab->irq_num[] only after devm_request_irq() succeeds to
avoid storing an IRQ number for which the driver failed to
register the interrupt handler.
Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.6-01275-QCAHKSWPL_SILICONZ-1
Fixes: 6cee30f0da75 ("wifi: ath12k: add AHB driver support for IPQ5332")
Signed-off-by: Aaradhana Sahu <aaradhana.sahu at oss.qualcomm.com>
---
drivers/net/wireless/ath/ath12k/ahb.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index 64e4a6c5affb..030b1ec68b53 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -200,12 +200,27 @@ static void ath12k_ahb_free_napi_for_group(struct ath12k_ext_irq_grp *irq_grp)
irq_grp->napi_ndev = NULL;
}
-static void ath12k_ahb_free_napi(struct ath12k_base *ab, int num_ext_irq_grp)
+static void ath12k_ahb_clear_irq_flags(struct ath12k_base *ab,
+ struct ath12k_ext_irq_grp *irq_grp,
+ int count)
{
int i;
- for (i = 0; i < num_ext_irq_grp; i++)
- ath12k_ahb_free_napi_for_group(&ab->ext_irq_grp[i]);
+ for (i = 0; i < count; i++)
+ irq_clear_status_flags(ab->irq_num[irq_grp->irqs[i]],
+ IRQ_NOAUTOEN | IRQ_DISABLE_UNLAZY);
+}
+
+static void ath12k_ahb_cleanup_ext_irq(struct ath12k_base *ab, int num_ext_irq_grp)
+{
+ int i;
+
+ for (i = 0; i < num_ext_irq_grp; i++) {
+ struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i];
+
+ ath12k_ahb_clear_irq_flags(ab, irq_grp, irq_grp->num_irq);
+ ath12k_ahb_free_napi_for_group(irq_grp);
+ }
}
static void ath12k_ahb_free_config_irq(struct ath12k_base *ab)
@@ -215,7 +230,7 @@ static void ath12k_ahb_free_config_irq(struct ath12k_base *ab)
return;
}
- ath12k_ahb_free_napi(ab, ATH12K_EXT_IRQ_GRP_NUM_MAX);
+ ath12k_ahb_cleanup_ext_irq(ab, ATH12K_EXT_IRQ_GRP_NUM_MAX);
}
static void ath12k_ahb_ext_grp_enable(struct ath12k_ext_irq_grp *irq_grp)
@@ -705,11 +720,11 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
ath12k_warn(ab, "failed to get irq %s: %d\n",
irq_name[irq_idx], irq);
ret = irq;
+ ath12k_ahb_clear_irq_flags(ab, irq_grp, j);
ath12k_ahb_free_napi_for_group(irq_grp);
goto free_napi_ndev;
}
- ab->irq_num[irq_idx] = irq;
irq_set_status_flags(irq, IRQ_NOAUTOEN | IRQ_DISABLE_UNLAZY);
ret = devm_request_irq(ab->dev, irq,
ath12k_ahb_ext_interrupt_handler,
@@ -717,16 +732,21 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
irq_name[irq_idx], irq_grp);
if (ret) {
ath12k_warn(ab, "failed request_irq for %d\n", irq);
+ irq_clear_status_flags(irq, IRQ_NOAUTOEN |
+ IRQ_DISABLE_UNLAZY);
+ ath12k_ahb_clear_irq_flags(ab, irq_grp, j);
ath12k_ahb_free_napi_for_group(irq_grp);
goto free_napi_ndev;
}
+
+ ab->irq_num[irq_idx] = irq;
}
}
return 0;
free_napi_ndev:
- ath12k_ahb_free_napi(ab, i);
+ ath12k_ahb_cleanup_ext_irq(ab, i);
return ret;
}
--
2.34.1
More information about the ath12k
mailing list