diff options
author | Arend van Spriel <arend@broadcom.com> | 2012-04-11 11:52:44 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-13 14:32:51 -0400 |
commit | 3625c149d60a70f039b34a45ddec67bbff4b7053 (patch) | |
tree | 5e643bc186536d744663650dec595913eb5a8802 /drivers | |
parent | 75c49904c9dbacb83e36c3d770e86b78b0661cbb (diff) | |
download | linux-stable-3625c149d60a70f039b34a45ddec67bbff4b7053.tar.gz linux-stable-3625c149d60a70f039b34a45ddec67bbff4b7053.tar.bz2 linux-stable-3625c149d60a70f039b34a45ddec67bbff4b7053.zip |
brcm80211: fmac: remove primary mac address handling from brcmf_net_attach
The mac address for the primary interface was handled different from
the other interfaces. The code has been restructured such that the
brcmf_net_attach function treats the interfaces equal.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 153d3691f442..07836a8521de 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -843,27 +843,26 @@ static const struct net_device_ops brcmf_netdev_ops_pri = { .ndo_set_rx_mode = brcmf_netdev_set_multicast_list }; -static int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx) +static int brcmf_net_attach(struct brcmf_if *ifp) { + struct brcmf_pub *drvr = ifp->drvr; struct net_device *ndev; - u8 temp_addr[ETH_ALEN] = { - 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33}; + u8 temp_addr[ETH_ALEN]; - brcmf_dbg(TRACE, "ifidx %d\n", ifidx); + brcmf_dbg(TRACE, "ifidx %d\n", ifp->idx); - ndev = drvr->iflist[ifidx]->ndev; + ndev = drvr->iflist[ifp->idx]->ndev; ndev->netdev_ops = &brcmf_netdev_ops_pri; /* - * We have to use the primary MAC for virtual interfaces + * determine mac address to use */ - if (ifidx != 0) { - /* for virtual interfaces use the primary MAC */ + if (is_valid_ether_addr(ifp->mac_addr)) + memcpy(temp_addr, ifp->mac_addr, ETH_ALEN); + else memcpy(temp_addr, drvr->mac, ETH_ALEN); - } - - if (ifidx == 1) { + if (ifp->idx == 1) { brcmf_dbg(TRACE, "ACCESS POINT MAC:\n"); /* ACCESSPOINT INTERFACE CASE */ temp_addr[0] |= 0X02; /* set bit 2 , @@ -879,7 +878,7 @@ static int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx) memcpy(ndev->dev_addr, temp_addr, ETH_ALEN); /* attach to cfg80211 for primary interface */ - if (!ifidx) { + if (!ifp->idx) { drvr->config = brcmf_cfg80211_attach(ndev, drvr->dev, drvr); if (drvr->config == NULL) { brcmf_dbg(ERROR, "wl_cfg80211_attach failed\n"); @@ -940,7 +939,7 @@ brcmf_add_if(struct device *dev, int ifidx, char *name, u8 *mac_addr) if (mac_addr != NULL) memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN); - if (brcmf_net_attach(drvr, ifp->idx)) { + if (brcmf_net_attach(ifp)) { brcmf_dbg(ERROR, "brcmf_net_attach failed"); free_netdev(ifp->ndev); drvr->iflist[ifidx] = NULL; |