Commit 6758a717 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: rename function variables

This commit gets rid of variables whose name is a broadcom specific
acronym and not very meaningful.
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 621beaff
...@@ -708,27 +708,27 @@ extern const bcmevent_name_t bcmevent_names[]; ...@@ -708,27 +708,27 @@ extern const bcmevent_name_t bcmevent_names[];
extern const int bcmevent_names_size; extern const int bcmevent_names_size;
static inline void MUTEX_LOCK_INIT(struct brcmf_pub *dhdp) static inline void MUTEX_LOCK_INIT(struct brcmf_pub *drvr)
{ {
} }
static inline void MUTEX_LOCK(struct brcmf_pub *dhdp) static inline void MUTEX_LOCK(struct brcmf_pub *drvr)
{ {
} }
static inline void MUTEX_UNLOCK(struct brcmf_pub *dhdp) static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr)
{ {
} }
static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *dhdp) static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *drvr)
{ {
} }
static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *dhdp) static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *drvr)
{ {
} }
static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *dhdp) static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *drvr)
{ {
} }
...@@ -755,84 +755,85 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void) ...@@ -755,84 +755,85 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)
*/ */
extern struct brcmf_pub *brcmf_attach(struct dhd_bus *bus, extern struct brcmf_pub *brcmf_attach(struct dhd_bus *bus,
uint bus_hdrlen); uint bus_hdrlen);
extern int brcmf_net_attach(struct brcmf_pub *dhdp, int idx); extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
extern int brcmf_netdev_wait_pend8021x(struct net_device *dev); extern int brcmf_netdev_wait_pend8021x(struct net_device *dev);
/* Indication from bus module regarding removal/absence of dongle */ /* Indication from bus module regarding removal/absence of dongle */
extern void brcmf_detach(struct brcmf_pub *dhdp); extern void brcmf_detach(struct brcmf_pub *drvr);
/* Indication from bus module to change flow-control state */ /* Indication from bus module to change flow-control state */
extern void brcmf_txflowcontrol(struct brcmf_pub *dhdp, int ifidx, bool on); extern void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool on);
extern bool brcmf_c_prec_enq(struct brcmf_pub *dhdp, struct pktq *q, extern bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q,
struct sk_buff *pkt, int prec); struct sk_buff *pkt, int prec);
/* Receive frame for delivery to OS. Callee disposes of rxp. */ /* Receive frame for delivery to OS. Callee disposes of rxp. */
extern void brcmf_rx_frame(struct brcmf_pub *dhdp, int ifidx, extern void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx,
struct sk_buff *rxp, int numpkt); struct sk_buff *rxp, int numpkt);
/* Return pointer to interface name */ /* Return pointer to interface name */
extern char *brcmf_ifname(struct brcmf_pub *dhdp, int idx); extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
/* Request scheduling of the bus dpc */ /* Request scheduling of the bus dpc */
extern void brcmf_sched_dpc(struct brcmf_pub *dhdp); extern void brcmf_sched_dpc(struct brcmf_pub *drvr);
/* Notify tx completion */ /* Notify tx completion */
extern void brcmf_txcomplete(struct brcmf_pub *dhdp, struct sk_buff *txp, extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp,
bool success); bool success);
/* Query ioctl */ /* Query ioctl */
extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx,
uint cmd, void *buf, uint len); uint cmd, void *buf, uint len);
/* OS independent layer functions */ /* OS independent layer functions */
extern int brcmf_os_proto_block(struct brcmf_pub *pub); extern int brcmf_os_proto_block(struct brcmf_pub *drvr);
extern int brcmf_os_proto_unblock(struct brcmf_pub *pub); extern int brcmf_os_proto_unblock(struct brcmf_pub *drvr);
extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub *pub, uint *condition, extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition,
bool *pending); bool *pending);
extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub *pub); extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr);
extern unsigned int brcmf_os_get_ioctl_resp_timeout(void); extern unsigned int brcmf_os_get_ioctl_resp_timeout(void);
extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec); extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
extern void brcmf_os_sdlock_sndup_rxq(struct brcmf_pub *pub); extern void brcmf_os_sdlock_sndup_rxq(struct brcmf_pub *drvr);
extern void brcmf_customer_gpio_wlan_ctrl(int onoff); extern void brcmf_customer_gpio_wlan_ctrl(int onoff);
extern int brcmf_custom_get_mac_address(unsigned char *buf); extern int brcmf_custom_get_mac_address(unsigned char *buf);
extern void brcmf_os_sdunlock_sndup_rxq(struct brcmf_pub *pub); extern void brcmf_os_sdunlock_sndup_rxq(struct brcmf_pub *drvr);
extern void brcmf_os_sdlock_eventq(struct brcmf_pub *pub); extern void brcmf_os_sdlock_eventq(struct brcmf_pub *drvr);
extern void brcmf_os_sdunlock_eventq(struct brcmf_pub *pub); extern void brcmf_os_sdunlock_eventq(struct brcmf_pub *drvr);
#ifdef BCMDBG #ifdef BCMDBG
extern int brcmf_write_to_file(struct brcmf_pub *dhd, u8 *buf, int size); extern int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size);
#endif /* BCMDBG */ #endif /* BCMDBG */
extern void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec); extern void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec);
extern int brcmf_timeout_expired(struct brcmf_timeout *tmo); extern int brcmf_timeout_expired(struct brcmf_timeout *tmo);
extern int brcmf_ifname2idx(struct brcmf_info *dhd, char *name); extern int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name);
extern int brcmf_c_host_event(struct brcmf_info *dhd, int *idx, void *pktdata, extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,
brcmf_event_msg_t *, void **data_ptr); void *pktdata, brcmf_event_msg_t *,
void **data_ptr);
extern void brcmf_c_init(void); extern void brcmf_c_init(void);
extern int brcmf_add_if(struct brcmf_info *dhd, int ifidx, void *handle, extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle,
char *name, u8 *mac_addr, u32 flags, u8 bssidx); char *name, u8 *mac_addr, u32 flags, u8 bssidx);
extern void brcmf_del_if(struct brcmf_info *dhd, int ifidx); extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx);
extern void brcmf_vif_add(struct brcmf_info *dhd, int ifidx, char *name); extern void brcmf_vif_add(struct brcmf_info *drvr_priv, int ifidx, char *name);
extern void brcmf_vif_del(struct brcmf_info *dhd, int ifidx); extern void brcmf_vif_del(struct brcmf_info *drvr_priv, int ifidx);
extern void brcmf_event(struct brcmf_info *dhd, char *evpkt, int evlen, extern void brcmf_event(struct brcmf_info *drvr_priv, char *evpkt, int evlen,
int ifidx); int ifidx);
extern void brcmf_vif_sendup(struct brcmf_info *dhd, int ifidx, extern void brcmf_vif_sendup(struct brcmf_info *drvr_priv, int ifidx,
unsigned char *cp, int len); unsigned char *cp, int len);
/* Send packet to dongle via data channel */ /* Send packet to dongle via data channel */
extern int brcmf_sendpkt(struct brcmf_pub *dhdp, int ifidx,\ extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\
struct sk_buff *pkt); struct sk_buff *pkt);
extern int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag); extern int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag);
extern int brcmf_bus_start(struct brcmf_pub *dhdp); extern int brcmf_bus_start(struct brcmf_pub *drvr);
extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *dhd, char *arg); extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *dhd, char *arg, extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
int enable, int master_mode); int enable, int master_mode);
#ifdef BCMDBG #ifdef BCMDBG
......
...@@ -40,7 +40,7 @@ extern void dhd_bus_unregister(void); ...@@ -40,7 +40,7 @@ extern void dhd_bus_unregister(void);
extern void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex); extern void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex);
/* Initialize bus module: prepare for communication w/dongle */ /* Initialize bus module: prepare for communication w/dongle */
extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex); extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex);
/* Send a data frame to the dongle. Callee disposes of txp. */ /* Send a data frame to the dongle. Callee disposes of txp. */
extern int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *txp); extern int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *txp);
...@@ -58,16 +58,16 @@ extern void dhd_bus_isr(bool *InterruptRecognized, ...@@ -58,16 +58,16 @@ extern void dhd_bus_isr(bool *InterruptRecognized,
bool *QueueMiniportHandleInterrupt, void *arg); bool *QueueMiniportHandleInterrupt, void *arg);
/* Check for and handle local prot-specific iovar commands */ /* Check for and handle local prot-specific iovar commands */
extern int brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *dhdp, const char *name, extern int brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
void *params, int plen, void *arg, int len, void *params, int plen, void *arg, int len,
bool set); bool set);
/* Add bus dump output to a buffer */ /* Add bus dump output to a buffer */
extern void brcmf_sdbrcm_bus_dump(struct brcmf_pub *dhdp, extern void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr,
struct brcmu_strbuf *strbuf); struct brcmu_strbuf *strbuf);
/* Clear any bus counters */ /* Clear any bus counters */
extern void dhd_bus_clearcounts(struct brcmf_pub *dhdp); extern void dhd_bus_clearcounts(struct brcmf_pub *drvr);
/* return the dongle chipid */ /* return the dongle chipid */
extern uint dhd_bus_chip(struct dhd_bus *bus); extern uint dhd_bus_chip(struct dhd_bus *bus);
......
...@@ -100,9 +100,9 @@ struct brcmf_proto { ...@@ -100,9 +100,9 @@ struct brcmf_proto {
unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN]; unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN];
}; };
static int brcmf_proto_cdc_msg(struct brcmf_pub *dhd) static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr)
{ {
struct brcmf_proto *prot = dhd->prot; struct brcmf_proto *prot = drvr->prot;
int len = le32_to_cpu(prot->msg.len) + int len = le32_to_cpu(prot->msg.len) +
sizeof(struct brcmf_proto_cdc_ioctl); sizeof(struct brcmf_proto_cdc_ioctl);
...@@ -116,19 +116,19 @@ static int brcmf_proto_cdc_msg(struct brcmf_pub *dhd) ...@@ -116,19 +116,19 @@ static int brcmf_proto_cdc_msg(struct brcmf_pub *dhd)
len = CDC_MAX_MSG_SIZE; len = CDC_MAX_MSG_SIZE;
/* Send request */ /* Send request */
return brcmf_sdbrcm_bus_txctl(dhd->bus, (unsigned char *)&prot->msg, return brcmf_sdbrcm_bus_txctl(drvr->bus, (unsigned char *)&prot->msg,
len); len);
} }
static int brcmf_proto_cdc_cmplt(struct brcmf_pub *dhd, u32 id, u32 len) static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len)
{ {
int ret; int ret;
struct brcmf_proto *prot = dhd->prot; struct brcmf_proto *prot = drvr->prot;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
do { do {
ret = brcmf_sdbrcm_bus_rxctl(dhd->bus, ret = brcmf_sdbrcm_bus_rxctl(drvr->bus,
(unsigned char *)&prot->msg, (unsigned char *)&prot->msg,
len + sizeof(struct brcmf_proto_cdc_ioctl)); len + sizeof(struct brcmf_proto_cdc_ioctl));
if (ret < 0) if (ret < 0)
...@@ -139,10 +139,10 @@ static int brcmf_proto_cdc_cmplt(struct brcmf_pub *dhd, u32 id, u32 len) ...@@ -139,10 +139,10 @@ static int brcmf_proto_cdc_cmplt(struct brcmf_pub *dhd, u32 id, u32 len)
} }
int int
brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
void *buf, uint len) void *buf, uint len)
{ {
struct brcmf_proto *prot = dhd->prot; struct brcmf_proto *prot = drvr->prot;
struct brcmf_proto_cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
void *info; void *info;
int ret = 0, retries = 0; int ret = 0, retries = 0;
...@@ -158,7 +158,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -158,7 +158,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
BCME_STRLEN); BCME_STRLEN);
goto done; goto done;
} else if (!strcmp((char *)buf, "bcmerror")) { } else if (!strcmp((char *)buf, "bcmerror")) {
*(int *)buf = dhd->dongle_error; *(int *)buf = drvr->dongle_error;
goto done; goto done;
} }
} }
...@@ -174,7 +174,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -174,7 +174,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
if (buf) if (buf)
memcpy(prot->buf, buf, len); memcpy(prot->buf, buf, len);
ret = brcmf_proto_cdc_msg(dhd); ret = brcmf_proto_cdc_msg(drvr);
if (ret < 0) { if (ret < 0) {
DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status " DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status "
"%d\n", ret)); "%d\n", ret));
...@@ -183,7 +183,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -183,7 +183,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
retry: retry:
/* wait for interrupt and get first fragment */ /* wait for interrupt and get first fragment */
ret = brcmf_proto_cdc_cmplt(dhd, prot->reqid, len); ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len);
if (ret < 0) if (ret < 0)
goto done; goto done;
...@@ -194,7 +194,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -194,7 +194,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
goto retry; goto retry;
if (id != prot->reqid) { if (id != prot->reqid) {
DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
brcmf_ifname(dhd, ifidx), __func__, id, brcmf_ifname(drvr, ifidx), __func__, id,
prot->reqid)); prot->reqid));
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
...@@ -214,17 +214,17 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -214,17 +214,17 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
if (flags & CDCF_IOC_ERROR) { if (flags & CDCF_IOC_ERROR) {
ret = le32_to_cpu(msg->status); ret = le32_to_cpu(msg->status);
/* Cache error from dongle */ /* Cache error from dongle */
dhd->dongle_error = ret; drvr->dongle_error = ret;
} }
done: done:
return ret; return ret;
} }
int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
void *buf, uint len) void *buf, uint len)
{ {
struct brcmf_proto *prot = dhd->prot; struct brcmf_proto *prot = drvr->prot;
struct brcmf_proto_cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_ioctl *msg = &prot->msg;
int ret = 0; int ret = 0;
u32 flags, id; u32 flags, id;
...@@ -243,11 +243,11 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -243,11 +243,11 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
if (buf) if (buf)
memcpy(prot->buf, buf, len); memcpy(prot->buf, buf, len);
ret = brcmf_proto_cdc_msg(dhd); ret = brcmf_proto_cdc_msg(drvr);
if (ret < 0) if (ret < 0)
goto done; goto done;
ret = brcmf_proto_cdc_cmplt(dhd, prot->reqid, len); ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len);
if (ret < 0) if (ret < 0)
goto done; goto done;
...@@ -256,7 +256,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -256,7 +256,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
if (id != prot->reqid) { if (id != prot->reqid) {
DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n",
brcmf_ifname(dhd, ifidx), __func__, id, brcmf_ifname(drvr, ifidx), __func__, id,
prot->reqid)); prot->reqid));
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
...@@ -266,7 +266,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -266,7 +266,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
if (flags & CDCF_IOC_ERROR) { if (flags & CDCF_IOC_ERROR) {
ret = le32_to_cpu(msg->status); ret = le32_to_cpu(msg->status);
/* Cache error from dongle */ /* Cache error from dongle */
dhd->dongle_error = ret; drvr->dongle_error = ret;
} }
done: done:
...@@ -274,18 +274,18 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd, ...@@ -274,18 +274,18 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *dhd, int ifidx, uint cmd,
} }
int int
brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc, brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
void *buf, int len) void *buf, int len)
{ {
struct brcmf_proto *prot = dhd->prot; struct brcmf_proto *prot = drvr->prot;
int ret = -1; int ret = -1;
if (dhd->busstate == DHD_BUS_DOWN) { if (drvr->busstate == DHD_BUS_DOWN) {
DHD_ERROR(("%s : bus is down. we have nothing to do\n", DHD_ERROR(("%s : bus is down. we have nothing to do\n",
__func__)); __func__));
return ret; return ret;
} }
brcmf_os_proto_block(dhd); brcmf_os_proto_block(drvr);
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
...@@ -309,9 +309,10 @@ brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc, ...@@ -309,9 +309,10 @@ brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc,
prot->pending = true; prot->pending = true;
prot->lastcmd = ioc->cmd; prot->lastcmd = ioc->cmd;
if (ioc->set) if (ioc->set)
ret = brcmf_proto_cdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len); ret = brcmf_proto_cdc_set_ioctl(drvr, ifidx, ioc->cmd,
buf, len);
else { else {
ret = brcmf_proto_cdc_query_ioctl(dhd, ifidx, ioc->cmd, ret = brcmf_proto_cdc_query_ioctl(drvr, ifidx, ioc->cmd,
buf, len); buf, len);
if (ret > 0) if (ret > 0)
ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl); ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl);
...@@ -334,13 +335,13 @@ brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc, ...@@ -334,13 +335,13 @@ brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc,
slen = strlen("wme_dp") + 1; slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int))) if (len >= (int)(slen + sizeof(int)))
memcpy(&val, (char *)buf + slen, sizeof(int)); memcpy(&val, (char *)buf + slen, sizeof(int));
dhd->wme_dp = (u8) le32_to_cpu(val); drvr->wme_dp = (u8) le32_to_cpu(val);
} }
prot->pending = false; prot->pending = false;
done: done:
brcmf_os_proto_unblock(dhd); brcmf_os_proto_unblock(drvr);
return ret; return ret;
} }
...@@ -355,18 +356,18 @@ brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc, ...@@ -355,18 +356,18 @@ brcmf_proto_ioctl(struct brcmf_pub *dhd, int ifidx, struct brcmf_ioctl *ioc,
skb->ip_summed is overloaded */ skb->ip_summed is overloaded */
int int
brcmf_proto_iovar_op(struct brcmf_pub *dhdp, const char *name, brcmf_proto_iovar_op(struct brcmf_pub *drvr, const char *name,
void *params, int plen, void *arg, int len, bool set) void *params, int plen, void *arg, int len, bool set)
{ {
return -ENOTSUPP; return -ENOTSUPP;
} }
void brcmf_proto_dump(struct brcmf_pub *dhdp, struct brcmu_strbuf *strbuf) void brcmf_proto_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
{ {
brcmu_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid); brcmu_bprintf(strbuf, "Protocol CDC: reqid %d\n", drvr->prot->reqid);
} }
void brcmf_proto_hdrpush(struct brcmf_pub *dhd, int ifidx, void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx,
struct sk_buff *pktbuf) struct sk_buff *pktbuf)
{ {
struct brcmf_proto_bdc_header *h; struct brcmf_proto_bdc_header *h;
...@@ -389,7 +390,7 @@ void brcmf_proto_hdrpush(struct brcmf_pub *dhd, int ifidx, ...@@ -389,7 +390,7 @@ void brcmf_proto_hdrpush(struct brcmf_pub *dhd, int ifidx,
BDC_SET_IF_IDX(h, ifidx); BDC_SET_IF_IDX(h, ifidx);
} }
int brcmf_proto_hdrpull(struct brcmf_pub *dhd, int *ifidx, int brcmf_proto_hdrpull(struct brcmf_pub *drvr, int *ifidx,
struct sk_buff *pktbuf) struct sk_buff *pktbuf)
{ {
struct brcmf_proto_bdc_header *h; struct brcmf_proto_bdc_header *h;
...@@ -416,14 +417,14 @@ int brcmf_proto_hdrpull(struct brcmf_pub *dhd, int *ifidx, ...@@ -416,14 +417,14 @@ int brcmf_proto_hdrpull(struct brcmf_pub *dhd, int *ifidx,
if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=
BDC_PROTO_VER) { BDC_PROTO_VER) {
DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n", DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n",
brcmf_ifname(dhd, *ifidx), h->flags)); brcmf_ifname(drvr, *ifidx), h->flags));
return -EBADE; return -EBADE;
} }
if (h->flags & BDC_FLAG_SUM_GOOD) { if (h->flags & BDC_FLAG_SUM_GOOD) {
DHD_INFO(("%s: BDC packet received with good rx-csum, " DHD_INFO(("%s: BDC packet received with good rx-csum, "
"flags 0x%x\n", "flags 0x%x\n",
brcmf_ifname(dhd, *ifidx), h->flags)); brcmf_ifname(drvr, *ifidx), h->flags));
PKTSETSUMGOOD(pktbuf, true); PKTSETSUMGOOD(pktbuf, true);
} }
...@@ -434,7 +435,7 @@ int brcmf_proto_hdrpull(struct brcmf_pub *dhd, int *ifidx, ...@@ -434,7 +435,7 @@ int brcmf_proto_hdrpull(struct brcmf_pub *dhd, int *ifidx,
return 0; return 0;
} }
int brcmf_proto_attach(struct brcmf_pub *dhd) int brcmf_proto_attach(struct brcmf_pub *drvr)
{ {
struct brcmf_proto *cdc; struct brcmf_proto *cdc;
...@@ -450,9 +451,9 @@ int brcmf_proto_attach(struct brcmf_pub *dhd) ...@@ -450,9 +451,9 @@ int brcmf_proto_attach(struct brcmf_pub *dhd)
goto fail; goto fail;
} }
dhd->prot = cdc; drvr->prot = cdc;
dhd->hdrlen += BDC_HEADER_LEN; drvr->hdrlen += BDC_HEADER_LEN;
dhd->maxctl = BRCMF_C_IOCTL_MAXLEN + drvr->maxctl = BRCMF_C_IOCTL_MAXLEN +
sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN; sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN;
return 0; return 0;
...@@ -462,54 +463,54 @@ int brcmf_proto_attach(struct brcmf_pub *dhd) ...@@ -462,54 +463,54 @@ int brcmf_proto_attach(struct brcmf_pub *dhd)
} }
/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */ /* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
void brcmf_proto_detach(struct brcmf_pub *dhd) void brcmf_proto_detach(struct brcmf_pub *drvr)
{ {
kfree(dhd->prot); kfree(drvr->prot);
dhd->prot = NULL; drvr->prot = NULL;
} }
void brcmf_proto_dstats(struct brcmf_pub *dhd) void brcmf_proto_dstats(struct brcmf_pub *drvr)
{ {
/* No stats from dongle added yet, copy bus stats */ /* No stats from dongle added yet, copy bus stats */
dhd->dstats.tx_packets = dhd->tx_packets; drvr->dstats.tx_packets = drvr->tx_packets;
dhd->dstats.tx_errors = dhd->tx_errors; drvr->dstats.tx_errors = drvr->tx_errors;
dhd->dstats.rx_packets = dhd->rx_packets; drvr->dstats.rx_packets = drvr->rx_packets;
dhd->dstats.rx_errors = dhd->rx_errors; drvr->dstats.rx_errors = drvr->rx_errors;
dhd->dstats.rx_dropped = dhd->rx_dropped; drvr->dstats.rx_dropped = drvr->rx_dropped;
dhd->dstats.multicast = dhd->rx_multicast; drvr->dstats.multicast = drvr->rx_multicast;
return; return;
} }
int brcmf_proto_init(struct brcmf_pub *dhd) int brcmf_proto_init(struct brcmf_pub *drvr)
{ {
int ret = 0; int ret = 0;
char buf[128]; char buf[128];
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
brcmf_os_proto_block(dhd); brcmf_os_proto_block(drvr);
/* Get the device MAC address */ /* Get the device MAC address */
strcpy(buf, "cur_etheraddr"); strcpy(buf, "cur_etheraddr");
ret = brcmf_proto_cdc_query_ioctl(dhd, 0, BRCMF_C_GET_VAR, ret = brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR,
buf, sizeof(buf)); buf, sizeof(buf));
if (ret < 0) { if (ret < 0) {
brcmf_os_proto_unblock(dhd); brcmf_os_proto_unblock(drvr);
return ret; return ret;
} }
memcpy(dhd->mac, buf, ETH_ALEN); memcpy(drvr->mac, buf, ETH_ALEN);
brcmf_os_proto_unblock(dhd); brcmf_os_proto_unblock(drvr);
ret = brcmf_c_preinit_ioctls(dhd); ret = brcmf_c_preinit_ioctls(drvr);
/* Always assumes wl for now */ /* Always assumes wl for now */
dhd->iswl = true; drvr->iswl = true;
return ret; return ret;
} }
void brcmf_proto_stop(struct brcmf_pub *dhd) void brcmf_proto_stop(struct brcmf_pub *drvr)
{ {
/* Nothing to do for CDC */ /* Nothing to do for CDC */
} }
...@@ -543,7 +543,7 @@ struct chip_info { ...@@ -543,7 +543,7 @@ struct chip_info {
/* Private data for SDIO bus interaction */ /* Private data for SDIO bus interaction */
typedef struct dhd_bus { typedef struct dhd_bus {
struct brcmf_pub *dhd; struct brcmf_pub *drvr;
struct brcmf_sdio_card *card; /* Handle for sdio card calls */ struct brcmf_sdio_card *card; /* Handle for sdio card calls */
struct chip_info *ci; /* Chip info struct */ struct chip_info *ci; /* Chip info struct */
...@@ -781,7 +781,7 @@ uint dhd_txminmax; ...@@ -781,7 +781,7 @@ uint dhd_txminmax;
#define DONGLE_MIN_MEMSIZE (128 * 1024) #define DONGLE_MIN_MEMSIZE (128 * 1024)
int brcmf_dongle_memsize; int brcmf_dongle_memsize;
static bool dhd_alignctl; static bool brcmf_alignctl;
static bool sd1idle; static bool sd1idle;
...@@ -817,7 +817,7 @@ static bool forcealign; ...@@ -817,7 +817,7 @@ static bool forcealign;
static const uint max_roundup = 512; static const uint max_roundup = 512;
/* Try doing readahead */ /* Try doing readahead */
static bool dhd_readahead; static bool brcmf_readahead;
/* To check if there's window offered */ /* To check if there's window offered */
#define DATAOK(bus) \ #define DATAOK(bus) \
...@@ -1242,7 +1242,7 @@ int brcmf_sdbrcm_bussleep(dhd_bus_t *bus, bool sleep) ...@@ -1242,7 +1242,7 @@ int brcmf_sdbrcm_bussleep(dhd_bus_t *bus, bool sleep)
bus->sleeping = false; bus->sleeping = false;
/* Enable interrupts again */ /* Enable interrupts again */
if (bus->intr && (bus->dhd->busstate == DHD_BUS_DATA)) { if (bus->intr && (bus->drvr->busstate == DHD_BUS_DATA)) {
bus->intdis = false; bus->intdis = false;
brcmf_sdcard_intr_enable(bus->card); brcmf_sdcard_intr_enable(bus->card);
} }
...@@ -1275,7 +1275,7 @@ static int brcmf_sdbrcm_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -1275,7 +1275,7 @@ static int brcmf_sdbrcm_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
card = bus->card; card = bus->card;
if (bus->dhd->dongle_reset) { if (bus->drvr->dongle_reset) {
ret = -EPERM; ret = -EPERM;
goto done; goto done;
} }
...@@ -1288,7 +1288,7 @@ static int brcmf_sdbrcm_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -1288,7 +1288,7 @@ static int brcmf_sdbrcm_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
if (skb_headroom(pkt) < pad) { if (skb_headroom(pkt) < pad) {
DHD_INFO(("%s: insufficient headroom %d for %d pad\n", DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
__func__, skb_headroom(pkt), pad)); __func__, skb_headroom(pkt), pad));
bus->dhd->tx_realloc++; bus->drvr->tx_realloc++;
new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN); new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN);
if (!new) { if (!new) {
DHD_ERROR(("%s: couldn't allocate new %d-byte " DHD_ERROR(("%s: couldn't allocate new %d-byte "
...@@ -1402,7 +1402,7 @@ static int brcmf_sdbrcm_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -1402,7 +1402,7 @@ static int brcmf_sdbrcm_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
/* restore pkt buffer pointer before calling tx complete routine */ /* restore pkt buffer pointer before calling tx complete routine */
skb_pull(pkt, SDPCM_HDRLEN + pad); skb_pull(pkt, SDPCM_HDRLEN + pad);
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
brcmf_txcomplete(bus->dhd, pkt, ret != 0); brcmf_txcomplete(bus->drvr, pkt, ret != 0);
brcmf_sdbrcm_sdlock(bus); brcmf_sdbrcm_sdlock(bus);
if (free_pkt) if (free_pkt)
...@@ -1452,9 +1452,9 @@ int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1452,9 +1452,9 @@ int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
/* Priority based enq */ /* Priority based enq */
spin_lock_bh(&bus->txqlock); spin_lock_bh(&bus->txqlock);
if (brcmf_c_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) { if (brcmf_c_prec_enq(bus->drvr, &bus->txq, pkt, prec) == false) {
skb_pull(pkt, SDPCM_HDRLEN); skb_pull(pkt, SDPCM_HDRLEN);
brcmf_txcomplete(bus->dhd, pkt, false); brcmf_txcomplete(bus->drvr, pkt, false);
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
DHD_ERROR(("%s: out of bus->txq !!!\n", __func__)); DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
ret = -ENOSR; ret = -ENOSR;
...@@ -1464,7 +1464,7 @@ int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1464,7 +1464,7 @@ int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
spin_unlock_bh(&bus->txqlock); spin_unlock_bh(&bus->txqlock);
if (pktq_len(&bus->txq) >= TXHI) if (pktq_len(&bus->txq) >= TXHI)
brcmf_txflowcontrol(bus->dhd, 0, ON); brcmf_txflowcontrol(bus->drvr, 0, ON);
#ifdef BCMDBG #ifdef BCMDBG
if (pktq_plen(&bus->txq, prec) > qcount[prec]) if (pktq_plen(&bus->txq, prec) > qcount[prec])
...@@ -1493,9 +1493,9 @@ int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1493,9 +1493,9 @@ int brcmf_sdbrcm_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
SDPCM_DATA_CHANNEL), true); SDPCM_DATA_CHANNEL), true);
#endif #endif
if (ret) if (ret)
bus->dhd->tx_errors++; bus->drvr->tx_errors++;
else else
bus->dhd->dstats.tx_bytes += datalen; bus->drvr->dstats.tx_bytes += datalen;
if (bus->idletime == BRCMF_IDLE_IMMEDIATE && if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
!bus->dpc_sched) { !bus->dpc_sched) {
...@@ -1519,7 +1519,7 @@ static uint brcmf_sdbrcm_sendfromq(dhd_bus_t *bus, uint maxframes) ...@@ -1519,7 +1519,7 @@ static uint brcmf_sdbrcm_sendfromq(dhd_bus_t *bus, uint maxframes)
uint datalen; uint datalen;
u8 tx_prec_map; u8 tx_prec_map;
struct brcmf_pub *dhd = bus->dhd; struct brcmf_pub *drvr = bus->drvr;
struct sdpcmd_regs *regs = bus->regs; struct sdpcmd_regs *regs = bus->regs;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
...@@ -1545,9 +1545,9 @@ static uint brcmf_sdbrcm_sendfromq(dhd_bus_t *bus, uint maxframes) ...@@ -1545,9 +1545,9 @@ static uint brcmf_sdbrcm_sendfromq(dhd_bus_t *bus, uint maxframes)
SDPCM_DATA_CHANNEL), true); SDPCM_DATA_CHANNEL), true);
#endif #endif
if (ret) if (ret)
bus->dhd->tx_errors++; bus->drvr->tx_errors++;
else else
bus->dhd->dstats.tx_bytes += datalen; bus->drvr->dstats.tx_bytes += datalen;
/* In poll mode, need to check for other events */ /* In poll mode, need to check for other events */
if (!bus->intr && cnt) { if (!bus->intr && cnt) {
...@@ -1562,9 +1562,9 @@ static uint brcmf_sdbrcm_sendfromq(dhd_bus_t *bus, uint maxframes) ...@@ -1562,9 +1562,9 @@ static uint brcmf_sdbrcm_sendfromq(dhd_bus_t *bus, uint maxframes)
} }
/* Deflow-control stack if needed */ /* Deflow-control stack if needed */
if (dhd->up && (dhd->busstate == DHD_BUS_DATA) && if (drvr->up && (drvr->busstate == DHD_BUS_DATA) &&
dhd->txoff && (pktq_len(&bus->txq) < TXLOW)) drvr->txoff && (pktq_len(&bus->txq) < TXLOW))
brcmf_txflowcontrol(dhd, 0, OFF); brcmf_txflowcontrol(drvr, 0, OFF);
return cnt; return cnt;
} }
...@@ -1583,7 +1583,7 @@ brcmf_sdbrcm_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) ...@@ -1583,7 +1583,7 @@ brcmf_sdbrcm_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (bus->dhd->dongle_reset) if (bus->drvr->dongle_reset)
return -EIO; return -EIO;
/* Back the pointer to make a room for bus header */ /* Back the pointer to make a room for bus header */
...@@ -1591,7 +1591,7 @@ brcmf_sdbrcm_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) ...@@ -1591,7 +1591,7 @@ brcmf_sdbrcm_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
len = (msglen += SDPCM_HDRLEN); len = (msglen += SDPCM_HDRLEN);
/* Add alignment padding (optional for ctl frames) */ /* Add alignment padding (optional for ctl frames) */
if (dhd_alignctl) { if (brcmf_alignctl) {
doff = ((unsigned long)frame % BRCMF_SDALIGN); doff = ((unsigned long)frame % BRCMF_SDALIGN);
if (doff) { if (doff) {
frame -= doff; frame -= doff;
...@@ -1724,9 +1724,9 @@ brcmf_sdbrcm_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) ...@@ -1724,9 +1724,9 @@ brcmf_sdbrcm_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
if (ret) if (ret)
bus->dhd->tx_ctlerrs++; bus->drvr->tx_ctlerrs++;
else else
bus->dhd->tx_ctlpkts++; bus->drvr->tx_ctlpkts++;
return ret ? -EIO : 0; return ret ? -EIO : 0;
} }
...@@ -1739,11 +1739,11 @@ int brcmf_sdbrcm_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) ...@@ -1739,11 +1739,11 @@ int brcmf_sdbrcm_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (bus->dhd->dongle_reset) if (bus->drvr->dongle_reset)
return -EIO; return -EIO;
/* Wait until control frame is available */ /* Wait until control frame is available */
timeleft = brcmf_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, &pending); timeleft = brcmf_os_ioctl_resp_wait(bus->drvr, &bus->rxlen, &pending);
brcmf_sdbrcm_sdlock(bus); brcmf_sdbrcm_sdlock(bus);
rxlen = bus->rxlen; rxlen = bus->rxlen;
...@@ -1774,9 +1774,9 @@ int brcmf_sdbrcm_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) ...@@ -1774,9 +1774,9 @@ int brcmf_sdbrcm_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
} }
if (rxlen) if (rxlen)
bus->dhd->rx_ctlpkts++; bus->drvr->rx_ctlpkts++;
else else
bus->dhd->rx_ctlerrs++; bus->drvr->rx_ctlerrs++;
return rxlen ? (int)rxlen : -ETIMEDOUT; return rxlen ? (int)rxlen : -ETIMEDOUT;
} }
...@@ -1886,9 +1886,9 @@ dhd_dump_pct(struct brcmu_strbuf *strbuf, char *desc, uint num, uint div) ...@@ -1886,9 +1886,9 @@ dhd_dump_pct(struct brcmu_strbuf *strbuf, char *desc, uint num, uint div)
} }
} }
void brcmf_sdbrcm_bus_dump(struct brcmf_pub *dhdp, struct brcmu_strbuf *strbuf) void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
{ {
dhd_bus_t *bus = dhdp->bus; dhd_bus_t *bus = drvr->bus;
brcmu_bprintf(strbuf, "Bus SDIO structure:\n"); brcmu_bprintf(strbuf, "Bus SDIO structure:\n");
brcmu_bprintf(strbuf, brcmu_bprintf(strbuf,
...@@ -1919,44 +1919,44 @@ void brcmf_sdbrcm_bus_dump(struct brcmf_pub *dhdp, struct brcmu_strbuf *strbuf) ...@@ -1919,44 +1919,44 @@ void brcmf_sdbrcm_bus_dump(struct brcmf_pub *dhdp, struct brcmu_strbuf *strbuf)
(bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs, (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs,
bus->f2rxdata, bus->f2txdata, bus->f1regdata); bus->f2rxdata, bus->f2txdata, bus->f1regdata);
{ {
dhd_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->dhd->rx_packets, dhd_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->drvr->rx_packets,
(bus->f2rxhdrs + bus->f2rxdata)); (bus->f2rxhdrs + bus->f2rxdata));
dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->rx_packets, dhd_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->rx_packets,
bus->f1regdata); bus->f1regdata);
dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->rx_packets, dhd_dump_pct(strbuf, ", pkts/sd", bus->drvr->rx_packets,
(bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata)); (bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata));
dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->rx_packets, dhd_dump_pct(strbuf, ", pkts/int", bus->drvr->rx_packets,
bus->intrcount); bus->intrcount);
brcmu_bprintf(strbuf, "\n"); brcmu_bprintf(strbuf, "\n");
dhd_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts), dhd_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts),
bus->dhd->rx_packets); bus->drvr->rx_packets);
dhd_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts, dhd_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts,
bus->rxglomframes); bus->rxglomframes);
brcmu_bprintf(strbuf, "\n"); brcmu_bprintf(strbuf, "\n");
dhd_dump_pct(strbuf, "Tx: pkts/f2wr", bus->dhd->tx_packets, dhd_dump_pct(strbuf, "Tx: pkts/f2wr", bus->drvr->tx_packets,
bus->f2txdata); bus->f2txdata);
dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->tx_packets, dhd_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->tx_packets,
bus->f1regdata); bus->f1regdata);
dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->tx_packets, dhd_dump_pct(strbuf, ", pkts/sd", bus->drvr->tx_packets,
(bus->f2txdata + bus->f1regdata)); (bus->f2txdata + bus->f1regdata));
dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->tx_packets, dhd_dump_pct(strbuf, ", pkts/int", bus->drvr->tx_packets,
bus->intrcount); bus->intrcount);
brcmu_bprintf(strbuf, "\n"); brcmu_bprintf(strbuf, "\n");
dhd_dump_pct(strbuf, "Total: pkts/f2rw", dhd_dump_pct(strbuf, "Total: pkts/f2rw",
(bus->dhd->tx_packets + bus->dhd->rx_packets), (bus->drvr->tx_packets + bus->drvr->rx_packets),
(bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata)); (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata));
dhd_dump_pct(strbuf, ", pkts/f1sd", dhd_dump_pct(strbuf, ", pkts/f1sd",
(bus->dhd->tx_packets + bus->dhd->rx_packets), (bus->drvr->tx_packets + bus->drvr->rx_packets),
bus->f1regdata); bus->f1regdata);
dhd_dump_pct(strbuf, ", pkts/sd", dhd_dump_pct(strbuf, ", pkts/sd",
(bus->dhd->tx_packets + bus->dhd->rx_packets), (bus->drvr->tx_packets + bus->drvr->rx_packets),
(bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata + (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata +
bus->f1regdata)); bus->f1regdata));
dhd_dump_pct(strbuf, ", pkts/int", dhd_dump_pct(strbuf, ", pkts/int",
(bus->dhd->tx_packets + bus->dhd->rx_packets), (bus->drvr->tx_packets + bus->drvr->rx_packets),
bus->intrcount); bus->intrcount);
brcmu_bprintf(strbuf, "\n\n"); brcmu_bprintf(strbuf, "\n\n");
} }
...@@ -1986,9 +1986,9 @@ void brcmf_sdbrcm_bus_dump(struct brcmf_pub *dhdp, struct brcmu_strbuf *strbuf) ...@@ -1986,9 +1986,9 @@ void brcmf_sdbrcm_bus_dump(struct brcmf_pub *dhdp, struct brcmu_strbuf *strbuf)
bus->sleeping); bus->sleeping);
} }
void dhd_bus_clearcounts(struct brcmf_pub *dhdp) void dhd_bus_clearcounts(struct brcmf_pub *drvr)
{ {
dhd_bus_t *bus = (dhd_bus_t *) dhdp->bus; dhd_bus_t *bus = (dhd_bus_t *) drvr->bus;
bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0; bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0;
bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0; bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0;
...@@ -2335,7 +2335,7 @@ static int brcmf_sdbrcm_mem_dump(dhd_bus_t *bus) ...@@ -2335,7 +2335,7 @@ static int brcmf_sdbrcm_mem_dump(dhd_bus_t *bus)
printk(KERN_DEBUG "Done\n"); printk(KERN_DEBUG "Done\n");
/* free buf before return !!! */ /* free buf before return !!! */
if (brcmf_write_to_file(bus->dhd, buf, bus->ramsize)) { if (brcmf_write_to_file(bus->drvr, buf, bus->ramsize)) {
DHD_ERROR(("%s: Error writing to files\n", __func__)); DHD_ERROR(("%s: Error writing to files\n", __func__));
return -1; return -1;
} }
...@@ -2430,7 +2430,7 @@ int brcmf_sdbrcm_downloadvars(dhd_bus_t *bus, void *arg, int len) ...@@ -2430,7 +2430,7 @@ int brcmf_sdbrcm_downloadvars(dhd_bus_t *bus, void *arg, int len)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
/* Basic sanity checks */ /* Basic sanity checks */
if (bus->dhd->up) { if (bus->drvr->up) {
bcmerror = -EISCONN; bcmerror = -EISCONN;
goto err; goto err;
} }
...@@ -2482,7 +2482,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2482,7 +2482,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
brcmf_sdbrcm_sdlock(bus); brcmf_sdbrcm_sdlock(bus);
/* Check if dongle is in reset. If so, only allow DEVRESET iovars */ /* Check if dongle is in reset. If so, only allow DEVRESET iovars */
if (bus->dhd->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) || if (bus->drvr->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) ||
actionid == IOV_GVAL(IOV_DEVRESET))) { actionid == IOV_GVAL(IOV_DEVRESET))) {
bcmerror = -EPERM; bcmerror = -EPERM;
goto exit; goto exit;
...@@ -2500,7 +2500,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2500,7 +2500,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
} }
/* Request clock to allow SDIO accesses */ /* Request clock to allow SDIO accesses */
if (!bus->dhd->dongle_reset) { if (!bus->drvr->dongle_reset) {
BUS_WAKE(bus); BUS_WAKE(bus);
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
} }
...@@ -2514,7 +2514,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2514,7 +2514,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
case IOV_SVAL(IOV_INTR): case IOV_SVAL(IOV_INTR):
bus->intr = bool_val; bus->intr = bool_val;
bus->intdis = false; bus->intdis = false;
if (bus->dhd->up) { if (bus->drvr->up) {
if (bus->intr) { if (bus->intr) {
DHD_INTR(("%s: enable SDIO device interrupts\n", DHD_INTR(("%s: enable SDIO device interrupts\n",
__func__)); __func__));
...@@ -2646,14 +2646,14 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2646,14 +2646,14 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
break; break;
case IOV_GVAL(IOV_READAHEAD): case IOV_GVAL(IOV_READAHEAD):
int_val = (s32) dhd_readahead; int_val = (s32) brcmf_readahead;
memcpy(arg, &int_val, val_size); memcpy(arg, &int_val, val_size);
break; break;
case IOV_SVAL(IOV_READAHEAD): case IOV_SVAL(IOV_READAHEAD):
if (bool_val && !dhd_readahead) if (bool_val && !brcmf_readahead)
bus->nextlen = 0; bus->nextlen = 0;
dhd_readahead = bool_val; brcmf_readahead = bool_val;
break; break;
case IOV_GVAL(IOV_SDRXCHAIN): case IOV_GVAL(IOV_SDRXCHAIN):
...@@ -2668,12 +2668,12 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2668,12 +2668,12 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
bus->use_rxchain = bool_val; bus->use_rxchain = bool_val;
break; break;
case IOV_GVAL(IOV_ALIGNCTL): case IOV_GVAL(IOV_ALIGNCTL):
int_val = (s32) dhd_alignctl; int_val = (s32) brcmf_alignctl;
memcpy(arg, &int_val, val_size); memcpy(arg, &int_val, val_size);
break; break;
case IOV_SVAL(IOV_ALIGNCTL): case IOV_SVAL(IOV_ALIGNCTL):
dhd_alignctl = bool_val; brcmf_alignctl = bool_val;
break; break;
case IOV_GVAL(IOV_SDALIGN): case IOV_GVAL(IOV_SDALIGN):
...@@ -2702,7 +2702,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2702,7 +2702,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
case IOV_SVAL(IOV_CONS): case IOV_SVAL(IOV_CONS):
if (len > 0) if (len > 0)
bcmerror = brcmf_sdbrcm_bus_console_in(bus->dhd, bcmerror = brcmf_sdbrcm_bus_console_in(bus->drvr,
arg, len - 1); arg, len - 1);
break; break;
...@@ -2852,10 +2852,10 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2852,10 +2852,10 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
case IOV_SVAL(IOV_DEVRESET): case IOV_SVAL(IOV_DEVRESET):
DHD_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d " DHD_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d "
"busstate=%d\n", "busstate=%d\n",
__func__, bool_val, bus->dhd->dongle_reset, __func__, bool_val, bus->drvr->dongle_reset,
bus->dhd->busstate)); bus->drvr->busstate));
brcmf_bus_devreset(bus->dhd, (u8) bool_val); brcmf_bus_devreset(bus->drvr, (u8) bool_val);
break; break;
...@@ -2863,7 +2863,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2863,7 +2863,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
DHD_TRACE(("%s: Called get IOV_DEVRESET\n", __func__)); DHD_TRACE(("%s: Called get IOV_DEVRESET\n", __func__));
/* Get its status */ /* Get its status */
int_val = (bool) bus->dhd->dongle_reset; int_val = (bool) bus->drvr->dongle_reset;
memcpy(arg, &int_val, val_size); memcpy(arg, &int_val, val_size);
break; break;
...@@ -2874,7 +2874,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2874,7 +2874,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
break; break;
case IOV_SVAL(IOV_WDTICK): case IOV_SVAL(IOV_WDTICK):
if (!bus->dhd->up) { if (!bus->drvr->up) {
bcmerror = -ENOLINK; bcmerror = -ENOLINK;
break; break;
} }
...@@ -2895,7 +2895,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid, ...@@ -2895,7 +2895,7 @@ brcmf_sdbrcm_doiovar(dhd_bus_t *bus, const struct brcmu_iovar *vi, u32 actionid,
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
if (actionid == IOV_SVAL(IOV_DEVRESET) && bool_val == false) if (actionid == IOV_SVAL(IOV_DEVRESET) && bool_val == false)
brcmf_c_preinit_ioctls((struct brcmf_pub *) bus->dhd); brcmf_c_preinit_ioctls(bus->drvr);
return bcmerror; return bcmerror;
} }
...@@ -3034,17 +3034,17 @@ static int brcmf_sdbrcm_download_state(dhd_bus_t *bus, bool enter) ...@@ -3034,17 +3034,17 @@ static int brcmf_sdbrcm_download_state(dhd_bus_t *bus, bool enter)
/* Allow HT Clock now that the ARM is running. */ /* Allow HT Clock now that the ARM is running. */
bus->alp_only = false; bus->alp_only = false;
bus->dhd->busstate = DHD_BUS_LOAD; bus->drvr->busstate = DHD_BUS_LOAD;
} }
fail: fail:
return bcmerror; return bcmerror;
} }
int int
brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *dhdp, const char *name, brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
void *params, int plen, void *arg, int len, bool set) void *params, int plen, void *arg, int len, bool set)
{ {
dhd_bus_t *bus = dhdp->bus; dhd_bus_t *bus = drvr->bus;
const struct brcmu_iovar *vi = NULL; const struct brcmu_iovar *vi = NULL;
int bcmerror = 0; int bcmerror = 0;
int val_size; int val_size;
...@@ -3165,7 +3165,7 @@ void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex) ...@@ -3165,7 +3165,7 @@ void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
bus->hostintmask = 0; bus->hostintmask = 0;
/* Change our idea of bus state */ /* Change our idea of bus state */
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
/* Force clocks on backplane to be sure F2 interrupt propagates */ /* Force clocks on backplane to be sure F2 interrupt propagates */
saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1,
...@@ -3206,7 +3206,7 @@ void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex) ...@@ -3206,7 +3206,7 @@ void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
/* Clear rx control and wake any waiters */ /* Clear rx control and wake any waiters */
bus->rxlen = 0; bus->rxlen = 0;
brcmf_os_ioctl_resp_wake(bus->dhd); brcmf_os_ioctl_resp_wake(bus->drvr);
/* Reset some F2 state stuff */ /* Reset some F2 state stuff */
bus->rxskip = false; bus->rxskip = false;
...@@ -3214,15 +3214,11 @@ void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex) ...@@ -3214,15 +3214,11 @@ void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
if (enforce_mutex) if (enforce_mutex)
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
#if defined(OOB_INTR_ONLY)
brcmf_sdio_unregister_oob_intr();
#endif /* defined(OOB_INTR_ONLY) */
} }
int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex) int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
{ {
dhd_bus_t *bus = dhdp->bus; dhd_bus_t *bus = drvr->bus;
struct brcmf_timeout tmo; struct brcmf_timeout tmo;
uint retries = 0; uint retries = 0;
u8 ready, enable; u8 ready, enable;
...@@ -3232,17 +3228,17 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex) ...@@ -3232,17 +3228,17 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
/* try to download image and nvram to the dongle */ /* try to download image and nvram to the dongle */
if (dhdp->busstate == DHD_BUS_DOWN) { if (drvr->busstate == DHD_BUS_DOWN) {
if (!(brcmf_sdbrcm_download_firmware(bus, bus->card))) if (!(brcmf_sdbrcm_download_firmware(bus, bus->card)))
return -1; return -1;
} }
ASSERT(bus->dhd); ASSERT(bus->drvr);
if (!bus->dhd) if (!bus->drvr)
return 0; return 0;
/* Start the watchdog timer */ /* Start the watchdog timer */
bus->dhd->tickcnt = 0; bus->drvr->tickcnt = 0;
brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms); brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms);
if (enforce_mutex) if (enforce_mutex)
...@@ -3299,7 +3295,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex) ...@@ -3299,7 +3295,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex)
(u8) watermark, &err); (u8) watermark, &err);
/* Set bus state according to enable result */ /* Set bus state according to enable result */
dhdp->busstate = DHD_BUS_DATA; drvr->busstate = DHD_BUS_DATA;
bus->intdis = false; bus->intdis = false;
if (bus->intr) { if (bus->intr) {
...@@ -3338,7 +3334,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex) ...@@ -3338,7 +3334,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *dhdp, bool enforce_mutex)
#endif /* defined(OOB_INTR_ONLY) */ #endif /* defined(OOB_INTR_ONLY) */
/* If we didn't come up, turn off backplane clock */ /* If we didn't come up, turn off backplane clock */
if (dhdp->busstate != DHD_BUS_DATA) if (drvr->busstate != DHD_BUS_DATA)
brcmf_sdbrcm_clkctl(bus, CLK_NONE, false); brcmf_sdbrcm_clkctl(bus, CLK_NONE, false);
exit: exit:
...@@ -3408,7 +3404,7 @@ static void brcmf_sdbrcm_rxfail(dhd_bus_t *bus, bool abort, bool rtx) ...@@ -3408,7 +3404,7 @@ static void brcmf_sdbrcm_rxfail(dhd_bus_t *bus, bool abort, bool rtx)
/* If we can't reach the device, signal failure */ /* If we can't reach the device, signal failure */
if (err || brcmf_sdcard_regfail(card)) if (err || brcmf_sdcard_regfail(card))
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
} }
static void static void
...@@ -3428,7 +3424,7 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) ...@@ -3428,7 +3424,7 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
ASSERT(bus->rxbuf); ASSERT(bus->rxbuf);
/* Set rxctl for frame (w/optional alignment) */ /* Set rxctl for frame (w/optional alignment) */
bus->rxctl = bus->rxbuf; bus->rxctl = bus->rxbuf;
if (dhd_alignctl) { if (brcmf_alignctl) {
bus->rxctl += firstread; bus->rxctl += firstread;
pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN); pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN);
if (pad) if (pad)
...@@ -3453,7 +3449,7 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) ...@@ -3453,7 +3449,7 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) {
pad = bus->blocksize - (rdlen % bus->blocksize); pad = bus->blocksize - (rdlen % bus->blocksize);
if ((pad <= bus->roundup) && (pad < bus->blocksize) && if ((pad <= bus->roundup) && (pad < bus->blocksize) &&
((len + pad) < bus->dhd->maxctl)) ((len + pad) < bus->drvr->maxctl))
rdlen += pad; rdlen += pad;
} else if (rdlen % BRCMF_SDALIGN) { } else if (rdlen % BRCMF_SDALIGN) {
rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN); rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN);
...@@ -3464,19 +3460,19 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) ...@@ -3464,19 +3460,19 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
rdlen = roundup(rdlen, ALIGNMENT); rdlen = roundup(rdlen, ALIGNMENT);
/* Drop if the read is too big or it exceeds our maximum */ /* Drop if the read is too big or it exceeds our maximum */
if ((rdlen + firstread) > bus->dhd->maxctl) { if ((rdlen + firstread) > bus->drvr->maxctl) {
DHD_ERROR(("%s: %d-byte control read exceeds %d-byte buffer\n", DHD_ERROR(("%s: %d-byte control read exceeds %d-byte buffer\n",
__func__, rdlen, bus->dhd->maxctl)); __func__, rdlen, bus->drvr->maxctl));
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdbrcm_rxfail(bus, false, false);
goto done; goto done;
} }
if ((len - doff) > bus->dhd->maxctl) { if ((len - doff) > bus->drvr->maxctl) {
DHD_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds " DHD_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds "
"%d-byte limit\n", "%d-byte limit\n",
__func__, len, (len - doff), bus->dhd->maxctl)); __func__, len, (len - doff), bus->drvr->maxctl));
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
bus->rx_toolong++; bus->rx_toolong++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdbrcm_rxfail(bus, false, false);
goto done; goto done;
...@@ -3514,7 +3510,7 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) ...@@ -3514,7 +3510,7 @@ brcmf_sdbrcm_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
done: done:
/* Awake any waiters */ /* Awake any waiters */
brcmf_os_ioctl_resp_wake(bus->dhd); brcmf_os_ioctl_resp_wake(bus->drvr);
} }
static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq) static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq)
...@@ -3677,7 +3673,7 @@ static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3677,7 +3673,7 @@ static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq)
if (errcode < 0) { if (errcode < 0) {
DHD_ERROR(("%s: glom read of %d bytes failed: %d\n", DHD_ERROR(("%s: glom read of %d bytes failed: %d\n",
__func__, dlen, errcode)); __func__, dlen, errcode));
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
if (bus->glomerr++ < 3) { if (bus->glomerr++ < 3) {
brcmf_sdbrcm_rxfail(bus, true, true); brcmf_sdbrcm_rxfail(bus, true, true);
...@@ -3872,11 +3868,11 @@ static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3872,11 +3868,11 @@ static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq)
save_pfirst = pnext; save_pfirst = pnext;
} }
continue; continue;
} else if (brcmf_proto_hdrpull(bus->dhd, &ifidx, pfirst) } else if (brcmf_proto_hdrpull(bus->drvr, &ifidx, pfirst)
!= 0) { != 0) {
DHD_ERROR(("%s: rx protocol error\n", DHD_ERROR(("%s: rx protocol error\n",
__func__)); __func__));
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
brcmu_pkt_buf_free_skb(pfirst); brcmu_pkt_buf_free_skb(pfirst);
if (plast) { if (plast) {
plast->next = pnext; plast->next = pnext;
...@@ -3908,7 +3904,7 @@ static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3908,7 +3904,7 @@ static u8 brcmf_sdbrcm_rxglom(dhd_bus_t *bus, u8 rxseq)
} }
if (num) { if (num) {
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
brcmf_rx_frame(bus->dhd, ifidx, save_pfirst, num); brcmf_rx_frame(bus->drvr, ifidx, save_pfirst, num);
brcmf_sdbrcm_sdlock(bus); brcmf_sdbrcm_sdlock(bus);
} }
...@@ -3961,7 +3957,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3961,7 +3957,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
*finished = false; *finished = false;
for (rxseq = bus->rx_seq, rxleft = maxframes; for (rxseq = bus->rx_seq, rxleft = maxframes;
!bus->rxskip && rxleft && bus->dhd->busstate != DHD_BUS_DOWN; !bus->rxskip && rxleft && bus->drvr->busstate != DHD_BUS_DOWN;
rxseq++, rxleft--) { rxseq++, rxleft--) {
/* Handle glomming separately */ /* Handle glomming separately */
...@@ -3977,7 +3973,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3977,7 +3973,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
} }
/* Try doing single read if we can */ /* Try doing single read if we can */
if (dhd_readahead && bus->nextlen) { if (brcmf_readahead && bus->nextlen) {
u16 nextlen = bus->nextlen; u16 nextlen = bus->nextlen;
bus->nextlen = 0; bus->nextlen = 0;
...@@ -4019,7 +4015,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4019,7 +4015,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (bus->bus == SPI_BUS) { if (bus->bus == SPI_BUS) {
bus->usebufpool = false; bus->usebufpool = false;
bus->rxctl = bus->rxbuf; bus->rxctl = bus->rxbuf;
if (dhd_alignctl) { if (brcmf_alignctl) {
bus->rxctl += firstread; bus->rxctl += firstread;
pad = ((unsigned long)bus->rxctl % pad = ((unsigned long)bus->rxctl %
BRCMF_SDALIGN); BRCMF_SDALIGN);
...@@ -4084,7 +4080,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4084,7 +4080,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n", DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
__func__, rdlen, sdret)); __func__, rdlen, sdret));
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
/* Force retry w/normal header read. /* Force retry w/normal header read.
* Don't attempt NAK for * Don't attempt NAK for
* gSPI * gSPI
...@@ -4167,7 +4163,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4167,7 +4163,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
bus->nextlen = 0; bus->nextlen = 0;
} }
bus->dhd->rx_readahead_cnt++; bus->drvr->rx_readahead_cnt++;
/* Handle Flow Control */ /* Handle Flow Control */
fcbits = SDPCM_FCMASK_VALUE( fcbits = SDPCM_FCMASK_VALUE(
...@@ -4389,7 +4385,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4389,7 +4385,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Too long -- skip this frame */ /* Too long -- skip this frame */
DHD_ERROR(("%s: too long: len %d rdlen %d\n", DHD_ERROR(("%s: too long: len %d rdlen %d\n",
__func__, len, rdlen)); __func__, len, rdlen));
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
bus->rx_toolong++; bus->rx_toolong++;
brcmf_sdbrcm_rxfail(bus, false, false); brcmf_sdbrcm_rxfail(bus, false, false);
continue; continue;
...@@ -4400,7 +4396,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4400,7 +4396,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Give up on data, request rtx of events */ /* Give up on data, request rtx of events */
DHD_ERROR(("%s: brcmu_pkt_buf_get_skb failed: rdlen %d" DHD_ERROR(("%s: brcmu_pkt_buf_get_skb failed: rdlen %d"
" chan %d\n", __func__, rdlen, chan)); " chan %d\n", __func__, rdlen, chan));
bus->dhd->rx_dropped++; bus->drvr->rx_dropped++;
brcmf_sdbrcm_rxfail(bus, false, RETRYCHAN(chan)); brcmf_sdbrcm_rxfail(bus, false, RETRYCHAN(chan));
continue; continue;
} }
...@@ -4429,7 +4425,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4429,7 +4425,7 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
? "data" : "test")), ? "data" : "test")),
sdret)); sdret));
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
brcmf_sdbrcm_rxfail(bus, true, RETRYCHAN(chan)); brcmf_sdbrcm_rxfail(bus, true, RETRYCHAN(chan));
continue; continue;
} }
...@@ -4487,16 +4483,16 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4487,16 +4483,16 @@ brcmf_sdbrcm_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
if (pkt->len == 0) { if (pkt->len == 0) {
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
continue; continue;
} else if (brcmf_proto_hdrpull(bus->dhd, &ifidx, pkt) != 0) { } else if (brcmf_proto_hdrpull(bus->drvr, &ifidx, pkt) != 0) {
DHD_ERROR(("%s: rx protocol error\n", __func__)); DHD_ERROR(("%s: rx protocol error\n", __func__));
brcmu_pkt_buf_free_skb(pkt); brcmu_pkt_buf_free_skb(pkt);
bus->dhd->rx_errors++; bus->drvr->rx_errors++;
continue; continue;
} }
/* Unlock during rx call */ /* Unlock during rx call */
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
brcmf_rx_frame(bus->dhd, ifidx, pkt, 1); brcmf_rx_frame(bus->drvr, ifidx, pkt, 1);
brcmf_sdbrcm_sdlock(bus); brcmf_sdbrcm_sdlock(bus);
} }
rxcount = maxframes - rxleft; rxcount = maxframes - rxleft;
...@@ -4621,7 +4617,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus) ...@@ -4621,7 +4617,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus)
if (err) { if (err) {
DHD_ERROR(("%s: error reading DEVCTL: %d\n", DHD_ERROR(("%s: error reading DEVCTL: %d\n",
__func__, err)); __func__, err));
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
} else { } else {
ASSERT(devctl & SBSDIO_DEVCTL_CA_INT_ONLY); ASSERT(devctl & SBSDIO_DEVCTL_CA_INT_ONLY);
} }
...@@ -4633,7 +4629,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus) ...@@ -4633,7 +4629,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus)
if (err) { if (err) {
DHD_ERROR(("%s: error reading CSR: %d\n", __func__, DHD_ERROR(("%s: error reading CSR: %d\n", __func__,
err)); err));
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
} }
DHD_INFO(("DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", devctl, DHD_INFO(("DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", devctl,
...@@ -4645,7 +4641,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus) ...@@ -4645,7 +4641,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus)
if (err) { if (err) {
DHD_ERROR(("%s: error reading DEVCTL: %d\n", DHD_ERROR(("%s: error reading DEVCTL: %d\n",
__func__, err)); __func__, err));
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
} }
devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY;
brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, brcmf_sdcard_cfg_write(card, SDIO_FUNC_1,
...@@ -4653,7 +4649,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus) ...@@ -4653,7 +4649,7 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus)
if (err) { if (err) {
DHD_ERROR(("%s: error writing DEVCTL: %d\n", DHD_ERROR(("%s: error writing DEVCTL: %d\n",
__func__, err)); __func__, err));
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
} }
bus->clkstate = CLK_AVAIL; bus->clkstate = CLK_AVAIL;
} else { } else {
...@@ -4813,12 +4809,12 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus) ...@@ -4813,12 +4809,12 @@ static bool brcmf_sdbrcm_dpc(dhd_bus_t *bus)
else await next interrupt */ else await next interrupt */
/* On failed register access, all bets are off: /* On failed register access, all bets are off:
no resched or interrupts */ no resched or interrupts */
if ((bus->dhd->busstate == DHD_BUS_DOWN) || if ((bus->drvr->busstate == DHD_BUS_DOWN) ||
brcmf_sdcard_regfail(card)) { brcmf_sdcard_regfail(card)) {
DHD_ERROR(("%s: failed backplane access over SDIO, halting " DHD_ERROR(("%s: failed backplane access over SDIO, halting "
"operation %d\n", __func__, "operation %d\n", __func__,
brcmf_sdcard_regfail(card))); brcmf_sdcard_regfail(card)));
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
bus->intstatus = 0; bus->intstatus = 0;
} else if (bus->clkstate == CLK_PENDING) { } else if (bus->clkstate == CLK_PENDING) {
DHD_INFO(("%s: rescheduled due to CLK_PENDING awaiting " DHD_INFO(("%s: rescheduled due to CLK_PENDING awaiting "
...@@ -4857,7 +4853,7 @@ void brcmf_sdbrcm_isr(void *arg) ...@@ -4857,7 +4853,7 @@ void brcmf_sdbrcm_isr(void *arg)
} }
card = bus->card; card = bus->card;
if (bus->dhd->busstate == DHD_BUS_DOWN) { if (bus->drvr->busstate == DHD_BUS_DOWN) {
DHD_ERROR(("%s : bus is down. we have nothing to do\n", DHD_ERROR(("%s : bus is down. we have nothing to do\n",
__func__)); __func__));
return; return;
...@@ -5153,15 +5149,15 @@ brcmf_sdbrcm_checkdied(dhd_bus_t *bus, struct sk_buff *pkt, uint seq) ...@@ -5153,15 +5149,15 @@ brcmf_sdbrcm_checkdied(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
} }
#endif /* SDTEST */ #endif /* SDTEST */
extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *dhdp) extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
{ {
dhd_bus_t *bus; dhd_bus_t *bus;
DHD_TIMER(("%s: Enter\n", __func__)); DHD_TIMER(("%s: Enter\n", __func__));
bus = dhdp->bus; bus = drvr->bus;
if (bus->dhd->dongle_reset) if (bus->drvr->dongle_reset)
return false; return false;
/* Ignore the timer if simulating bus down */ /* Ignore the timer if simulating bus down */
...@@ -5209,7 +5205,7 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *dhdp) ...@@ -5209,7 +5205,7 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *dhdp)
} }
#ifdef BCMDBG #ifdef BCMDBG
/* Poll for console output periodically */ /* Poll for console output periodically */
if (dhdp->busstate == DHD_BUS_DATA && brcmf_console_ms != 0) { if (drvr->busstate == DHD_BUS_DATA && brcmf_console_ms != 0) {
bus->console.count += brcmf_watchdog_ms; bus->console.count += brcmf_watchdog_ms;
if (bus->console.count >= brcmf_console_ms) { if (bus->console.count >= brcmf_console_ms) {
bus->console.count -= brcmf_console_ms; bus->console.count -= brcmf_console_ms;
...@@ -5267,7 +5263,7 @@ static int brcmf_sdbrcm_bus_console_in(struct brcmf_pub *drvr, ...@@ -5267,7 +5263,7 @@ static int brcmf_sdbrcm_bus_console_in(struct brcmf_pub *drvr,
brcmf_sdbrcm_sdlock(bus); brcmf_sdbrcm_sdlock(bus);
/* Don't allow input if dongle is in reset */ /* Don't allow input if dongle is in reset */
if (bus->dhd->dongle_reset) { if (bus->drvr->dongle_reset) {
brcmf_sdbrcm_sdunlock(bus); brcmf_sdbrcm_sdunlock(bus);
return -EPERM; return -EPERM;
} }
...@@ -5344,9 +5340,9 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no, ...@@ -5344,9 +5340,9 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
*/ */
brcmf_txbound = DHD_TXBOUND; brcmf_txbound = DHD_TXBOUND;
brcmf_rxbound = DHD_RXBOUND; brcmf_rxbound = DHD_RXBOUND;
dhd_alignctl = true; brcmf_alignctl = true;
sd1idle = true; sd1idle = true;
dhd_readahead = true; brcmf_readahead = true;
retrydata = false; retrydata = false;
brcmf_dongle_memsize = 0; brcmf_dongle_memsize = 0;
dhd_txminmax = DHD_TXMINMAX; dhd_txminmax = DHD_TXMINMAX;
...@@ -5472,8 +5468,8 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no, ...@@ -5472,8 +5468,8 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
} }
/* Attach to the dhd/OS/network interface */ /* Attach to the dhd/OS/network interface */
bus->dhd = brcmf_attach(bus, SDPCM_RESERVE); bus->drvr = brcmf_attach(bus, SDPCM_RESERVE);
if (!bus->dhd) { if (!bus->drvr) {
DHD_ERROR(("%s: dhd_attach failed\n", __func__)); DHD_ERROR(("%s: dhd_attach failed\n", __func__));
goto fail; goto fail;
} }
...@@ -5504,7 +5500,7 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no, ...@@ -5504,7 +5500,7 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
DHD_INFO(("%s: completed!!\n", __func__)); DHD_INFO(("%s: completed!!\n", __func__));
/* if firmware path present try to download and bring up bus */ /* if firmware path present try to download and bring up bus */
ret = brcmf_bus_start(bus->dhd); ret = brcmf_bus_start(bus->drvr);
if (ret != 0) { if (ret != 0) {
if (ret == -ENOLINK) { if (ret == -ENOLINK) {
DHD_ERROR(("%s: dongle is not responding\n", __func__)); DHD_ERROR(("%s: dongle is not responding\n", __func__));
...@@ -5512,7 +5508,7 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no, ...@@ -5512,7 +5508,7 @@ static void *brcmf_sdbrcm_probe(u16 venid, u16 devid, u16 bus_no,
} }
} }
/* Ok, have the per-port tell the stack we're open for business */ /* Ok, have the per-port tell the stack we're open for business */
if (brcmf_net_attach(bus->dhd, 0) != 0) { if (brcmf_net_attach(bus->drvr, 0) != 0) {
DHD_ERROR(("%s: Net attach failed!!\n", __func__)); DHD_ERROR(("%s: Net attach failed!!\n", __func__));
goto fail; goto fail;
} }
...@@ -5622,9 +5618,9 @@ static bool brcmf_sdbrcm_probe_malloc(dhd_bus_t *bus, void *card) ...@@ -5622,9 +5618,9 @@ static bool brcmf_sdbrcm_probe_malloc(dhd_bus_t *bus, void *card)
{ {
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (bus->dhd->maxctl) { if (bus->drvr->maxctl) {
bus->rxblen = bus->rxblen =
roundup((bus->dhd->maxctl + SDPCM_HDRLEN), roundup((bus->drvr->maxctl + SDPCM_HDRLEN),
ALIGNMENT) + BRCMF_SDALIGN; ALIGNMENT) + BRCMF_SDALIGN;
bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC); bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC);
if (!(bus->rxbuf)) { if (!(bus->rxbuf)) {
...@@ -5672,7 +5668,7 @@ static bool brcmf_sdbrcm_probe_init(dhd_bus_t *bus, void *card) ...@@ -5672,7 +5668,7 @@ static bool brcmf_sdbrcm_probe_init(dhd_bus_t *bus, void *card)
brcmf_sdcard_cfg_write(card, SDIO_FUNC_0, SDIO_CCCR_IOEx, brcmf_sdcard_cfg_write(card, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL); SDIO_FUNC_ENABLE_1, NULL);
bus->dhd->busstate = DHD_BUS_DOWN; bus->drvr->busstate = DHD_BUS_DOWN;
bus->sleeping = false; bus->sleeping = false;
bus->rxflow = false; bus->rxflow = false;
bus->prev_rxlim_hit = 0; bus->prev_rxlim_hit = 0;
...@@ -5739,10 +5735,10 @@ static void brcmf_sdbrcm_release(dhd_bus_t *bus) ...@@ -5739,10 +5735,10 @@ static void brcmf_sdbrcm_release(dhd_bus_t *bus)
brcmf_sdcard_intr_disable(bus->card); brcmf_sdcard_intr_disable(bus->card);
brcmf_sdcard_intr_dereg(bus->card); brcmf_sdcard_intr_dereg(bus->card);
if (bus->dhd) { if (bus->drvr) {
brcmf_detach(bus->dhd); brcmf_detach(bus->drvr);
brcmf_sdbrcm_release_dongle(bus); brcmf_sdbrcm_release_dongle(bus);
bus->dhd = NULL; bus->drvr = NULL;
} }
brcmf_sdbrcm_release_malloc(bus); brcmf_sdbrcm_release_malloc(bus);
...@@ -5757,7 +5753,7 @@ static void brcmf_sdbrcm_release_malloc(dhd_bus_t *bus) ...@@ -5757,7 +5753,7 @@ static void brcmf_sdbrcm_release_malloc(dhd_bus_t *bus)
{ {
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (bus->dhd && bus->dhd->dongle_reset) if (bus->drvr && bus->drvr->dongle_reset)
return; return;
kfree(bus->rxbuf); kfree(bus->rxbuf);
...@@ -5772,7 +5768,7 @@ static void brcmf_sdbrcm_release_dongle(dhd_bus_t *bus) ...@@ -5772,7 +5768,7 @@ static void brcmf_sdbrcm_release_dongle(dhd_bus_t *bus)
{ {
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (bus->dhd && bus->dhd->dongle_reset) if (bus->drvr && bus->drvr->dongle_reset)
return; return;
if (bus->ci) { if (bus->ci) {
...@@ -5794,7 +5790,7 @@ static void brcmf_sdbrcm_disconnect(void *ptr) ...@@ -5794,7 +5790,7 @@ static void brcmf_sdbrcm_disconnect(void *ptr)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (bus) { if (bus) {
ASSERT(bus->dhd); ASSERT(bus->drvr);
brcmf_sdbrcm_release(bus); brcmf_sdbrcm_release(bus);
} }
...@@ -6054,7 +6050,7 @@ uint dhd_bus_chip(struct dhd_bus *bus) ...@@ -6054,7 +6050,7 @@ uint dhd_bus_chip(struct dhd_bus *bus)
void *dhd_bus_pub(struct dhd_bus *bus) void *dhd_bus_pub(struct dhd_bus *bus)
{ {
return bus->dhd; return bus->drvr;
} }
void *dhd_bus_txq(struct dhd_bus *bus) void *dhd_bus_txq(struct dhd_bus *bus)
...@@ -6067,16 +6063,16 @@ uint dhd_bus_hdrlen(struct dhd_bus *bus) ...@@ -6067,16 +6063,16 @@ uint dhd_bus_hdrlen(struct dhd_bus *bus)
return SDPCM_HDRLEN; return SDPCM_HDRLEN;
} }
int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag) int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag)
{ {
int bcmerror = 0; int bcmerror = 0;
dhd_bus_t *bus; dhd_bus_t *bus;
bus = dhdp->bus; bus = drvr->bus;
if (flag == true) { if (flag == true) {
brcmf_sdbrcm_wd_timer(bus, 0); brcmf_sdbrcm_wd_timer(bus, 0);
if (!bus->dhd->dongle_reset) { if (!bus->drvr->dongle_reset) {
/* Expect app to have torn down any /* Expect app to have torn down any
connection before calling */ connection before calling */
/* Stop the bus, disable F2 */ /* Stop the bus, disable F2 */
...@@ -6086,8 +6082,8 @@ int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag) ...@@ -6086,8 +6082,8 @@ int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag)
detach from the dongle */ detach from the dongle */
brcmf_sdbrcm_release_dongle(bus); brcmf_sdbrcm_release_dongle(bus);
bus->dhd->dongle_reset = true; bus->drvr->dongle_reset = true;
bus->dhd->up = false; bus->drvr->up = false;
DHD_TRACE(("%s: WLAN OFF DONE\n", __func__)); DHD_TRACE(("%s: WLAN OFF DONE\n", __func__));
/* App can now remove power from device */ /* App can now remove power from device */
...@@ -6098,7 +6094,7 @@ int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag) ...@@ -6098,7 +6094,7 @@ int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag)
DHD_TRACE(("\n\n%s: == WLAN ON ==\n", __func__)); DHD_TRACE(("\n\n%s: == WLAN ON ==\n", __func__));
if (bus->dhd->dongle_reset) { if (bus->drvr->dongle_reset) {
/* Turn on WLAN */ /* Turn on WLAN */
/* Attempt to re-attach & download */ /* Attempt to re-attach & download */
...@@ -6108,12 +6104,10 @@ int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag) ...@@ -6108,12 +6104,10 @@ int brcmf_bus_devreset(struct brcmf_pub *dhdp, u8 flag)
/* Attempt to download binary to the dongle */ /* Attempt to download binary to the dongle */
if (brcmf_sdbrcm_probe_init(bus, bus->card)) { if (brcmf_sdbrcm_probe_init(bus, bus->card)) {
/* Re-init bus, enable F2 transfer */ /* Re-init bus, enable F2 transfer */
brcmf_sdbrcm_bus_init( brcmf_sdbrcm_bus_init(bus->drvr, false);
(struct brcmf_pub *) bus->dhd,
false);
bus->dhd->dongle_reset = false; bus->drvr->dongle_reset = false;
bus->dhd->up = true; bus->drvr->up = true;
DHD_TRACE(("%s: WLAN ON DONE\n", DHD_TRACE(("%s: WLAN ON DONE\n",
__func__)); __func__));
...@@ -6565,10 +6559,10 @@ brcmf_sdbrcm_watchdog_thread(void *data) ...@@ -6565,10 +6559,10 @@ brcmf_sdbrcm_watchdog_thread(void *data)
if (kthread_should_stop()) if (kthread_should_stop())
break; break;
if (!wait_for_completion_interruptible(&bus->watchdog_wait)) { if (!wait_for_completion_interruptible(&bus->watchdog_wait)) {
if (bus->dhd->dongle_reset == false) if (bus->drvr->dongle_reset == false)
brcmf_sdbrcm_bus_watchdog(bus->dhd); brcmf_sdbrcm_bus_watchdog(bus->drvr);
/* Count the tick for reference */ /* Count the tick for reference */
bus->dhd->tickcnt++; bus->drvr->tickcnt++;
} else } else
break; break;
} }
...@@ -6586,10 +6580,10 @@ brcmf_sdbrcm_watchdog(unsigned long data) ...@@ -6586,10 +6580,10 @@ brcmf_sdbrcm_watchdog(unsigned long data)
else else
return; return;
} else { } else {
brcmf_sdbrcm_bus_watchdog(bus->dhd); brcmf_sdbrcm_bus_watchdog(bus->drvr);
/* Count the tick for reference */ /* Count the tick for reference */
bus->dhd->tickcnt++; bus->drvr->tickcnt++;
} }
/* Reschedule the watchdog */ /* Reschedule the watchdog */
...@@ -6603,7 +6597,7 @@ brcmf_sdbrcm_wd_timer(struct dhd_bus *bus, uint wdtick) ...@@ -6603,7 +6597,7 @@ brcmf_sdbrcm_wd_timer(struct dhd_bus *bus, uint wdtick)
static uint save_ms; static uint save_ms;
/* don't start the wd until fw is loaded */ /* don't start the wd until fw is loaded */
if (bus->dhd->busstate == DHD_BUS_DOWN) if (bus->drvr->busstate == DHD_BUS_DOWN)
return; return;
/* Totally stop the timer */ /* Totally stop the timer */
...@@ -6662,7 +6656,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data) ...@@ -6662,7 +6656,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data)
if (!wait_for_completion_interruptible(&bus->dpc_wait)) { if (!wait_for_completion_interruptible(&bus->dpc_wait)) {
/* Call bus dpc unless it indicated down /* Call bus dpc unless it indicated down
(then clean stop) */ (then clean stop) */
if (bus->dhd->busstate != DHD_BUS_DOWN) { if (bus->drvr->busstate != DHD_BUS_DOWN) {
if (brcmf_sdbrcm_dpc(bus)) if (brcmf_sdbrcm_dpc(bus))
complete(&bus->dpc_wait); complete(&bus->dpc_wait);
} else { } else {
...@@ -6679,7 +6673,7 @@ static void brcmf_sdbrcm_dpc_tasklet(unsigned long data) ...@@ -6679,7 +6673,7 @@ static void brcmf_sdbrcm_dpc_tasklet(unsigned long data)
dhd_bus_t *bus = (dhd_bus_t *) data; dhd_bus_t *bus = (dhd_bus_t *) data;
/* Call bus dpc unless it indicated down (then clean stop) */ /* Call bus dpc unless it indicated down (then clean stop) */
if (bus->dhd->busstate != DHD_BUS_DOWN) { if (bus->drvr->busstate != DHD_BUS_DOWN) {
if (brcmf_sdbrcm_dpc(bus)) if (brcmf_sdbrcm_dpc(bus))
tasklet_schedule(&bus->tasklet); tasklet_schedule(&bus->tasklet);
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment