aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index f603032d3d09..b1f26b53fa27 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -779,7 +779,7 @@ static const struct net_device_ops brcmf_netdev_ops_pri = {
779 .ndo_set_rx_mode = brcmf_netdev_set_multicast_list 779 .ndo_set_rx_mode = brcmf_netdev_set_multicast_list
780}; 780};
781 781
782static int brcmf_net_attach(struct brcmf_if *ifp) 782int brcmf_net_attach(struct brcmf_if *ifp)
783{ 783{
784 struct brcmf_pub *drvr = ifp->drvr; 784 struct brcmf_pub *drvr = ifp->drvr;
785 struct net_device *ndev; 785 struct net_device *ndev;
@@ -813,15 +813,6 @@ static int brcmf_net_attach(struct brcmf_if *ifp)
813 813
814 memcpy(ndev->dev_addr, temp_addr, ETH_ALEN); 814 memcpy(ndev->dev_addr, temp_addr, ETH_ALEN);
815 815
816 /* attach to cfg80211 for primary interface */
817 if (!ifp->idx) {
818 drvr->config = brcmf_cfg80211_attach(ndev, drvr->dev, drvr);
819 if (drvr->config == NULL) {
820 brcmf_dbg(ERROR, "wl_cfg80211_attach failed\n");
821 goto fail;
822 }
823 }
824
825 if (register_netdev(ndev) != 0) { 816 if (register_netdev(ndev) != 0) {
826 brcmf_dbg(ERROR, "couldn't register the net device\n"); 817 brcmf_dbg(ERROR, "couldn't register the net device\n");
827 goto fail; 818 goto fail;
@@ -833,12 +824,12 @@ static int brcmf_net_attach(struct brcmf_if *ifp)
833 824
834fail: 825fail:
835 ndev->netdev_ops = NULL; 826 ndev->netdev_ops = NULL;
827 free_netdev(ndev);
836 return -EBADE; 828 return -EBADE;
837} 829}
838 830
839int 831struct brcmf_if *brcmf_add_if(struct device *dev, int ifidx, s32 bssidx,
840brcmf_add_if(struct device *dev, int ifidx, s32 bssidx, 832 char *name, u8 *mac_addr)
841 char *name, u8 *mac_addr)
842{ 833{
843 struct brcmf_if *ifp; 834 struct brcmf_if *ifp;
844 struct net_device *ndev; 835 struct net_device *ndev;
@@ -865,7 +856,7 @@ brcmf_add_if(struct device *dev, int ifidx, s32 bssidx,
865 ndev = alloc_netdev(sizeof(struct brcmf_if), name, ether_setup); 856 ndev = alloc_netdev(sizeof(struct brcmf_if), name, ether_setup);
866 if (!ndev) { 857 if (!ndev) {
867 brcmf_dbg(ERROR, "OOM - alloc_netdev\n"); 858 brcmf_dbg(ERROR, "OOM - alloc_netdev\n");
868 return -ENOMEM; 859 return ERR_PTR(-ENOMEM);
869 } 860 }
870 861
871 ifp = netdev_priv(ndev); 862 ifp = netdev_priv(ndev);
@@ -877,17 +868,10 @@ brcmf_add_if(struct device *dev, int ifidx, s32 bssidx,
877 if (mac_addr != NULL) 868 if (mac_addr != NULL)
878 memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN); 869 memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);
879 870
880 if (brcmf_net_attach(ifp)) {
881 brcmf_dbg(ERROR, "brcmf_net_attach failed");
882 free_netdev(ifp->ndev);
883 drvr->iflist[ifidx] = NULL;
884 return -EOPNOTSUPP;
885 }
886
887 brcmf_dbg(TRACE, " ==== pid:%x, net_device for if:%s created ===\n", 871 brcmf_dbg(TRACE, " ==== pid:%x, net_device for if:%s created ===\n",
888 current->pid, ifp->ndev->name); 872 current->pid, ifp->ndev->name);
889 873
890 return 0; 874 return ifp;
891} 875}
892 876
893void brcmf_del_if(struct brcmf_pub *drvr, int ifidx) 877void brcmf_del_if(struct brcmf_pub *drvr, int ifidx)
@@ -970,6 +954,7 @@ int brcmf_bus_start(struct device *dev)
970 char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; 954 char iovbuf[BRCMF_EVENTING_MASK_LEN + 12];
971 struct brcmf_bus *bus_if = dev_get_drvdata(dev); 955 struct brcmf_bus *bus_if = dev_get_drvdata(dev);
972 struct brcmf_pub *drvr = bus_if->drvr; 956 struct brcmf_pub *drvr = bus_if->drvr;
957 struct brcmf_if *ifp;
973 958
974 brcmf_dbg(TRACE, "\n"); 959 brcmf_dbg(TRACE, "\n");
975 960
@@ -1006,21 +991,31 @@ int brcmf_bus_start(struct device *dev)
1006 setbit(drvr->eventmask, BRCMF_E_SCAN_COMPLETE); 991 setbit(drvr->eventmask, BRCMF_E_SCAN_COMPLETE);
1007 setbit(drvr->eventmask, BRCMF_E_IF); 992 setbit(drvr->eventmask, BRCMF_E_IF);
1008 993
1009/* enable dongle roaming event */
1010
1011 drvr->pktfilter_count = 1;
1012 /* Setup filter to allow only unicast */ 994 /* Setup filter to allow only unicast */
995 drvr->pktfilter_count = 1;
1013 drvr->pktfilter[0] = "100 0 0 0 0x01 0x00"; 996 drvr->pktfilter[0] = "100 0 0 0 0x01 0x00";
1014 997
998 /* add primary networking interface */
999 ifp = brcmf_add_if(dev, 0, 0, "wlan%d", drvr->mac);
1000 if (IS_ERR(ifp))
1001 return PTR_ERR(ifp);
1002
1015 /* Bus is ready, do any protocol initialization */ 1003 /* Bus is ready, do any protocol initialization */
1016 ret = brcmf_proto_init(drvr); 1004 ret = brcmf_proto_init(drvr);
1017 if (ret < 0) 1005 if (ret < 0)
1018 return ret; 1006 return ret;
1019 1007
1020 /* add primary networking interface */ 1008 drvr->config = brcmf_cfg80211_attach(drvr);
1021 ret = brcmf_add_if(dev, 0, 0, "wlan%d", drvr->mac); 1009 if (drvr->config == NULL)
1022 if (ret < 0) 1010 return -ENOMEM;
1011
1012 ret = brcmf_net_attach(ifp);
1013 if (ret < 0) {
1014 brcmf_dbg(ERROR, "brcmf_net_attach failed");
1015 drvr->iflist[0] = NULL;
1023 return ret; 1016 return ret;
1017 }
1018
1024 1019
1025 /* signal bus ready */ 1020 /* signal bus ready */
1026 bus_if->state = BRCMF_BUS_DATA; 1021 bus_if->state = BRCMF_BUS_DATA;