#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/slab.h>
#include <linux/skbuff.h>
#include <linux/netdevice.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>
#include <dhd_proto.h>
#include <dhd_dbg.h>
-#ifdef CONFIG_CFG80211
#include <wl_cfg80211.h>
-#endif
#define EPI_VERSION_STR "4.218.248.5"
#if defined(CONFIG_PM_SLEEP)
#include <linux/suspend.h>
-volatile bool dhd_mmc_suspend = FALSE;
+volatile bool dhd_mmc_suspend = false;
DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait);
#endif /* defined(CONFIG_PM_SLEEP) */
u8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */
bool attached; /* Delayed attachment when unset */
bool txflowcontrol; /* Per interface flow control indicator */
- char name[IFNAMSIZ + 1]; /* linux interface name */
+ char name[IFNAMSIZ]; /* linux interface name */
} dhd_if_t;
/* Local private structure (extension of pub) */
/* Thread based operation */
bool threads_only;
struct semaphore sdsem;
- long watchdog_pid;
+ struct task_struct *watchdog_tsk;
struct semaphore watchdog_sem;
- struct completion watchdog_exited;
- long dpc_pid;
+ struct task_struct *dpc_tsk;
struct semaphore dpc_sem;
- struct completion dpc_exited;
/* Thread to issue ioctl for multicast */
- long sysioc_pid;
+ struct task_struct *sysioc_tsk;
struct semaphore sysioc_sem;
- struct completion sysioc_exited;
bool set_multicast;
bool set_macaddress;
struct ether_addr macvalue;
module_param(dhd_msg_level, int, 0);
/* Spawn a thread for system ioctls (set mac, set mcast) */
-uint dhd_sysioc = TRUE;
+uint dhd_sysioc = true;
module_param(dhd_sysioc, uint, 0);
/* Watchdog interval */
module_param(dhd_arp_mode, uint, 0);
/* ARP offload enable */
-uint dhd_arp_enable = TRUE;
+uint dhd_arp_enable = true;
module_param(dhd_arp_enable, uint, 0);
/* Global Pkt filter enable control */
-uint dhd_pkt_filter_enable = TRUE;
+uint dhd_pkt_filter_enable = true;
module_param(dhd_pkt_filter_enable, uint, 0);
/* Pkt filter init setup */
module_param(dhd_pkt_filter_init, uint, 0);
/* Pkt filter mode control */
-uint dhd_master_mode = TRUE;
+uint dhd_master_mode = true;
module_param(dhd_master_mode, uint, 1);
/* Watchdog thread priority, -1 to use kernel timer */
char iface_name[IFNAMSIZ];
module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
-#define DAEMONIZE(a) \
- do { \
- daemonize(a); \
- allow_signal(SIGKILL); \
- allow_signal(SIGTERM); \
- } while (0)
-
-#define BLOCKABLE() (!in_atomic())
-
/* The following are specific to the SDIO dongle */
/* IOCTL response timeout */
module_param(dhd_idletime, int, 0);
/* Use polling */
-uint dhd_poll = FALSE;
+uint dhd_poll = false;
module_param(dhd_poll, uint, 0);
-#ifdef CONFIG_CFG80211
/* Use cfg80211 */
-uint dhd_cfg80211 = TRUE;
+uint dhd_cfg80211 = true;
module_param(dhd_cfg80211, uint, 0);
-#endif
/* Use interrupts */
-uint dhd_intr = TRUE;
+uint dhd_intr = true;
module_param(dhd_intr, uint, 0);
/* SDIO Drive Strength (in milliamps) */
module_param(dhd_pktgen_len, uint, 0);
#endif
-#ifdef CONFIG_CFG80211
#define FAVORITE_WIFI_CP (!!dhd_cfg80211)
#define IS_CFG80211_FAVORITE() FAVORITE_WIFI_CP
#define DBG_CFG80211_GET() ((dhd_cfg80211 & WL_DBG_MASK) >> 1)
#define NO_FW_REQ() (dhd_cfg80211 & 0x80)
-#endif
/* Version string to report */
#ifdef DHD_DEBUG
switch (action) {
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
- dhd_mmc_suspend = TRUE;
+ dhd_mmc_suspend = true;
return NOTIFY_OK;
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
- dhd_mmc_suspend = FALSE;
+ dhd_mmc_suspend = false;
return NOTIFY_OK;
}
return 0;
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;
cnt = netdev_mc_count(dev);
/* Determine initial value of allmulti flag */
- allmulti = (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE;
+ allmulti = (dev->flags & IFF_ALLMULTI) ? true : false;
/* 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));
ioc.cmd = WLC_SET_VAR;
ioc.buf = buf;
ioc.len = buflen;
- ioc.set = TRUE;
+ ioc.set = true;
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
DHD_ERROR(("%s: set mcast_list failed, cnt %d\n",
dhd_ifname(&dhd->pub, ifidx), cnt));
- allmulti = cnt ? TRUE : allmulti;
+ 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;
}
ioc.cmd = WLC_SET_VAR;
ioc.buf = buf;
ioc.len = buflen;
- ioc.set = TRUE;
+ ioc.set = true;
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
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 */
- allmulti = (dev->flags & IFF_PROMISC) ? TRUE : FALSE;
+ allmulti = (dev->flags & IFF_PROMISC) ? true : false;
allmulti = htol32(allmulti);
memset(&ioc, 0, sizeof(ioc));
ioc.cmd = WLC_SET_PROMISC;
ioc.buf = &allmulti;
ioc.len = sizeof(allmulti);
- ioc.set = TRUE;
+ ioc.set = true;
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
ioc.cmd = WLC_SET_VAR;
ioc.buf = buf;
ioc.len = 32;
- ioc.set = TRUE;
+ ioc.set = true;
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
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
dhd_info_t *dhd = (dhd_info_t *) data;
int i;
#ifdef SOFTAP
- bool in_ap = FALSE;
+ bool in_ap = false;
#endif
- DAEMONIZE("dhd_sysioc");
+ allow_signal(SIGTERM);
while (down_interruptible(&dhd->sysioc_sem) == 0) {
+ if (kthread_should_stop())
+ break;
for (i = 0; i < DHD_MAX_IFS; i++) {
if (dhd->iflist[i]) {
#ifdef SOFTAP
DHD_TRACE(("attempt to set MAC for %s "
"in AP Mode," "blocked. \n",
dhd->iflist[i]->net->name));
- dhd->set_macaddress = FALSE;
+ dhd->set_macaddress = false;
continue;
}
if (in_ap && dhd->set_multicast) {
DHD_TRACE(("attempt to set MULTICAST list for %s" "in AP Mode, blocked. \n",
dhd->iflist[i]->net->name));
- dhd->set_multicast = FALSE;
+ dhd->set_multicast = false;
continue;
}
#endif /* SOFTAP */
if (dhd->set_multicast) {
- dhd->set_multicast = FALSE;
+ dhd->set_multicast = false;
_dhd_set_multicast_list(dhd, i);
}
if (dhd->set_macaddress) {
- dhd->set_macaddress = FALSE;
+ dhd->set_macaddress = false;
_dhd_set_mac_address(dhd, i,
&dhd->macvalue);
}
}
}
}
- complete_and_exit(&dhd->sysioc_exited, 0);
+ return 0;
}
static int dhd_set_mac_address(struct net_device *dev, void *addr)
if (ifidx == DHD_BAD_IF)
return -1;
- ASSERT(dhd->sysioc_pid >= 0);
+ ASSERT(dhd->sysioc_tsk);
memcpy(&dhd->macvalue, sa->sa_data, ETHER_ADDR_LEN);
- dhd->set_macaddress = TRUE;
+ dhd->set_macaddress = true;
up(&dhd->sysioc_sem);
return ret;
if (ifidx == DHD_BAD_IF)
return;
- ASSERT(dhd->sysioc_pid >= 0);
- dhd->set_multicast = TRUE;
+ ASSERT(dhd->sysioc_tsk);
+ dhd->set_multicast = true;
up(&dhd->sysioc_sem);
}
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);
}
#endif /* DHD_SCHED */
- DAEMONIZE("dhd_watchdog");
-
+ allow_signal(SIGTERM);
/* Run until signal received */
while (1) {
+ if (kthread_should_stop())
+ break;
if (down_interruptible(&dhd->watchdog_sem) == 0) {
- if (dhd->pub.dongle_reset == FALSE) {
+ if (dhd->pub.dongle_reset == false) {
WAKE_LOCK(&dhd->pub, WAKE_LOCK_WATCHDOG);
/* Call the bus module watchdog */
dhd_bus_watchdog(&dhd->pub);
}
WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_WATCHDOG);
- complete_and_exit(&dhd->watchdog_exited, 0);
+ return 0;
}
static void dhd_watchdog(unsigned long data)
{
dhd_info_t *dhd = (dhd_info_t *) data;
- if (dhd->watchdog_pid >= 0) {
+ if (dhd->watchdog_tsk) {
up(&dhd->watchdog_sem);
/* Reschedule the watchdog */
}
#endif /* DHD_SCHED */
- DAEMONIZE("dhd_dpc");
-
+ allow_signal(SIGTERM);
/* Run until signal received */
while (1) {
+ if (kthread_should_stop())
+ break;
if (down_interruptible(&dhd->dpc_sem) == 0) {
/* Call bus dpc unless it indicated down
(then clean stop) */
}
WAKE_UNLOCK(&dhd->pub, WAKE_LOCK_DPC);
} else {
- dhd_bus_stop(dhd->pub.bus, TRUE);
+ dhd_bus_stop(dhd->pub.bus, true);
}
} else
break;
}
WAKE_LOCK_DESTROY(&dhd->pub, WAKE_LOCK_DPC);
-
- complete_and_exit(&dhd->dpc_exited, 0);
+ return 0;
}
static void dhd_dpc(unsigned long data)
if (dhd_bus_dpc(dhd->pub.bus))
tasklet_schedule(&dhd->tasklet);
} else {
- dhd_bus_stop(dhd->pub.bus, TRUE);
+ dhd_bus_stop(dhd->pub.bus, true);
}
}
{
dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
- if (dhd->dpc_pid >= 0) {
+ if (dhd->dpc_tsk) {
up(&dhd->dpc_sem);
return;
}
ioc.cmd = WLC_GET_VAR;
ioc.buf = buf;
ioc.len = (uint) sizeof(buf);
- ioc.set = FALSE;
+ ioc.set = false;
strcpy(buf, "toe_ol");
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
ioc.cmd = WLC_SET_VAR;
ioc.buf = buf;
ioc.len = (uint) sizeof(buf);
- ioc.set = TRUE;
+ ioc.set = true;
/* Set toe_ol as requested */
/* Copy out any buffer passed */
if (ioc.buf) {
- buflen = min(ioc.len, DHD_IOCTL_MAXLEN);
+ buflen = min_t(int, ioc.len, DHD_IOCTL_MAXLEN);
/* optimization for direct ioctl calls from kernel */
/*
if (segment_eq(get_fs(), KERNEL_DS)) {
} 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);
}
dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
DHD_TRACE(("%s: Enter\n", __func__));
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE()) {
wl_cfg80211_down();
}
-#endif
if (dhd->pub.up == 0)
return 0;
/* Allow transmit calls */
netif_start_queue(net);
dhd->pub.up = 1;
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE()) {
if (unlikely(wl_cfg80211_up())) {
DHD_ERROR(("%s: failed to bring up cfg80211\n",
return -1;
}
}
-#endif
return ret;
}
osl_t *dhd_osl_attach(void *pdev, uint bustype)
{
- return osl_attach(pdev, bustype, TRUE);
+ return osl_attach(pdev, bustype, true);
}
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;
}
memset(ifp, 0, sizeof(dhd_if_t));
ifp->info = dhd;
dhd->iflist[ifidx] = ifp;
- strncpy(ifp->name, name, IFNAMSIZ);
- ifp->name[IFNAMSIZ] = '\0';
+ strlcpy(ifp->name, name, IFNAMSIZ);
if (mac_addr != NULL)
memcpy(&ifp->mac_addr, mac_addr, ETHER_ADDR_LEN);
if (handle == NULL) {
ifp->state = WLC_E_IF_ADD;
ifp->idx = ifidx;
- ASSERT(dhd->sysioc_pid >= 0);
+ ASSERT(dhd->sysioc_tsk);
up(&dhd->sysioc_sem);
} else
ifp->net = (struct net_device *)handle;
ifp->state = WLC_E_IF_DEL;
ifp->idx = ifidx;
- ASSERT(dhd->sysioc_pid >= 0);
+ ASSERT(dhd->sysioc_tsk);
up(&dhd->sysioc_sem);
}
}
/* 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_ERROR(("wl_iw_attach failed\n"));
goto fail;
}
-#endif /* defined(CONFIG_WIRELESS_EXT) */
+#endif /* defined(CONFIG_WIRELESS_EXT) */
-#ifdef CONFIG_CFG80211
/* Attach and link in the cfg80211 */
if (IS_CFG80211_FAVORITE()) {
if (unlikely(wl_cfg80211_attach(net, &dhd->pub))) {
}
wl_cfg80211_dbg_level(DBG_CFG80211_GET());
}
-#endif
/* Set up the watchdog timer */
init_timer(&dhd->timer);
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;
+ dhd->threads_only = true;
else
- dhd->threads_only = FALSE;
+ dhd->threads_only = false;
if (dhd_dpc_prio >= 0) {
/* Initialize watchdog thread */
sema_init(&dhd->watchdog_sem, 0);
- init_completion(&dhd->watchdog_exited);
- dhd->watchdog_pid = kernel_thread(dhd_watchdog_thread, dhd, 0);
+ dhd->watchdog_tsk = kthread_run(dhd_watchdog_thread, dhd,
+ "dhd_watchdog");
+ if (IS_ERR(dhd->watchdog_tsk)) {
+ printk(KERN_WARNING
+ "dhd_watchdog thread failed to start\n");
+ dhd->watchdog_tsk = NULL;
+ }
} else {
- dhd->watchdog_pid = -1;
+ dhd->watchdog_tsk = NULL;
}
/* Set up the bottom half handler */
if (dhd_dpc_prio >= 0) {
/* Initialize DPC thread */
sema_init(&dhd->dpc_sem, 0);
- init_completion(&dhd->dpc_exited);
- dhd->dpc_pid = kernel_thread(dhd_dpc_thread, dhd, 0);
+ dhd->dpc_tsk = kthread_run(dhd_dpc_thread, dhd, "dhd_dpc");
+ if (IS_ERR(dhd->dpc_tsk)) {
+ printk(KERN_WARNING
+ "dhd_dpc thread failed to start\n");
+ dhd->dpc_tsk = NULL;
+ }
} else {
tasklet_init(&dhd->tasklet, dhd_dpc, (unsigned long) dhd);
- dhd->dpc_pid = -1;
+ dhd->dpc_tsk = NULL;
}
if (dhd_sysioc) {
sema_init(&dhd->sysioc_sem, 0);
- init_completion(&dhd->sysioc_exited);
- dhd->sysioc_pid = kernel_thread(_dhd_sysioc_thread, dhd, 0);
- } else {
- dhd->sysioc_pid = -1;
- }
+ dhd->sysioc_tsk = kthread_run(_dhd_sysioc_thread, dhd,
+ "_dhd_sysioc");
+ if (IS_ERR(dhd->sysioc_tsk)) {
+ printk(KERN_WARNING
+ "_dhd_sysioc thread failed to start\n");
+ dhd->sysioc_tsk = NULL;
+ }
+ } else
+ dhd->sysioc_tsk = NULL;
/*
* Save the dhd_info into the priv
dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
/* Bring up the bus */
- ret = dhd_bus_init(&dhd->pub, TRUE);
+ ret = dhd_bus_init(&dhd->pub, true);
if (ret != 0) {
DHD_ERROR(("%s, dhd_bus_init failed %d\n", __func__, ret));
return ret;
/* Host registration for OOB interrupt */
if (bcmsdh_register_oob_intr(dhdp)) {
del_timer_sync(&dhd->timer);
- dhd->wd_timer_valid = FALSE;
+ dhd->wd_timer_valid = false;
DHD_ERROR(("%s Host failed to resgister for OOB\n", __func__));
return -ENODEV;
}
/* Enable oob at firmware */
- dhd_enable_oob_intr(dhd->pub.bus, TRUE);
+ dhd_enable_oob_intr(dhd->pub.bus, true);
#endif /* defined(OOB_INTR_ONLY) */
/* If bus is not ready, can't come up */
if (dhd->pub.busstate != DHD_BUS_DATA) {
del_timer_sync(&dhd->timer);
- dhd->wd_timer_valid = FALSE;
+ dhd->wd_timer_valid = false;
DHD_ERROR(("%s failed bus is not ready\n", __func__));
return -ENODEV;
}
net->ethtool_ops = &dhd_ethtool_ops;
#if defined(CONFIG_WIRELESS_EXT)
-#if defined(CONFIG_CFG80211)
if (!IS_CFG80211_FAVORITE()) {
-#endif
#if WIRELESS_EXT < 19
net->get_wireless_stats = dhd_get_wireless_stats;
#endif /* WIRELESS_EXT < 19 */
net->wireless_handlers =
(struct iw_handler_def *)&wl_iw_handler_def;
#endif /* WIRELESS_EXT > 12 */
-#if defined(CONFIG_CFG80211)
}
-#endif
#endif /* defined(CONFIG_WIRELESS_EXT) */
dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen;
dhd_prot_stop(&dhd->pub);
/* Stop the bus module */
- dhd_bus_stop(dhd->pub.bus, TRUE);
+ dhd_bus_stop(dhd->pub.bus, true);
#if defined(OOB_INTR_ONLY)
bcmsdh_unregister_oob_intr();
#endif /* defined(OOB_INTR_ONLY) */
/* Clear the watchdog timer */
del_timer_sync(&dhd->timer);
- dhd->wd_timer_valid = FALSE;
+ dhd->wd_timer_valid = false;
}
}
}
unregister_netdev(ifp->net);
}
- if (dhd->watchdog_pid >= 0) {
- KILL_PROC(dhd->watchdog_pid, SIGTERM);
- wait_for_completion(&dhd->watchdog_exited);
+ if (dhd->watchdog_tsk) {
+ send_sig(SIGTERM, dhd->watchdog_tsk, 1);
+ kthread_stop(dhd->watchdog_tsk);
+ dhd->watchdog_tsk = NULL;
}
- if (dhd->dpc_pid >= 0) {
- KILL_PROC(dhd->dpc_pid, SIGTERM);
- wait_for_completion(&dhd->dpc_exited);
+ if (dhd->dpc_tsk) {
+ send_sig(SIGTERM, dhd->dpc_tsk, 1);
+ kthread_stop(dhd->dpc_tsk);
+ dhd->dpc_tsk = NULL;
} else
tasklet_kill(&dhd->tasklet);
- if (dhd->sysioc_pid >= 0) {
- KILL_PROC(dhd->sysioc_pid, SIGTERM);
- wait_for_completion(&dhd->sysioc_exited);
+ if (dhd->sysioc_tsk) {
+ send_sig(SIGTERM, dhd->sysioc_tsk, 1);
+ kthread_stop(dhd->sysioc_tsk);
+ dhd->sysioc_tsk = NULL;
}
dhd_bus_detach(dhdp);
wl_iw_detach();
#endif /* (CONFIG_WIRELESS_EXT) */
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE())
wl_cfg80211_detach();
-#endif /* CONFIG_CFG80211 */
#if defined(CONFIG_PM_SLEEP)
unregister_pm_notifier(&dhd_sleep_pm_notifier);
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);
}
}
}
timeout = schedule_timeout(timeout);
if (signal_pending(current))
- *pending = TRUE;
+ *pending = true;
set_current_state(TASK_RUNNING);
remove_wait_queue(&dhd->ioctl_resp_wait, &wait);
return;
/* Totally stop the timer */
- if (!wdtick && dhd->wd_timer_valid == TRUE) {
+ if (!wdtick && dhd->wd_timer_valid == true) {
del_timer_sync(&dhd->timer);
- dhd->wd_timer_valid = FALSE;
+ dhd->wd_timer_valid = false;
save_dhd_watchdog_ms = wdtick;
return;
}
if (save_dhd_watchdog_ms != dhd_watchdog_ms) {
- if (dhd->wd_timer_valid == TRUE)
+ if (dhd->wd_timer_valid == true)
/* Stop timer and restart at new value */
del_timer_sync(&dhd->timer);
jiffies + dhd_watchdog_ms * HZ / 1000);
}
- dhd->wd_timer_valid = TRUE;
+ dhd->wd_timer_valid = true;
save_dhd_watchdog_ms = wdtick;
}
}
{
struct file *fp;
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE() && !NO_FW_REQ())
return wl_cfg80211_request_fw(filename);
-#endif
fp = filp_open(filename, O_RDONLY, 0);
/*
struct file *fp = (struct file *)image;
int rdlen;
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE() && !NO_FW_REQ())
return wl_cfg80211_read_fw(buf, len);
-#endif
if (!image)
return 0;
void dhd_os_close_image(void *image)
{
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE() && !NO_FW_REQ())
return wl_cfg80211_release_fw();
-#endif
if (image)
filp_close((struct file *)image, NULL);
}
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)
{
return bcmerror;
#if defined(CONFIG_WIRELESS_EXT)
-#if defined(CONFIG_CFG80211)
if (!IS_CFG80211_FAVORITE()) {
-#endif
if ((dhd->iflist[*ifidx] == NULL)
|| (dhd->iflist[*ifidx]->net == NULL)) {
DHD_ERROR(("%s Exit null pointer\n", __func__));
if (dhd->iflist[*ifidx]->net)
wl_iw_event(dhd->iflist[*ifidx]->net, event, *data);
-#if defined(CONFIG_CFG80211)
}
-#endif
#endif /* defined(CONFIG_WIRELESS_EXT) */
-#ifdef CONFIG_CFG80211
if (IS_CFG80211_FAVORITE()) {
ASSERT(dhd->iflist[*ifidx] != NULL);
ASSERT(dhd->iflist[*ifidx]->net != NULL);
wl_cfg80211_event(dhd->iflist[*ifidx]->net, event,
*data);
}
-#endif
return bcmerror;
}
struct dhd_info *dhdinfo = dhd->info;
dhd_os_sdunlock(dhd);
wait_event_interruptible_timeout(dhdinfo->ctrl_wait,
- (*lockvar == FALSE), HZ * 2);
+ (*lockvar == false), HZ * 2);
dhd_os_sdlock(dhd);
return;
}
exit:
/* free buf before return */
- MFREE(dhd->osh, buf, size);
+ kfree(buf);
/* close file before return */
if (fp)
filp_close(fp, current->files);