#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>
tmo->elapsed += tmo->increment;
if (tmo->increment < tmo->tick) {
- OSL_DELAY(tmo->increment);
+ udelay(tmo->increment);
tmo->increment *= 2;
if (tmo->increment > tmo->tick)
tmo->increment = tmo->tick;
/* 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));
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
*/
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)));
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;
}
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 */
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
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);
} else {
*/
{
- buf = (char *)MALLOC(dhd->pub.osh, buflen);
+ buf = kmalloc(buflen, GFP_ATOMIC);
if (!buf) {
bcmerror = -BCME_NOMEM;
goto done;
}
if (buf)
- MFREE(dhd->pub.osh, buf, buflen);
+ kfree(buf);
return OSL_ERROR(bcmerror);
}
void dhd_osl_detach(osl_t *osh)
{
- if (MALLOCED(osh)) {
- DHD_ERROR(("%s: MEMORY LEAK %d bytes\n", __func__,
- MALLOCED(osh)));
- }
osl_detach(osh);
}
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;
}
}
/* 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;
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);
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
}
if (dhd->watchdog_tsk) {
- KILL_PROC(dhd->watchdog_tsk->pid, SIGTERM);
+ send_sig(SIGTERM, dhd->watchdog_tsk, 1);
kthread_stop(dhd->watchdog_tsk);
dhd->watchdog_tsk = NULL;
}
if (dhd->dpc_tsk) {
- KILL_PROC(dhd->dpc_tsk->pid, SIGTERM);
+ send_sig(SIGTERM, dhd->dpc_tsk, 1);
kthread_stop(dhd->dpc_tsk);
dhd->dpc_tsk = NULL;
} else
tasklet_kill(&dhd->tasklet);
if (dhd->sysioc_tsk) {
- KILL_PROC(dhd->sysioc_tsk->pid, SIGTERM);
+ send_sig(SIGTERM, dhd->sysioc_tsk, 1);
kthread_stop(dhd->sysioc_tsk);
dhd->sysioc_tsk = NULL;
}
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);
}
}
}
dhd_os_sdunlock(pub);
}
-#ifdef DHD_USE_STATIC_BUF
-void *dhd_os_prealloc(int section, unsigned long size)
-{
-#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
- void *alloc_ptr = NULL;
- if (wifi_control_data && wifi_control_data->mem_prealloc) {
- alloc_ptr = wifi_control_data->mem_prealloc(section, size);
- if (alloc_ptr) {
- DHD_INFO(("success alloc section %d\n", section));
- bzero(alloc_ptr, size);
- return alloc_ptr;
- }
- }
-
- DHD_ERROR(("can't alloc section %d\n", section));
- return 0;
-#else
- return MALLOC(0, size);
-#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
-}
-#endif /* DHD_USE_STATIC_BUF */
#if defined(CONFIG_WIRELESS_EXT)
struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev)
{
exit:
/* free buf before return */
- MFREE(dhd->osh, buf, size);
+ kfree(buf);
/* close file before return */
if (fp)
filp_close(fp, current->files);