From 86e9826f044b17f6a5b31c72fe4ed549327a4ecc Mon Sep 17 00:00:00 2001 From: Ravi Joshi Date: Wed, 1 Mar 2017 13:47:03 -0800 Subject: [PATCH] qcacmn: Fix interrupt handling after pdev deinit The interrupt polling timer needs to be disabled when the host device driver decides to unload. Not handling this would cause in processing of pending interrupts and access data structures that are being deinitialized causing system instability. Change-Id: I505281f36f90bef6e1fbf21a5461260272f7c7cb CRs-Fixed: 2013609 --- dp/wifi3.0/dp_main.c | 15 +++++++++------ dp/wifi3.0/dp_types.h | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 88620eaedb5a..07fd071690c8 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -234,10 +234,13 @@ static void dp_interrupt_timer(void *arg) struct dp_soc *soc = (struct dp_soc *) arg; int i; - for (i = 0 ; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) - dp_service_srngs(&soc->intr_ctx[i], 0xffff); + if (qdf_atomic_read(&soc->cmn_init_done)) { + for (i = 0; + i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) + dp_service_srngs(&soc->intr_ctx[i], 0xffff); - qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); + qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); + } } /* @@ -716,7 +719,7 @@ static int dp_soc_cmn_setup(struct dp_soc *soc) { int i; - if (soc->cmn_init_done) + if (qdf_atomic_read(&soc->cmn_init_done)) return 0; if (dp_peer_find_attach(soc)) @@ -857,7 +860,7 @@ static int dp_soc_cmn_setup(struct dp_soc *soc) /* Setup HW REO */ hal_reo_setup(soc->hal_soc); - soc->cmn_init_done = 1; + qdf_atomic_set(&soc->cmn_init_done, 1); return 0; fail1: /* @@ -1152,7 +1155,7 @@ static void dp_soc_detach_wifi3(void *txrx_soc) struct dp_soc *soc = (struct dp_soc *)txrx_soc; int i; - soc->cmn_init_done = 0; + qdf_atomic_set(&soc->cmn_init_done, 0); dp_soc_interrupt_detach(soc); diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index d4e69f6764c8..e712284bcdd9 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -281,7 +281,7 @@ struct dp_soc { void *htt_handle; /* Commint init done */ - bool cmn_init_done; + qdf_atomic_t cmn_init_done; /* Opaque hif handle */ struct hif_opaque_softc *hif_handle;