#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/etherdevice.h>
+#include <linux/mmc/sdio_func.h>
#include <linux/random.h>
#include <linux/spinlock.h>
#include <linux/ethtool.h>
#include <linux/fcntl.h>
#include <linux/fs.h>
-
-#include <asm/uaccess.h>
-#include <asm/unaligned.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"
struct dhd_bus *g_bus;
-static struct wifi_platform_data *wifi_control_data = NULL;
-static struct resource *wifi_irqres = NULL;
+static struct wifi_platform_data *wifi_control_data;
+static struct resource *wifi_irqres;
int wifi_get_irq_number(unsigned long *irq_flags_ptr)
{
#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) */
MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN fullmac cards");
MODULE_LICENSE("Dual BSD/GPL");
+#define DRV_MODULE_NAME "brcmfmac"
+
/* Linux wireless extension support */
#if defined(CONFIG_WIRELESS_EXT)
#include <wl_iw.h>
int idx; /* iface idx in dongle */
int state; /* interface state */
uint subunit; /* subunit */
- uint8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */
+ 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 */
#ifdef DHD_DEBUG
/* Console poll interval */
-uint dhd_console_ms = 0;
+uint dhd_console_ms;
module_param(dhd_console_ms, uint, 0);
#endif /* DHD_DEBUG */
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 */
-uint dhd_pkt_filter_init = 0;
+uint dhd_pkt_filter_init;
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 */
/* Contorl fw roaming */
#ifdef CUSTOMER_HW2
-uint dhd_roam = 0;
+uint dhd_roam;
#else
uint dhd_roam = 1;
#endif
char iface_name[IFNAMSIZ];
module_param_string(iface_name, iface_name, IFNAMSIZ, 0);
-#define DAEMONIZE(a) daemonize(a); \
- allow_signal(SIGKILL); \
- allow_signal(SIGTERM);
-
-#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) */
#ifdef SDTEST
/* Echo packet generator (pkts/s) */
-uint dhd_pktgen = 0;
+uint dhd_pktgen;
module_param(dhd_pktgen, uint, 0);
/* Echo packet len (0 => sawtooth, max 2040) */
-uint dhd_pktgen_len = 0;
+uint dhd_pktgen_len;
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
struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev);
#endif /* defined(CONFIG_WIRELESS_EXT) */
-static void dhd_dpc(ulong data);
+static void dhd_dpc(unsigned long data);
/* forward decl */
extern int dhd_wait_pend8021x(struct net_device *dev);
#ifndef BDC
#error TOE requires BDC
#endif /* !BDC */
-static int dhd_toe_get(dhd_info_t *dhd, int idx, uint32 *toe_ol);
-static int dhd_toe_set(dhd_info_t *dhd, int idx, uint32 toe_ol);
+static int dhd_toe_get(dhd_info_t *dhd, int idx, u32 *toe_ol);
+static int dhd_toe_set(dhd_info_t *dhd, int idx, u32 toe_ol);
#endif /* TOE */
static int dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
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;
{
struct net_device *dev;
struct netdev_hw_addr *ha;
- uint32 allmulti, cnt;
+ u32 allmulti, cnt;
wl_ioctl_t ioc;
char *buf, *bufp;
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);
}
/* Update multicast statistic */
if (PKTLEN(pktbuf) >= ETHER_ADDR_LEN) {
- uint8 *pktdata = (uint8 *) PKTDATA(pktbuf);
+ u8 *pktdata = (u8 *) PKTDATA(pktbuf);
struct ether_header *eh = (struct ether_header *)pktdata;
if (ETHER_ISMULTI(eh->ether_dhost))
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);
{
dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
struct sk_buff *skb;
- uchar *eth;
+ unsigned char *eth;
uint len;
void *data, *pnext, *save_pktbuf;
int i;
uint ifidx;
dhd_info_t *dhd = (dhd_info_t *) (dhdp->info);
struct ether_header *eh;
- uint16 type;
+ u16 type;
dhd_prot_hdrpull(dhdp, &ifidx, txp);
}
#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(ulong data)
+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(ulong data)
+static void dhd_dpc(unsigned long data)
{
dhd_info_t *dhd;
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;
}
#ifdef TOE
/* Retrieve current toe component enables, which are kept
as a bitmap in toe_ol iovar */
-static int dhd_toe_get(dhd_info_t *dhd, int ifidx, uint32 *toe_ol)
+static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol)
{
wl_ioctl_t ioc;
char buf[32];
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);
return ret;
}
- memcpy(toe_ol, buf, sizeof(uint32));
+ memcpy(toe_ol, buf, sizeof(u32));
return 0;
}
/* Set current toe component enables in toe_ol iovar,
and set toe global enable iovar */
-static int dhd_toe_set(dhd_info_t *dhd, int ifidx, uint32 toe_ol)
+static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol)
{
wl_ioctl_t ioc;
char buf[32];
ioc.cmd = WLC_SET_VAR;
ioc.buf = buf;
ioc.len = (uint) sizeof(buf);
- ioc.set = TRUE;
+ ioc.set = true;
/* Set toe_ol as requested */
strcpy(buf, "toe_ol");
- memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(uint32));
+ memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32));
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
toe = (toe_ol != 0);
strcpy(buf, "toe");
- memcpy(&buf[sizeof("toe")], &toe, sizeof(uint32));
+ memcpy(&buf[sizeof("toe")], &toe, sizeof(u32));
ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
if (ret < 0) {
{
dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
- sprintf(info->driver, "wl");
+ sprintf(info->driver, DRV_MODULE_NAME);
sprintf(info->version, "%lu", dhd->pub.drv_version);
+ sprintf(info->fw_version, "%s", wl_cfg80211_get_fwname());
+ sprintf(info->bus_info, "%s", dev_name(&wl_cfg80211_get_sdio_func()->dev));
}
struct ethtool_ops dhd_ethtool_ops = {
{
struct ethtool_drvinfo info;
char drvname[sizeof(info.driver)];
- uint32 cmd;
+ u32 cmd;
#ifdef TOE
struct ethtool_value edata;
- uint32 toe_cmpnt, csum_dir;
+ u32 toe_cmpnt, csum_dir;
int ret;
#endif
DHD_TRACE(("%s: Enter\n", __func__));
/* all ethtool calls start with a cmd word */
- if (copy_from_user(&cmd, uaddr, sizeof(uint32)))
+ if (copy_from_user(&cmd, uaddr, sizeof(u32)))
return -EFAULT;
switch (cmd) {
/* 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;
__func__));
#endif /* !defined(IGNORE_ETH0_DOWN) */
- OLD_MOD_DEC_USE_COUNT;
return 0;
}
{
dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net);
#ifdef TOE
- uint32 toe_ol;
+ u32 toe_ol;
#endif
int ifidx = dhd_net2idx(dhd, net);
- int32 ret = 0;
+ s32 ret = 0;
DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));
/* 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
- OLD_MOD_INC_USE_COUNT;
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);
}
int
dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
- uint8 *mac_addr, uint32 flags, uint8 bssidx)
+ u8 *mac_addr, u32 flags, u8 bssidx)
{
dhd_if_t *ifp;
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.data = (ulong) dhd;
+ dhd->timer.data = (unsigned long) dhd;
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, (ulong) dhd);
- dhd->dpc_pid = -1;
+ tasklet_init(&dhd->tasklet, dhd_dpc, (unsigned long) dhd);
+ 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;
}
{
dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
struct net_device *net;
- uint8 temp_addr[ETHER_ADDR_LEN] = {
+ u8 temp_addr[ETHER_ADDR_LEN] = {
0x00, 0x90, 0x4c, 0x11, 0x22, 0x33};
DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));
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);
void dhd_os_wd_timer(void *bus, uint wdtick)
{
dhd_pub_t *pub = bus;
- static uint save_dhd_watchdog_ms = 0;
+ static uint save_dhd_watchdog_ms;
dhd_info_t *dhd = (dhd_info_t *) pub->info;
/* don't start the wd until fw is loaded */
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;
}
return;
}
-int dhd_dev_reset(struct net_device *dev, uint8 flag)
+int dhd_dev_reset(struct net_device *dev, u8 flag)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
/* Linux wrapper to call common dhd_pno_set */
int
dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t *ssids_local, int nssid,
- uchar scan_fr)
+ unsigned char scan_fr)
{
dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev);
}
#ifdef DHD_DEBUG
-int write_to_file(dhd_pub_t *dhd, uint8 *buf, int size)
+int write_to_file(dhd_pub_t *dhd, u8 *buf, int size)
{
int ret = 0;
struct file *fp;
exit:
/* free buf before return */
- MFREE(dhd->osh, buf, size);
+ kfree(buf);
/* close file before return */
if (fp)
filp_close(fp, current->files);