From 0cd19f01a749ffa2b59345947300bc543cd9dd7c Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Wed, 5 Oct 2011 10:48:59 -0700 Subject: [PATCH] net: wireless: bcmdhd: Fix event thread termination in case of empty queue Signed-off-by: Dmitry Shmidt --- drivers/net/wireless/bcmdhd/wl_cfg80211.c | 26 ++++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c index 1eaf512b6f2e..a576ca38db79 100644 --- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c +++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c @@ -5735,22 +5735,18 @@ static s32 wl_event_handler(void *data) SMP_RD_BARRIER_DEPENDS(); if (tsk->terminated) break; - e = wl_deq_event(wl); - if (unlikely(!e)) { - WL_ERR(("equeue empty..\n")); - DHD_OS_WAKE_UNLOCK(wl->pub); - return 0; - } - WL_DBG(("event type (%d), if idx: %d\n", e->etype, e->emsg.ifidx)); - netdev = dhd_idx2net((struct dhd_pub *)(wl->pub), e->emsg.ifidx); - if (!netdev) - netdev = wl_to_prmry_ndev(wl); - if (e->etype < WLC_E_LAST && wl->evt_handler[e->etype]) { - wl->evt_handler[e->etype] (wl, netdev, &e->emsg, e->edata); - } else { - WL_DBG(("Unknown Event (%d): ignoring\n", e->etype)); + while ((e = wl_deq_event(wl))) { + WL_DBG(("event type (%d), if idx: %d\n", e->etype, e->emsg.ifidx)); + netdev = dhd_idx2net((struct dhd_pub *)(wl->pub), e->emsg.ifidx); + if (!netdev) + netdev = wl_to_prmry_ndev(wl); + if (e->etype < WLC_E_LAST && wl->evt_handler[e->etype]) { + wl->evt_handler[e->etype] (wl, netdev, &e->emsg, e->edata); + } else { + WL_DBG(("Unknown Event (%d): ignoring\n", e->etype)); + } + wl_put_event(e); } - wl_put_event(e); DHD_OS_WAKE_UNLOCK(wl->pub); } WL_DBG(("%s was terminated\n", __func__)); -- 2.34.1