From b522dd8071947be7f62e75d7de5b6b3de0d882f5 Mon Sep 17 00:00:00 2001 From: Arend van Spriel Date: Wed, 14 Nov 2012 18:46:15 -0800 Subject: [PATCH] brcmfmac: ignore IF event if it is a add for ifidx 0 Firmware fires IF event to add the primary interface but that is already created in the driver. Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Hante Meuleman Signed-off-by: Arend van Spriel Signed-off-by: Franky Lin Signed-off-by: John W. Linville --- .../net/wireless/brcm80211/brcmfmac/dhd_linux.c | 15 ++++++++++----- drivers/net/wireless/brcm80211/brcmfmac/fweh.c | 7 +++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 51cbc7234583..a39ea20403b0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -696,12 +696,17 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, int ifidx, s32 bssidx, * in case we missed the BRCMF_E_IF_DEL event. */ if (ifp) { - brcmf_dbg(ERROR, "ERROR: netdev:%s already exists, try free & unregister\n", + brcmf_dbg(ERROR, "ERROR: netdev:%s already exists\n", ifp->ndev->name); - netif_stop_queue(ifp->ndev); - unregister_netdev(ifp->ndev); - free_netdev(ifp->ndev); - drvr->iflist[ifidx] = NULL; + if (ifidx) { + netif_stop_queue(ifp->ndev); + unregister_netdev(ifp->ndev); + free_netdev(ifp->ndev); + drvr->iflist[ifidx] = NULL; + } else { + brcmf_dbg(ERROR, "ignore IF event\n"); + return ERR_PTR(-EINVAL); + } } /* Allocate netdev, including space for private structure */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 283acee1798b..7b57b8902a34 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c @@ -402,7 +402,8 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, return -ENOSPC; } drvr->fweh.evt_handler[code] = handler; - brcmf_dbg(TRACE, "event handler registered for code %d\n", code); + brcmf_dbg(TRACE, "event handler registered for %s\n", + brcmf_fweh_event_name(code)); return 0; } @@ -415,7 +416,8 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, void brcmf_fweh_unregister(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code) { - brcmf_dbg(TRACE, "event handler cleared for code %d\n", code); + brcmf_dbg(TRACE, "event handler cleared for %s\n", + brcmf_fweh_event_name(code)); drvr->fweh.evt_handler[code] = NULL; } @@ -438,6 +440,7 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp) } /* want to handle IF event as well */ + brcmf_dbg(EVENT, "enable event IF\n"); setbit(eventmask, BRCMF_E_IF); err = brcmf_fil_iovar_data_set(ifp, "event_msgs", -- 2.30.2