From patchwork Thu Nov 15 02:46:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franky Lin X-Patchwork-Id: 1745181 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E15A83FCF7 for ; Thu, 15 Nov 2012 02:47:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933255Ab2KOCq7 (ORCPT ); Wed, 14 Nov 2012 21:46:59 -0500 Received: from mms1.broadcom.com ([216.31.210.17]:3249 "EHLO mms1.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933193Ab2KOCqc (ORCPT ); Wed, 14 Nov 2012 21:46:32 -0500 Received: from [10.9.200.133] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Wed, 14 Nov 2012 18:44:39 -0800 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.247.2; Wed, 14 Nov 2012 18:46:02 -0800 Received: from mail-sj1-12.sj.broadcom.com (mail-sj1-12.sj.broadcom.com [10.17.16.106]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 83D2440FE5; Wed, 14 Nov 2012 18:46:28 -0800 (PST) Received: from lc-sj1-3560.broadcom.com (lc-sj1-3560.sj.broadcom.com [10.17.194.250]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id C0F9A207DB; Wed, 14 Nov 2012 18:46:24 -0800 (PST) Received: by lc-sj1-3560.broadcom.com (Postfix, from userid 25250) id A2AE5F88E51; Wed, 14 Nov 2012 18:46:23 -0800 (PST) From: "Franky Lin" To: linville@tuxdriver.com cc: linux-wireless@vger.kernel.org, "Arend van Spriel" Subject: [PATCH 11/19] brcmfmac: ignore IF event if it is a add for ifidx 0 Date: Wed, 14 Nov 2012 18:46:15 -0800 Message-ID: <1352947583-25341-12-git-send-email-frankyl@broadcom.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1352947583-25341-1-git-send-email-frankyl@broadcom.com> References: <1352947583-25341-1-git-send-email-frankyl@broadcom.com> MIME-Version: 1.0 X-WSS-ID: 7CBA889D1QK2801634-02-01 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arend van Spriel 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 --- .../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 51cbc72..a39ea20 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 283acee..7b57b89 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",