Merge branches 'irq-core-for-linus' and 'core-locking-for-linus' of git://git.kernel...
[pandora-kernel.git] / drivers / staging / brcm80211 / brcmfmac / dhd_linux.c
index 20a90b2..bbbe7c5 100644 (file)
 #ifdef CONFIG_WIFI_CONTROL_FUNC
 #include <linux/platform_device.h>
 #endif
-#include <typedefs.h>
-#include <linuxver.h>
-#include <osl.h>
-
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kthread.h>
 #include <linux/ethtool.h>
 #include <linux/fcntl.h>
 #include <linux/fs.h>
-
 #include <linux/uaccess.h>
+#include <bcmdefs.h>
+#include <linuxver.h>
+#include <osl.h>
 #include <bcmutils.h>
 #include <bcmendian.h>
 
@@ -712,7 +710,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
        /* Send down the multicast list first. */
 
        buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETHER_ADDR_LEN);
-       bufp = buf = MALLOC(dhd->pub.osh, buflen);
+       bufp = buf = kmalloc(buflen, GFP_ATOMIC);
        if (!bufp) {
                DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n",
                           dhd_ifname(&dhd->pub, ifidx), cnt));
@@ -747,7 +745,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
                allmulti = cnt ? true : allmulti;
        }
 
-       MFREE(dhd->pub.osh, buf, buflen);
+       kfree(buf);
 
        /* Now send the allmulti setting.  This is based on the setting in the
         * net_device flags, but might be modified above to be turned on if we
@@ -755,7 +753,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
         */
 
        buflen = sizeof("allmulti") + sizeof(allmulti);
-       buf = MALLOC(dhd->pub.osh, buflen);
+       buf = kmalloc(buflen, GFP_ATOMIC);
        if (!buf) {
                DHD_ERROR(("%s: out of memory for allmulti\n",
                           dhd_ifname(&dhd->pub, ifidx)));
@@ -768,7 +766,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
                DHD_ERROR(("%s: mkiovar failed for allmulti, datalen %d "
                        "buflen %u\n", dhd_ifname(&dhd->pub, ifidx),
                        (int)sizeof(allmulti), buflen));
-               MFREE(dhd->pub.osh, buf, buflen);
+               kfree(buf);
                return;
        }
 
@@ -784,7 +782,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
                           dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
        }
 
-       MFREE(dhd->pub.osh, buf, buflen);
+       kfree(buf);
 
        /* Finally, pick up the PROMISC flag as well, like the NIC
                 driver does */
@@ -921,7 +919,7 @@ static void dhd_op_if(dhd_if_t *ifp)
                        free_netdev(ifp->net);
 
                dhd->iflist[ifp->idx] = NULL;
-               MFREE(dhd->pub.osh, ifp, sizeof(*ifp));
+               kfree(ifp);
 #ifdef SOFTAP
                if (ifp->net == ap_net_dev)
                        ap_net_dev = NULL;      /*  NULL  SOFTAP global
@@ -1041,10 +1039,6 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf)
                        atomic_inc(&dhd->pend_8021x_cnt);
        }
 
-       /* Look into the packet and update the packet priority */
-       if ((PKTPRIO(pktbuf) == 0))
-               pktsetprio(pktbuf, false);
-
        /* If the protocol uses a data header, apply it */
        dhd_prot_hdrpush(dhdp, ifidx, pktbuf);
 
@@ -1676,7 +1670,7 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
                   } else {
                 */
                {
-                       buf = (char *)MALLOC(dhd->pub.osh, buflen);
+                       buf = kmalloc(buflen, GFP_ATOMIC);
                        if (!buf) {
                                bcmerror = -BCME_NOMEM;
                                goto done;
@@ -1746,7 +1740,7 @@ done:
        }
 
        if (buf)
-               MFREE(dhd->pub.osh, buf, buflen);
+               kfree(buf);
 
        return OSL_ERROR(bcmerror);
 }
@@ -1841,7 +1835,7 @@ dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
        ASSERT(dhd && (ifidx < DHD_MAX_IFS));
 
        ifp = dhd->iflist[ifidx];
-       if (!ifp && !(ifp = MALLOC(dhd->pub.osh, sizeof(dhd_if_t)))) {
+       if (!ifp && !(ifp = kmalloc(sizeof(dhd_if_t), GFP_ATOMIC))) {
                DHD_ERROR(("%s: OOM - dhd_if_t\n", __func__));
                return -ENOMEM;
        }
@@ -1904,7 +1898,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
        }
 
        /* Allocate primary dhd_info */
-       dhd = MALLOC(osh, sizeof(dhd_info_t));
+       dhd = kmalloc(sizeof(dhd_info_t), GFP_ATOMIC);
        if (!dhd) {
                DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__));
                goto fail;
@@ -1935,7 +1929,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
                goto fail;
 
        net->netdev_ops = NULL;
-       init_MUTEX(&dhd->proto_sem);
+       sema_init(&dhd->proto_sem, 1);
        /* Initialize other structure content */
        init_waitqueue_head(&dhd->ioctl_resp_wait);
        init_waitqueue_head(&dhd->ctrl_wait);
@@ -1983,7 +1977,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
        dhd->timer.function = dhd_watchdog;
 
        /* Initialize thread based operation and lock */
-       init_MUTEX(&dhd->sdsem);
+       sema_init(&dhd->sdsem, 1);
        if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0))
                dhd->threads_only = true;
        else
@@ -2374,8 +2368,8 @@ void dhd_detach(dhd_pub_t *dhdp)
                        WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_LINK_DOWN_TMOUT);
                        WAKE_LOCK_DESTROY(dhdp, WAKE_LOCK_PNO_FIND_TMOUT);
                        free_netdev(ifp->net);
-                       MFREE(dhd->pub.osh, ifp, sizeof(*ifp));
-                       MFREE(dhd->pub.osh, dhd, sizeof(*dhd));
+                       kfree(ifp);
+                       kfree(dhd);
                }
        }
 }
@@ -2923,7 +2917,7 @@ int write_to_file(dhd_pub_t *dhd, u8 *buf, int size)
 
 exit:
        /* free buf before return */
-       MFREE(dhd->osh, buf, size);
+       kfree(buf);
        /* close file before return */
        if (fp)
                filp_close(fp, current->files);