staging: brcm80211: 7th reaction for mainline patch #2
PATCH v2 9/19 staging: brcm80211: remove fullmac module_param brcmf_sdiod_drive_strength
In reply to Franky LinReplaced the global variable with constant
--- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +2 -4
@@ -759,9 +759,7 @@ static uint brcmf_txminmax;int brcmf_idletime =1 ;module_param (brcmf_idletime, int,0 ); -/* SDIO Drive Strength (in milliamps) */ -uint brcmf_sdiod_drive_strength =6 ; -module_param (brcmf_sdiod_drive_strength, uint,0 ); +#define SDIO_DRIVE_STRENGTH 6/* in milliamps */ /* Use polling */ uint brcmf_poll;
@@ -4607,7 +4605,7 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva) goto fail; } -brcmf_sdbrcm_sdiod_drive_strength_init (bus, brcmf_sdiod_drive_strength); +brcmf_sdbrcm_sdiod_drive_strength_init (bus,SDIO_DRIVE_STRENGTH );/* Get info on the ARM and SOCRAM cores... */ brcmf_sdcard_reg_read(bus->sdiodev,
Signature · 1 line
1.7.1
PATCH v2 11/19 staging: brcm80211: remove fullmac module_param brcmf_idletime
In reply to Franky LinUse constant for idle time setting.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 1 + drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +1 -0
@@ -808,5 +808,6 @@ extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,#define BRCMF_IDLE_IMMEDIATE (-1)#define BRCMF_IDLE_ACTIVE 0/* Do not request any SD clock change when idle */ +#define BRCMF_IDLE_INTERVAL 1#endif /* _BRCMF_H_ */
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +1 -4
@@ -747,9 +747,6 @@ module_param(brcmf_txbound, uint, 0);module_param (brcmf_rxbound, uint,0 );static uint brcmf_txminmax; -int brcmf_idletime =1 ; -module_param (brcmf_idletime, int,0 ); -#define SDIO_DRIVE_STRENGTH 6/* in milliamps */ /* Use polling */
@@ -4650,7 +4647,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)/* ...and initialize clock/power states */ bus->clkstate =CLK_SDONLY ; - bus->idletime = (s32 ) brcmf_idletime; + bus->idletime =BRCMF_IDLE_INTERVAL ; bus->idleclock =BRCMF_IDLE_ACTIVE ;/* Query the F2 block size, set roundup accordingly */
Signature · 1 line
1.7.1
PATCH v2 14/19 staging: brcm80211: added endianness check flag to fullmac Makefile
In reply to Franky LinFrom: Roland Vossen <[email protected]>
--- drivers/staging/brcm80211/brcmfmac/Makefile | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/brcm80211/brcmfmac/Makefile +1 -0
@@ -30,3 +30,4 @@ DHDOFILES = \ obj-$(CONFIG_BRCMFMAC) += brcmfmac.o brcmfmac-objs += $(DHDOFILES) +ccflags-y += -D__CHECK_ENDIAN__
Signature · 1 line
1.7.1
PATCH v2 15/19 staging: brcm80211: removed likely/unlikely calls
In reply to Franky LinFrom: Roland Vossen <[email protected]>
There was no performance rationale to use these guys.
--- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 4 +- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 211 +++++++++++----------- drivers/staging/brcm80211/brcmsmac/ampdu.c | 2 +- 3 files changed, 107 insertions(+), 110 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +2 -2
@@ -944,7 +944,7 @@ static int brcmf_netdev_open(struct net_device *net)/* Allow transmit calls */ netif_start_queue (net); drvr_priv->pub.up =1 ; -if (unlikely (brcmf_cfg80211_up (drvr_priv->pub.config))) { +if (brcmf_cfg80211_up (drvr_priv->pub.config)) {brcmf_dbg (ERROR ,"failed to bring up cfg80211\n" );return -1 ; }
@@ -1054,7 +1054,7 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)brcmf_cfg80211_attach (net,brcmf_bus_get_device (bus), &drvr_priv->pub); -if (unlikely (drvr_priv->pub.config ==NULL )) { +if (drvr_priv->pub.config ==NULL ) {brcmf_dbg (ERROR ,"wl_cfg80211_attach failed\n" ); goto fail; }
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +104 -107
802 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/ampdu.c +1 -1
@@ -1132,7 +1132,7 @@ brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, s2 =R_REG (&wlc->regs->frmtxstatus2); } -if (likely (scb)) { +if (scb) { scb_ampdu = &scb->scb_ampdu; ini = &scb_ampdu->ini[p->priority];brcms_c_ampdu_dotxstatus_complete (ampdu, scb, p, txs, s1, s2);
Signature · 1 line
1.7.1
PATCH v2 17/19 staging: brcm80211: clarified fullmac io and event codes
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Added comments to make code more readable.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 4 ++++ drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 5 +++++ drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 2 ++ 3 files changed, 11 insertions(+), 0 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +4 -0
@@ -27,6 +27,9 @@#define BRCMF_C_IOCTL_MEDLEN 1536/* "med" ioctl buffer required */ #define BRCMF_C_IOCTL_MAXLEN 8192 +/******************************************************************************* +* IO codes that are interpreted by dongle firmware +******************************************************************************/ #define BRCMF_C_UP 2#define BRCMF_C_SET_PROMISC 10#define BRCMF_C_GET_RATE 12
@@ -171,6 +174,7 @@ struct dngl_stats {unsigned long multicast;/* multicast packets received */ }; +/* event codes sent by the dongle to this driver */ #define BRCMF_E_SET_SSID 0#define BRCMF_E_JOIN 1#define BRCMF_E_START 2
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +5 -0
@@ -14,6 +14,11 @@* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +/******************************************************************************* +* Communicates with the dongle by using Broadcom specific ioctl codes. +* For certain ioctl codes, the dongle interprets string data from the host. +******************************************************************************/ +#include <linux/types.h> #include <linux/netdevice.h> #include <linux/sched.h>
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +2 -0
@@ -14,6 +14,8 @@* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +/* Toplevel file. Relies on dhd_linux.c to send ioctls to the dongle. */ +#include <linux/kernel.h> #include <linux/if_arp.h> #include <linux/sched.h>
Signature · 1 line
1.7.1
v2 cover staging: brcm80211: 7th reaction for mainline patch #2
Code clean up for fullmac.
v2:
* remove patch "staging: brcm80211: reduced checkpatch warnings to zero" based on Joe Perches's comments
Arend van Spriel (1):
staging: brcm80211: remove unconditional code blocks from brcmfmac
Franky Lin (6):
staging: brcm80211: remove event handler thread from fullmac
staging: brcm80211: remove fullmac module_param brcmf_dongle_memsize
staging: brcm80211: remove fullmac module_param
brcmf_sdiod_drive_strength
staging: brcm80211: remove fullmac module_param for watchdog
staging: brcm80211: remove fullmac module_param brcmf_idletime
staging: brcm80211: remove global variables for data frame boundary
Roland Vossen (12):
staging: brcm80211: sparse endianness warnings on dongle events
staging: brcm80211: various fulmac sparse endianness fixes
staging: brcm80211: sparse endianness warnings for struct
brcmf_proto_cdc_ioctl
staging: brcm80211: sparse endianness warnings for struct
sdpcm_shared
staging: brcm80211: more fullmac sparse endianness scan related
changes
staging: brcm80211: removed two fullmac sparse spinlock warnings
staging: brcm80211: added endianness check flag to fullmac Makefile
staging: brcm80211: removed likely/unlikely calls
staging: brcm80211: removed log after kzalloc()/kmalloc() failure
staging: brcm80211: clarified fullmac io and event codes
staging: brcm80211: consistent naming of struct net_device *ndev
staging: brcm80211: simplified internal ioctl function once more
drivers/staging/brcm80211/brcmfmac/Makefile | 1 + drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 2 +- drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 6 +- drivers/staging/brcm80211/brcmfmac/dhd.h | 51 +- drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 13 +- drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 37 +- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 166 +++--- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 296 +++++----- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 215 +++---- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 678 +++++++++------------ drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 11 +- drivers/staging/brcm80211/brcmsmac/ampdu.c | 8 +- drivers/staging/brcm80211/brcmsmac/antsel.c | 5 +- drivers/staging/brcm80211/brcmsmac/channel.c | 5 +- drivers/staging/brcm80211/brcmsmac/dma.c | 16 +- drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 11 +- drivers/staging/brcm80211/brcmsmac/nicpci.c | 3 +- drivers/staging/brcm80211/brcmsmac/phy_shim.c | 7 +- 18 files changed, 689 insertions(+), 842 deletions(-)
PATCH v2 1/19 staging: brcm80211: sparse endianness warnings on dongle events
From: Roland Vossen <[email protected]>
Structures received from dongle have been annotated.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 14 ++++++------ drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 3 +- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 21 ++++++++++--------- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 24 +++++++++++----------- 4 files changed, 32 insertions(+), 30 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +7 -7
@@ -134,13 +134,13 @@#define BRCMF_EVENT_MSG_GROUP 0x04struct brcmf_event_msg { -u16 version; -u16 flags; -u32 event_type; -u32 status; -u32 reason; -u32 auth_type; -u32 datalen; +__be16 version; +__be16 flags; +__be32 event_type; +__be32 status; +__be32 reason; +__be32 auth_type; +__be32 datalen;u8 addr[ETH_ALEN ];char ifname[IFNAMSIZ ]; } __packed;
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +2 -1
@@ -322,7 +322,8 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,/* Intercept the wme_dp ioctl here */ if (!ret && ioc->cmd ==BRCMF_C_SET_VAR && !strcmp (ioc->buf,"wme_dp" )) { -int slen, val =0 ; +int slen; +__le32 val =0 ; slen =strlen ("wme_dp" ) +1 ;if (len >= (int )(slen +sizeof (int )))
drivers/staging/brcm80211/brcmfmac/dhd_common.c +11 -10
@@ -53,15 +53,15 @@ static const char brcmf_version[] =struct msgtrace_hdr {u8 version;u8 spare; -u16 len;/* Len of the trace */ -u32 seqnum;/* Sequence number of message. Useful +__be16 len;/* Len of the trace */ +__be32 seqnum;/* Sequence number of message. Useful * if the messsage has been lost * because of DMA error or a bus reset * (ex: SDIO Func2) */ -u32 discarded_bytes;/* Number of discarded bytes because of +__be32 discarded_bytes;/* Number of discarded bytes because of trace overflow */ -u32 discarded_printf;/* Number of discarded printf +__be32 discarded_printf;/* Number of discarded printf because of trace overflow */ } __packed;
@@ -401,7 +401,7 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)case BRCMF_E_RSSI :brcmf_dbg (EVENT ,"MACEVENT: %s %d\n" , - event_name,be32_to_cpu (*((int *)event_data))); + event_name,be32_to_cpu (*((__be32 *)event_data)));break ;default :
@@ -498,14 +498,15 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,/* put it back to BRCMF_E_NDIS_LINK */ if (type ==BRCMF_E_NDIS_LINK ) { -u32 temp; +u32 temp1; +__be32 temp2; - temp =get_unaligned_be32 (&event->event_type); + temp1 =get_unaligned_be32 (&event->event_type);brcmf_dbg (TRACE ,"Converted to WLC_E_LINK type %d\n" , - temp); + temp1); - temp =be32_to_cpu (BRCMF_E_NDIS_LINK ); -memcpy ((void *)(&pvt_data->msg.event_type), &temp, + temp2 =cpu_to_be32 (BRCMF_E_NDIS_LINK ); +memcpy ((void *)(&pvt_data->msg.event_type), &temp2,sizeof (pvt_data->msg.event_type)); }break ;
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +12 -12
@@ -63,10 +63,10 @@ struct brcmf_trap {#define CBUF_LEN (128) -struct rte_log { -u32 buf;/* Can't be pointer on (64-bit) hosts */ -uint buf_size; -uint idx; +struct rte_log_le { +__le32 buf;/* Can't be pointer on (64-bit) hosts */ +__le32 buf_size; +__le32 idx;char *_buf_compat;/* Redundant pointer for backward compat. */ };
@@ -89,7 +89,7 @@ struct rte_console {* Output will be lost if the output wraps around faster than the host * polls. */ -struct rte_log log; +struct rte_log_le log_le;/* Console input line buffer * Characters are read one at a time into cbuf
@@ -512,7 +512,7 @@ struct sdpcmd_regs {struct brcmf_console {uint count;/* Poll interval msec counter */ uint log_addr;/* Log struct address (fixed) */ -struct rte_log log;/* Log struct (host copy) */ +struct rte_log_le log_le;/* Log struct (host copy) */ uint bufsize;/* Size of log buffer */ u8 *buf;/* Log buffer (host copy) */ uint last;/* Last buffer read index */
@@ -3153,21 +3153,21 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)return 0 ;/* Read console log struct */ - addr = bus->console_addr + offsetof(struct rte_console , log); - rv =brcmf_sdbrcm_membytes (bus, false, addr, (u8 *)&c->log, -sizeof (c->log)); + addr = bus->console_addr + offsetof(struct rte_console , log_le); + rv =brcmf_sdbrcm_membytes (bus, false, addr, (u8 *)&c->log_le, +sizeof (c->log_le));if (rv <0 )return rv;/* Allocate console buffer (one time only) */ if (c->buf ==NULL ) { - c->bufsize =le32_to_cpu (c->log.buf_size); + c->bufsize =le32_to_cpu (c->log_le.buf_size); c->buf =kmalloc (c->bufsize,GFP_ATOMIC );if (c->buf ==NULL )return -ENOMEM ; } - idx =le32_to_cpu (c->log.idx); + idx =le32_to_cpu (c->log_le.idx);/* Protect against corrupt value */ if (idx > c->bufsize)
@@ -3179,7 +3179,7 @@ static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus)return 0 ;/* Read the console buffer */ - addr =le32_to_cpu (c->log.buf); + addr =le32_to_cpu (c->log_le.buf); rv =brcmf_sdbrcm_membytes (bus, false, addr, c->buf, c->bufsize);if (rv <0 )return rv;
Signature · 1 line
1.7.1
PATCH v2 3/19 staging: brcm80211: sparse endianness warnings for struct brcmf_proto_cdc_ioctl
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Structure that is send/received to/from dongle has been annotated.
--- drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +11 -14
@@ -28,11 +28,11 @@#include "dhd_dbg.h" struct brcmf_proto_cdc_ioctl { -u32 cmd;/* ioctl command value */ -u32 len;/* lower 16: output buflen; +__le32 cmd;/* ioctl command value */ +__le32 len;/* lower 16: output buflen; * upper 16: input buflen (excludes header) */ -u32 flags;/* flag defns given below */ -u32 status;/* status code returned from the device */ +__le32 flags;/* flag defns given below */ +__le32 status;/* status code returned from the device */ };/* Max valid buffer size that can be sent to the dongle */
@@ -47,9 +47,6 @@ struct brcmf_proto_cdc_ioctl {#define CDCF_IOC_ID_SHIFT 16/* ID Mask shift bits */ #define CDC_IOC_ID (flags) \ (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT) -#define CDC_SET_IF_IDX (hdr, idx) \ - ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \ - ((idx) << CDCF_IOC_IF_SHIFT)))/* * BDC header - Broadcom specific extension of CDC.
@@ -144,7 +141,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,struct brcmf_proto_cdc_ioctl *msg = &prot->msg;void *info;int ret =0 , retries =0 ; -u32 id, flags =0 ; +u32 id, flags;brcmf_dbg (TRACE ,"Enter\n" );brcmf_dbg (CTL ,"cmd %d len %d\n" , cmd, len);
@@ -165,9 +162,9 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, msg->cmd =cpu_to_le32 (cmd); msg->len =cpu_to_le32 (len); - msg->flags = (++prot->reqid <<CDCF_IOC_ID_SHIFT ); -CDC_SET_IF_IDX (msg, ifidx); - msg->flags =cpu_to_le32 (msg->flags); + flags = (++prot->reqid <<CDCF_IOC_ID_SHIFT ); + flags = (flags & ~CDCF_IOC_IF_MASK ) | (ifidx <<CDCF_IOC_IF_SHIFT ); + msg->flags =cpu_to_le32 (flags);if (buf)memcpy (prot->buf, buf, len);
@@ -233,9 +230,9 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, msg->cmd =cpu_to_le32 (cmd); msg->len =cpu_to_le32 (len); - msg->flags = (++prot->reqid <<CDCF_IOC_ID_SHIFT ) |CDCF_IOC_SET ; -CDC_SET_IF_IDX (msg, ifidx); - msg->flags =cpu_to_le32 (msg->flags); + flags = (++prot->reqid <<CDCF_IOC_ID_SHIFT ) |CDCF_IOC_SET ; + flags = (flags & ~CDCF_IOC_IF_MASK ) | (ifidx <<CDCF_IOC_IF_SHIFT ); + msg->flags =cpu_to_le32 (flags);if (buf)memcpy (prot->buf, buf, len);
Signature · 1 line
1.7.1
PATCH v2 5/19 staging: brcm80211: more fullmac sparse endianness scan related changes
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Annotated endianness on structures send/received to/from dongle.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 25 +++++++-- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 64 +++++++++++----------- 2 files changed, 52 insertions(+), 37 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +19 -6
@@ -469,6 +469,13 @@ struct brcmf_scan_results {struct brcmf_bss_info bss_info[1 ]; }; +struct brcmf_scan_results_le { +__le32 buflen; +__le32 version; +__le32 count; +struct brcmf_bss_info bss_info[1 ]; +}; +/* used for association with a specific BSSID and chanspec list */ struct brcmf_assoc_params_le {/* 00:00:00:00:00:00: broadcast scan */
@@ -492,8 +499,14 @@ struct brcmf_join_params {/* incremental scan results struct */ struct brcmf_iscan_results { -u32 status; -struct brcmf_scan_results results; +union { +u32 status; +__le32 status_le; + }; +union { +struct brcmf_scan_results results; +struct brcmf_scan_results_le results_le; + }; };/* size of brcmf_iscan_results not including variable length array */
@@ -549,10 +562,10 @@ struct brcmf_scb_val_le { };/* channel encoding */ -struct brcmf_channel_info { -int hw_channel; -int target_channel; -int scan_channel; +struct brcmf_channel_info_le { +__le32 hw_channel; +__le32 target_channel; +__le32 scan_channel; };/* Linux network driver ioctl encoding */
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +33 -31
137 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 6/19 staging: brcm80211: remove unconditional code blocks from brcmfmac
In reply to Franky LinFrom: Arend van Spriel <[email protected]>
Using a block statement to scope function variables is not common in linux kernel development. Browsed through the brcmfmac to remove those.
--- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 132 +++++++++++----------- 1 files changed, 66 insertions(+), 66 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_common.c +66 -66
@@ -198,6 +198,11 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"} };uint event_type, flags, auth_type, datalen; +static u32 seqnum_prev; +struct msgtrace_hdr hdr; +u32 nblost; +char *s, *p; + event_type =be32_to_cpu (event->event_type); flags =be16_to_cpu (event->flags); status =be32_to_cpu (event->status);
@@ -348,55 +353,52 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)break ;case BRCMF_E_TRACE : - { -static u32 seqnum_prev; -struct msgtrace_hdr hdr; -u32 nblost; -char *s, *p; - - buf = (unsigned char *) event_data; -memcpy (&hdr, buf,sizeof (struct msgtrace_hdr )); - -if (hdr.version !=MSGTRACE_VERSION ) { -brcmf_dbg (ERROR ,"MACEVENT: %s [unsupported version --> brcmf version:%d dongle version:%d]\n" , - event_name, -MSGTRACE_VERSION , hdr.version); -/* Reset datalen to avoid display below */ - datalen =0 ; -break ; - } - -/* There are 2 bytes available at the end of data */ - *(buf +sizeof (struct msgtrace_hdr ) - +be16_to_cpu (hdr.len)) ='\0' ; - -if (be32_to_cpu (hdr.discarded_bytes) - ||be32_to_cpu (hdr.discarded_printf)) -brcmf_dbg (ERROR ,"WLC_E_TRACE: [Discarded traces in dongle --> discarded_bytes %d discarded_printf %d]\n" , -be32_to_cpu (hdr.discarded_bytes), -be32_to_cpu (hdr.discarded_printf)); - - nblost =be32_to_cpu (hdr.seqnum) - seqnum_prev -1 ; -if (nblost >0 ) -brcmf_dbg (ERROR ,"WLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n" , -be32_to_cpu (hdr.seqnum), nblost); - seqnum_prev =be32_to_cpu (hdr.seqnum); - -/* Display the trace buffer. Advance from \n to \n to -* avoid display big -* printf (issue with Linux printk ) -*/ - p = (char *)&buf[sizeof (struct msgtrace_hdr )]; -while ((s =strstr (p,"\n" )) !=NULL ) { - *s ='\0' ; -printk (KERN_DEBUG "%s\n" , p); - p = s +1 ; - } -printk (KERN_DEBUG "%s\n" , p); + buf = (unsigned char *) event_data; +memcpy (&hdr, buf,sizeof (struct msgtrace_hdr )); +if (hdr.version !=MSGTRACE_VERSION ) { +brcmf_dbg (ERROR , +"MACEVENT: %s [unsupported version --> brcmf" +" version:%d dongle version:%d]\n" , + event_name,MSGTRACE_VERSION , hdr.version);/* Reset datalen to avoid display below */ datalen =0 ; +break ; + } + +/* There are 2 bytes available at the end of data */ + *(buf +sizeof (struct msgtrace_hdr ) + +be16_to_cpu (hdr.len)) ='\0' ; + +if (be32_to_cpu (hdr.discarded_bytes) + ||be32_to_cpu (hdr.discarded_printf)) +brcmf_dbg (ERROR , +"WLC_E_TRACE: [Discarded traces in dongle -->" +" discarded_bytes %d discarded_printf %d]\n" , +be32_to_cpu (hdr.discarded_bytes), +be32_to_cpu (hdr.discarded_printf)); + + nblost =be32_to_cpu (hdr.seqnum) - seqnum_prev -1 ; +if (nblost >0 ) +brcmf_dbg (ERROR ,"WLC_E_TRACE: [Event lost --> seqnum " +" %d nblost %d\n" ,be32_to_cpu (hdr.seqnum), + nblost); + seqnum_prev =be32_to_cpu (hdr.seqnum); + +/* Display the trace buffer. Advance from \n to \n to +* avoid display big +* printf (issue with Linux printk ) +*/ + p = (char *)&buf[sizeof (struct msgtrace_hdr )]; +while ((s =strstr (p,"\n" )) !=NULL ) { + *s ='\0' ; +printk (KERN_DEBUG "%s\n" , p); + p = s +1 ; } +printk (KERN_DEBUG "%s\n" , p); + +/* Reset datalen to avoid display below */ + datalen =0 ;break ;case BRCMF_E_RSSI :
@@ -405,8 +407,9 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)break ;default : -brcmf_dbg (EVENT ,"MACEVENT: %s %d, MAC %s, status %d, reason %d, auth %d\n" , - event_name, event_type, eabuf, +brcmf_dbg (EVENT , +"MACEVENT: %s %d, MAC %s, status %d, reason %d, " +"auth %d\n" , event_name, event_type, eabuf, (int )status, (int )reason, (int )auth_type);break ; }
@@ -428,6 +431,7 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata, {/* check whether packet is a BRCM event pkt */ struct brcmf_event *pvt_data = (struct brcmf_event *) pktdata; +struct brcmf_if_event *ifevent;char *event_data;u32 type, status;u16 flags;
@@ -459,26 +463,22 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,switch (type) {case BRCMF_E_IF : - { -struct brcmf_if_event *ifevent = - (struct brcmf_if_event *) event_data; -brcmf_dbg (TRACE ,"if event\n" ); - -if (ifevent->ifidx >0 && - ifevent->ifidx <BRCMF_MAX_IFS ) { -if (ifevent->action ==BRCMF_E_IF_ADD ) -brcmf_add_if (drvr_priv, ifevent->ifidx, -NULL , event->ifname, - pvt_data->eth.h_dest, - ifevent->flags, - ifevent->bssidx); -else -brcmf_del_if (drvr_priv, ifevent->ifidx); - }else { -brcmf_dbg (ERROR ,"Invalid ifidx %d for %s\n" , - ifevent->ifidx, event->ifname); - } + ifevent = (struct brcmf_if_event *) event_data; +brcmf_dbg (TRACE ,"if event\n" ); + +if (ifevent->ifidx >0 && ifevent->ifidx <BRCMF_MAX_IFS ) { +if (ifevent->action ==BRCMF_E_IF_ADD ) +brcmf_add_if (drvr_priv, ifevent->ifidx,NULL , + event->ifname, + pvt_data->eth.h_dest, + ifevent->flags, ifevent->bssidx); +else +brcmf_del_if (drvr_priv, ifevent->ifidx); + }else { +brcmf_dbg (ERROR ,"Invalid ifidx %d for %s\n" , + ifevent->ifidx, event->ifname); } +/* send up the if event: btamp user needs it */ *ifidx =brcmf_ifname2idx (drvr_priv, event->ifname);break ;
Signature · 1 line
1.7.1
PATCH v2 7/19 staging: brcm80211: remove event handler thread from fullmac
In reply to Franky LinUse work queue to defer cfg80211 event handle jobs
--- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 85 +++++----------------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 3 +- 2 files changed, 21 insertions(+), 67 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +20 -65
@@ -3248,69 +3248,30 @@ static void brcmf_put_event(struct brcmf_cfg80211_event_q *e)kfree (e); } -static s32 brcmf_event_handler (void *data) +static void brcmf_cfg80211_event_handler (struct work_struct *work) {struct brcmf_cfg80211_priv *cfg_priv = - (struct brcmf_cfg80211_priv *)data; -struct sched_param param = {.sched_priority =MAX_RT_PRIO -1 }; + container_of(work, struct brcmf_cfg80211_priv, + event_work);struct brcmf_cfg80211_event_q *e; -DECLARE_WAITQUEUE (wait, current); -sched_setscheduler (current,SCHED_FIFO , ¶m); -allow_signal (SIGTERM ); -add_wait_queue (&cfg_priv->event_waitq, &wait); -while (1 ) { -prepare_to_wait (&cfg_priv->event_waitq, &wait, -TASK_INTERRUPTIBLE ); - -schedule (); - -if (kthread_should_stop ()) -break ; - - e =brcmf_deq_event (cfg_priv); -if (unlikely (!e)) { -WL_ERR ("event queue empty...\n" ); -continue ; - } - -do { -WL_INFO ("event type (%d)\n" , e->etype); -if (cfg_priv->el.handler[e->etype]) - cfg_priv->el.handler[e->etype](cfg_priv, -cfg_to_ndev (cfg_priv), - &e->emsg, e->edata); -else -WL_INFO ("Unknown Event (%d): ignoring\n" , - e->etype); -brcmf_put_event (e); - }while ((e =brcmf_deq_event (cfg_priv))); + e =brcmf_deq_event (cfg_priv); +if (unlikely (!e)) { +WL_ERR ("event queue empty...\n" ); +return ; } -finish_wait (&cfg_priv->event_waitq, &wait); -WL_INFO ("was terminated\n" ); -return 0 ; -} -static s32 brcmf_create_event_handler (struct brcmf_cfg80211_priv *cfg_priv) -{ -init_waitqueue_head (&cfg_priv->event_waitq); - cfg_priv->event_tsk =kthread_run (brcmf_event_handler, cfg_priv, -"wl_event_handler" ); -if (IS_ERR (cfg_priv->event_tsk)) { - cfg_priv->event_tsk =NULL ; -WL_ERR ("failed to create event thread\n" ); -return -ENOMEM ; - } -return 0 ; -} +do { +WL_INFO ("event type (%d)\n" , e->etype); +if (cfg_priv->el.handler[e->etype]) + cfg_priv->el.handler[e->etype](cfg_priv, +cfg_to_ndev (cfg_priv), + &e->emsg, e->edata); +else +WL_INFO ("Unknown Event (%d): ignoring\n" , e->etype); +brcmf_put_event (e); + }while ((e =brcmf_deq_event (cfg_priv))); -static void brcmf_destroy_event_handler (struct brcmf_cfg80211_priv *cfg_priv) -{ -if (cfg_priv->event_tsk) { -send_sig (SIGTERM , cfg_priv->event_tsk,1 ); -kthread_stop (cfg_priv->event_tsk); - cfg_priv->event_tsk =NULL ; - } }static void brcmf_init_eq (struct brcmf_cfg80211_priv *cfg_priv)
@@ -3352,8 +3313,7 @@ static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv) err =brcmf_init_priv_mem (cfg_priv);if (unlikely (err))return err; -if (unlikely (brcmf_create_event_handler (cfg_priv))) -return -ENOMEM ; +INIT_WORK (&cfg_priv->event_work, brcmf_cfg80211_event_handler);brcmf_init_eloop_handler (&cfg_priv->el);mutex_init (&cfg_priv->usr_sync); err =brcmf_init_iscan (cfg_priv);
@@ -3368,7 +3328,7 @@ static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv)static void wl_deinit_priv (struct brcmf_cfg80211_priv *cfg_priv) { -brcmf_destroy_event_handler (cfg_priv); +cancel_work_sync (&cfg_priv->event_work); cfg_priv->dongle_up = false;/* dongle down */ brcmf_flush_eq (cfg_priv);brcmf_link_down (cfg_priv);
@@ -3438,11 +3398,6 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg_dev)kfree (cfg_dev); } -static void brcmf_wakeup_event (struct brcmf_cfg80211_priv *cfg_priv) -{ -wake_up (&cfg_priv->event_waitq); -} -void brcmf_cfg80211_event (struct net_device *ndev,const struct brcmf_event_msg *e,void *data)
@@ -3451,7 +3406,7 @@ brcmf_cfg80211_event(struct net_device *ndev,struct brcmf_cfg80211_priv *cfg_priv =ndev_to_cfg (ndev);if (likely (!brcmf_enq_event (cfg_priv, event_type, e))) -brcmf_wakeup_event (cfg_priv); +schedule_work (&cfg_priv->event_work); }static s32 brcmf_dongle_mode (struct net_device *ndev,s32 iftype)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +1 -2
@@ -298,8 +298,7 @@ struct brcmf_cfg80211_priv {struct brcmf_cfg80211_iscan_ctrl *iscan;/* iscan controller */ struct brcmf_cfg80211_connect_info conn_info;/* association info */ struct brcmf_cfg80211_pmk_list *pmk_list;/* wpa2 pmk list */ -struct task_struct *event_tsk;/* task of main event handler thread */ -wait_queue_head_t event_waitq;/* wait queue for main event handling */ +struct work_struct event_work;/* event handler work struct */ unsigned long status;/* current dongle status */ void *pub;u32 channel;/* current channel */
Signature · 1 line
1.7.1
PATCH v2 10/19 staging: brcm80211: remove fullmac module_param for watchdog
In reply to Franky LinUse constant to replace global variable used for watchdog polling
--- drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 2 +- drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 6 ++-- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 45 +++++++++--------------- 3 files changed, 21 insertions(+), 32 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh.c +1 -1
@@ -375,7 +375,7 @@ void brcmf_sdio_unregister(void)void brcmf_sdio_wdtmr_enable (struct brcmf_sdio_dev *sdiodev,bool enable) {if (enable) -brcmf_sdbrcm_wd_timer (sdiodev->bus, brcmf_watchdog_ms); +brcmf_sdbrcm_wd_timer (sdiodev->bus,BRCMF_WD_POLL_MS );else brcmf_sdbrcm_wd_timer (sdiodev->bus,0 ); }
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +3 -3
@@ -20,6 +20,9 @@/* Packet alignment for most efficient SDIO (can change based on platform) */ #define BRCMF_SDALIGN (1 << 6) +/* watchdog polling interval in ms */ +#define BRCMF_WD_POLL_MS 10 +/* * Exported from brcmf bus module (brcmf_usb, brcmf_sdio) */
@@ -28,9 +31,6 @@extern uint brcmf_txbound;extern uint brcmf_rxbound; -/* Watchdog timer interval */ -extern uint brcmf_watchdog_ms; -/* Indicate (dis)interest in finding dongles. */ extern int brcmf_bus_register (void );extern void brcmf_bus_unregister (void );
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +17 -28
129 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 18/19 staging: brcm80211: consistent naming of struct net_device *ndev
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Code cleanup. Various names (ndev, net, dev) were used for the same structure. Settled for 'ndev'.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 6 +- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 214 +++++++++++---------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 219 +++++++++++----------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 2 +- 4 files changed, 225 insertions(+), 216 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +3 -3
@@ -722,9 +722,9 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void)extern struct brcmf_pub *brcmf_attach (struct brcmf_bus *bus,uint bus_hdrlen);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 *ndev); -extern int brcmf_netdev_ioctl_priv (struct net_device *net, +extern int brcmf_netdev_ioctl_priv (struct net_device *ndev,struct brcmf_ioctl *ioc);/* Indication from bus module regarding removal/absence of dongle */
@@ -766,7 +766,7 @@ extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx,extern void brcmf_c_init (void );extern int brcmf_add_if (struct brcmf_info *drvr_priv,int ifidx, -struct net_device *net,char *name,u8 *mac_addr, +struct net_device *ndev,char *name,u8 *mac_addr,u32 flags,u8 bssidx);extern void brcmf_del_if (struct brcmf_info *drvr_priv,int ifidx);
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +111 -103
561 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +110 -109
772 lines not on this page · raw message
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +1 -1
@@ -243,7 +243,7 @@ struct brcmf_cfg80211_iscan_eloop {/* dongle iscan controller */ struct brcmf_cfg80211_iscan_ctrl { -struct net_device *dev; +struct net_device *ndev;struct timer_list timer;u32 timer_ms;u32 timer_on;
Signature · 1 line
1.7.1
PATCH v2 19/19 staging: brcm80211: simplified internal ioctl function once more
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Code cleanup. Merged two functions.
--- drivers/staging/brcm80211/brcmfmac/dhd.h | 3 +- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 40 ++++++++++++--------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 16 --------- 3 files changed, 24 insertions(+), 35 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd.h +1 -2
@@ -724,8 +724,7 @@ extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,extern int brcmf_net_attach (struct brcmf_pub *drvr,int idx);extern int brcmf_netdev_wait_pend8021x (struct net_device *ndev); -extern int brcmf_netdev_ioctl_priv (struct net_device *ndev, -struct brcmf_ioctl *ioc); +extern s32 brcmf_dev_ioctl (struct net_device *dev,u32 cmd,void *arg,u32 len);/* Indication from bus module regarding removal/absence of dongle */ extern void brcmf_detach (struct brcmf_pub *drvr);
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +23 -17
@@ -849,30 +849,36 @@ static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr,return -EOPNOTSUPP ; } -/* called only from within this driver */ -int brcmf_netdev_ioctl_priv (struct net_device *ndev,struct brcmf_ioctl *ioc) +/* called only from within this driver. Sends an ioctl to the dongle. */ +s32 brcmf_dev_ioctl (struct net_device *ndev,u32 cmd,void *arg,u32 len) { -int bcmerror =0 ; +struct brcmf_ioctl ioc; +s32 err =0 ;int buflen =0 ;bool is_set_key_cmd;struct brcmf_info *drvr_priv = *(struct brcmf_info **) -netdev_priv (ndev); +netdev_priv (ndev);int ifidx; +memset (&ioc,0 ,sizeof (ioc)); + ioc.cmd = cmd; + ioc.buf = arg; + ioc.len = len; + ifidx =brcmf_net2idx (drvr_priv, ndev); -if (ioc->buf !=NULL ) - buflen =min_t (uint, ioc->len,BRCMF_IOCTL_MAXLEN ); +if (ioc.buf !=NULL ) + buflen =min_t (uint, ioc.len,BRCMF_IOCTL_MAXLEN );/* send to dongle (must be up, and wl) */ if ((drvr_priv->pub.busstate !=BRCMF_BUS_DATA )) {brcmf_dbg (ERROR ,"DONGLE_DOWN\n" ); - bcmerror = -EIO ; + err = -EIO ; goto done; }if (!drvr_priv->pub.iswl) { - bcmerror = -EIO ; + err = -EIO ; goto done; }
@@ -880,21 +886,21 @@ int brcmf_netdev_ioctl_priv(struct net_device *ndev, struct brcmf_ioctl *ioc)* Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and * set key IOCTL to prevent M4 encryption. */ - is_set_key_cmd = ((ioc->cmd ==BRCMF_C_SET_KEY ) || - ((ioc->cmd ==BRCMF_C_SET_VAR ) && - !(strncmp ("wsec_key" , ioc->buf,9 ))) || - ((ioc->cmd ==BRCMF_C_SET_VAR ) && - !(strncmp ("bsscfg:wsec_key" , ioc->buf,15 )))); + is_set_key_cmd = ((ioc.cmd ==BRCMF_C_SET_KEY ) || + ((ioc.cmd ==BRCMF_C_SET_VAR ) && + !(strncmp ("wsec_key" , ioc.buf,9 ))) || + ((ioc.cmd ==BRCMF_C_SET_VAR ) && + !(strncmp ("bsscfg:wsec_key" , ioc.buf,15 ))));if (is_set_key_cmd)brcmf_netdev_wait_pend8021x (ndev); - bcmerror =brcmf_proto_ioctl (&drvr_priv->pub, ifidx, ioc, buflen); + err =brcmf_proto_ioctl (&drvr_priv->pub, ifidx, &ioc, buflen); done: -if (bcmerror >0 ) - bcmerror =0 ; +if (err >0 ) + err =0 ; -return bcmerror; +return err; }static int brcmf_netdev_stop (struct net_device *ndev)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +0 -16
@@ -249,22 +249,6 @@ static const u32 __wl_cipher_suites[] = { WLAN_CIPHER_SUITE_AES_CMAC, }; -static s32 -brcmf_dev_ioctl (struct net_device *dev,u32 cmd,void *arg,u32 len) -{ -struct brcmf_ioctl ioc; -s32 err =0 ; - -memset (&ioc,0 ,sizeof (ioc)); - ioc.cmd = cmd; - ioc.buf = arg; - ioc.len = len; - - err =brcmf_netdev_ioctl_priv (dev, &ioc); - -return err; -} -/* function for reading/writing a single u32 from/to the dongle */ static int brcmf_dev_ioctl_u32 (struct net_device *ndev,u32 cmd,u32 *par)
Signature · 1 line
1.7.1
PATCH v2 2/19 staging: brcm80211: various fulmac sparse endianness fixes
In reply to Franky LinFrom: Roland Vossen <[email protected]>
--- drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 6 +++- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 23 +++++++++++--------- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 19 ++++++++++------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 12 +++++----- 4 files changed, 34 insertions(+), 26 deletions(-)
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c +4 -2
@@ -401,7 +401,9 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)/* read 24 bits and return valid 17 bit addr */ int i;u32 scratch, regdata; -u8 *ptr = (u8 *)&scratch; +__le32 scratch_le; +u8 *ptr = (u8 *)&scratch_le; +for (i =0 ; i <3 ; i++) {if ((brcmf_sdioh_card_regread (sdiodev,0 , regaddr,1 , ®data)) !=SUCCESS )
@@ -412,7 +414,7 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr) }/* Only the lower 17-bits are valid */ - scratch =le32_to_cpu (scratch); + scratch =le32_to_cpu (scratch_le); scratch &=0x0001FFFF ;return scratch; }
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +13 -10
@@ -138,6 +138,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work)struct net_device *dev;struct netdev_hw_addr *ha;u32 allmulti, cnt; +__le32 cnt_le; +__le32 allmulti_le;struct brcmf_ioctl ioc;char *buf, *bufp;
@@ -166,9 +168,9 @@ static void _brcmf_set_multicast_list(struct work_struct *work)strcpy (bufp,"mcast_list" ); bufp +=strlen ("mcast_list" ) +1 ; - cnt =cpu_to_le32 (cnt); -memcpy (bufp, &cnt,sizeof (cnt)); - bufp +=sizeof (cnt); + cnt_le =cpu_to_le32 (cnt); +memcpy (bufp, &cnt_le,sizeof (cnt)); + bufp +=sizeof (cnt_le);netdev_for_each_mc_addr (ha, dev) {if (!cnt)
@@ -205,10 +207,11 @@ static void _brcmf_set_multicast_list(struct work_struct *work) brcmf_ifname(&drvr_priv->pub, 0));return ; } - allmulti =cpu_to_le32 (allmulti); + allmulti_le =cpu_to_le32 (allmulti);if (!brcmu_mkiovar - ("allmulti" , (void *)&allmulti,sizeof (allmulti), buf, buflen)) { + ("allmulti" , (void *)&allmulti_le, +sizeof (allmulti_le), buf, buflen)) {brcmf_dbg (ERROR ,"%s: mkiovar failed for allmulti, datalen %d buflen %u\n" ,brcmf_ifname (&drvr_priv->pub,0 ), (int )sizeof (allmulti), buflen);
@@ -226,7 +229,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)if (ret <0 ) {brcmf_dbg (ERROR ,"%s: set allmulti %d failed\n" ,brcmf_ifname (&drvr_priv->pub,0 ), -le32_to_cpu (allmulti)); +le32_to_cpu (allmulti_le)); }kfree (buf);
@@ -235,19 +238,19 @@ static void _brcmf_set_multicast_list(struct work_struct *work)driver does */ allmulti = (dev->flags &IFF_PROMISC ) ? true : false; - allmulti =cpu_to_le32 (allmulti); + allmulti_le =cpu_to_le32 (allmulti);memset (&ioc,0 ,sizeof (ioc)); ioc.cmd =BRCMF_C_SET_PROMISC ; - ioc.buf = &allmulti; - ioc.len =sizeof (allmulti); + ioc.buf = &allmulti_le; + ioc.len =sizeof (allmulti_le); ioc.set = true; ret =brcmf_proto_ioctl (&drvr_priv->pub,0 , &ioc, ioc.len);if (ret <0 ) {brcmf_dbg (ERROR ,"%s: set promisc %d failed\n" ,brcmf_ifname (&drvr_priv->pub,0 ), -le32_to_cpu (allmulti)); +le32_to_cpu (allmulti_le)); } }
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +11 -8
@@ -2361,8 +2361,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ len = (u16) (pkt->len); - *(u16 *) frame =cpu_to_le16 (len); - *(((u16 *) frame) +1 ) =cpu_to_le16 (~len); + *(__le16 *) frame =cpu_to_le16 (len); + *(((__le16 *) frame) +1 ) =cpu_to_le16 (~len);/* Software tag: channel, sequence number, data offset */ swheader =
@@ -2917,16 +2917,17 @@ static int brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh) { u32 addr; +__le32 addr_le;int rv;/* Read last word in memory to determine address of sdpcm_shared structure */ - rv =brcmf_sdbrcm_membytes (bus, false, bus->ramsize -4 , (u8 *)&addr, + rv =brcmf_sdbrcm_membytes (bus, false, bus->ramsize -4 , (u8 *)&addr_le,4 );if (rv <0 )return rv; - addr =le32_to_cpu (addr); + addr =le32_to_cpu (addr_le);brcmf_dbg (INFO ,"sdpcm_shared address 0x%08X\n" , addr);
@@ -3273,8 +3274,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)brcmf_sdbrcm_clkctl (bus,CLK_AVAIL , false);/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ - *(u16 *) frame =cpu_to_le16 ((u16 ) msglen); - *(((u16 *) frame) +1 ) =cpu_to_le16 (~msglen); + *(__le16 *) frame =cpu_to_le16 ((u16 ) msglen); + *(((__le16 *) frame) +1 ) =cpu_to_le16 (~msglen);/* Software tag: channel, sequence number, data offset */ swheader =
@@ -3466,6 +3467,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)u32 varaddr;u8 *vbuffer;u32 varsizew; +__le32 varsizew_le;#ifdef BCMDBG char *nvram_ularray;#endif /* BCMDBG */
@@ -3529,10 +3531,11 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)*/ if (bcmerror) { varsizew =0 ; + varsizew_le =cpu_to_le32 (0 ); }else { varsizew = varsize /4 ; varsizew = (~varsizew <<16 ) | (varsizew &0x0000FFFF ); - varsizew =cpu_to_le32 (varsizew); + varsizew_le =cpu_to_le32 (varsizew); } brcmf_dbg(INFO, "New varsize is %d, length token=0x%08x\n",
@@ -3540,7 +3543,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)/* Write the length token to the last word */ bcmerror =brcmf_sdbrcm_membytes (bus, true, (bus->orig_ramsize -4 ), - (u8 *)&varsizew,4 ); + (u8 *)&varsizew_le,4 );return bcmerror; }
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +6 -6
@@ -378,7 +378,7 @@ brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) {union {s8 buf[BRCMF_C_IOCTL_SMLEN ]; -s32 val; +__le32 val; } var;u32 len;u32 data_null;
@@ -890,11 +890,11 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,/* Configure Beacon Interval for starter */ if (params->beacon_interval) - bcnprd =cpu_to_le32 (params->beacon_interval); + bcnprd = params->beacon_interval;else - bcnprd =cpu_to_le32 (100 ); + bcnprd =100 ; - err =brcmf_dev_ioctl (dev,BRCM_SET_BCNPRD , &bcnprd,sizeof (bcnprd)); + err =brcmf_dev_ioctl_u32 (dev,BRCM_SET_BCNPRD , &bcnprd);if (unlikely (err)) {WL_ERR ("WLC_SET_BCNPRD failed (%d)\n" , err); goto done;
@@ -2029,7 +2029,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv, goto CleanUp; } - *(u32 *)buf =cpu_to_le32 (WL_BSS_INFO_MAX ); + *(__le32 *)buf =cpu_to_le32 (WL_BSS_INFO_MAX ); err =brcmf_dev_ioctl (dev,BRCMF_C_GET_BSS_INFO , buf,WL_BSS_INFO_MAX );if (unlikely (err)) {
@@ -2098,7 +2098,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv) ssid = (struct brcmf_ssid *)brcmf_read_prof (cfg_priv,WL_PROF_SSID ); - *(u32 *)cfg_priv->extra_buf =cpu_to_le32 (WL_EXTRA_BUF_MAX ); + *(__le32 *)cfg_priv->extra_buf =cpu_to_le32 (WL_EXTRA_BUF_MAX ); err =brcmf_dev_ioctl (cfg_to_ndev (cfg_priv),BRCMF_C_GET_BSS_INFO , cfg_priv->extra_buf,WL_EXTRA_BUF_MAX );if (unlikely (err)) {
Signature · 1 line
1.7.1
PATCH v2 8/19 staging: brcm80211: remove fullmac module_param brcmf_dongle_memsize
In reply to Franky Linremove unused module parameter brcmf_dongle_memsize and related code
--- drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 3 -- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 35 +++--------------------- 2 files changed, 5 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +0 -3
@@ -24,9 +24,6 @@* Exported from brcmf bus module (brcmf_usb, brcmf_sdio) */ -/* dongle ram module parameter */ -extern int brcmf_dongle_memsize; -/* Tx/Rx bounds module parameters */ extern uint brcmf_txbound;extern uint brcmf_rxbound;
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +5 -30
@@ -568,7 +568,6 @@ struct brcmf_bus {uint varsz;/* Size of variables buffer */ u32 ramsize;/* Size of RAM in SOCRAM (bytes) */ -u32 orig_ramsize;/* Size of RAM in SOCRAM (bytes) */ u32 hostintmask;/* Copy of Host Interrupt Mask */ u32 intstatus;/* Intstatus bits (events) pending */
@@ -772,11 +771,6 @@ module_param(brcmf_poll, uint, 0);uint brcmf_intr = true;module_param (brcmf_intr, uint,0 ); -/* override the RAM size if possible */ -#define DONGLE_MIN_MEMSIZE (128 * 1024) -int brcmf_dongle_memsize; -module_param (brcmf_dongle_memsize, int,0 ); -#define RETRYCHAN (chan) ((chan) == SDPCM_EVENT_CHANNEL)/* Retry count for register access failures */
@@ -857,17 +851,6 @@ static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt)brcmu_pkt_buf_free_skb (pkt); } -static void brcmf_sdbrcm_setmemsize (struct brcmf_bus *bus,int mem_size) -{ -s32 min_size =DONGLE_MIN_MEMSIZE ; -/* Restrict the memsize to user specified limit */ -brcmf_dbg (ERROR ,"user: Restrict the dongle ram size to %d, min %d\n" , - brcmf_dongle_memsize, min_size); -if ((brcmf_dongle_memsize > min_size) && - (brcmf_dongle_memsize < (s32 ) bus->orig_ramsize)) - bus->ramsize = brcmf_dongle_memsize; -} -static void brcmf_sdbrcm_sdlock (struct brcmf_bus *bus) {if (bus->threads_only)
@@ -3531,11 +3514,10 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus) }/* adjust to the user specified RAM */ -brcmf_dbg (INFO ,"Physical memory size: %d, usable memory size: %d\n" , - bus->orig_ramsize, bus->ramsize); +brcmf_dbg (INFO ,"Physical memory size: %d\n" , bus->ramsize);brcmf_dbg (INFO ,"Vars are at %d, orig varsize is %d\n" , varaddr, varsize); - varsize = ((bus->orig_ramsize -4 ) - varaddr); + varsize = ((bus->ramsize -4 ) - varaddr);/* * Determine the length token:
@@ -3555,7 +3537,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus) varsize, varsizew);/* Write the length token to the last word */ - bcmerror =brcmf_sdbrcm_membytes (bus, true, (bus->orig_ramsize -4 ), + bcmerror =brcmf_sdbrcm_membytes (bus, true, (bus->ramsize -4 ), (u8 *)&varsizew_le,4 );return bcmerror;
@@ -4630,17 +4612,11 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)/* Get info on the ARM and SOCRAM cores... */ brcmf_sdcard_reg_read (bus->sdiodev,CORE_SB (bus->ci->armcorebase, sbidhigh),4 ); - bus->orig_ramsize = bus->ci->ramsize; -if (!(bus->orig_ramsize)) { + bus->ramsize = bus->ci->ramsize; +if (!(bus->ramsize)) {brcmf_dbg (ERROR ,"failed to find SOCRAM memory!\n" ); goto fail; } - bus->ramsize = bus->orig_ramsize; -if (brcmf_dongle_memsize) -brcmf_sdbrcm_setmemsize (bus, brcmf_dongle_memsize); - -brcmf_dbg (ERROR ,"DHD: dongle ram size is set to %d(orig %d)\n" , - bus->ramsize, bus->orig_ramsize);/* Set core control so an SDIO reset does a backplane reset */ reg_addr = bus->ci->buscorebase +
@@ -4819,7 +4795,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,*/ brcmf_txbound =BRCMF_TXBOUND ; brcmf_rxbound =BRCMF_RXBOUND ; - brcmf_dongle_memsize =0 ; brcmf_txminmax =BRCMF_TXMINMAX ;brcmf_c_init ();
Signature · 1 line
1.7.1
PATCH v2 12/19 staging: brcm80211: remove global variables for data frame boundary
In reply to Franky LinPut boundary settings in brcmf_bus structure
--- drivers/staging/brcm80211/brcmfmac/dhd_bus.h | 4 ---- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 24 ++++++++++-------------- 2 files changed, 10 insertions(+), 18 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_bus.h +0 -4
@@ -27,10 +27,6 @@* Exported from brcmf bus module (brcmf_usb, brcmf_sdio) */ -/* Tx/Rx bounds module parameters */ -extern uint brcmf_txbound; -extern uint brcmf_rxbound; -/* Indicate (dis)interest in finding dongles. */ extern int brcmf_bus_register (void );extern void brcmf_bus_unregister (void );
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +10 -14
@@ -588,6 +588,10 @@ struct brcmf_bus {u8 rx_seq;/* Receive sequence number (expected) */ bool rxskip;/* Skip receive (awaiting NAK ACK) */ +uint rxbound;/* Rx frames to read before resched */ +uint txbound;/* Tx frames to send before resched */ +uint txminmax; +struct sk_buff *glomd;/* Packet containing glomming descriptor */ struct sk_buff *glom;/* Packet chain for glommed superframe */ uint glomerr;/* Glom packet read errors */
@@ -740,13 +744,6 @@ module_param(brcmf_watchdog_prio, int, 0);int brcmf_dpc_prio =98 ;module_param (brcmf_dpc_prio, int,0 ); -/* Tx/Rx bounds */ -uint brcmf_txbound; -uint brcmf_rxbound; -module_param (brcmf_txbound, uint,0 ); -module_param (brcmf_rxbound, uint,0 ); -static uint brcmf_txminmax; -#define SDIO_DRIVE_STRENGTH 6/* in milliamps */ /* Use polling */
@@ -2488,8 +2485,8 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_bus *bus) {u32 intstatus, newstatus =0 ;uint retries =0 ; -uint rxlimit = brcmf_rxbound;/* Rx frames to read before resched */ -uint txlimit = brcmf_txbound;/* Tx frames to send before resched */ +uint rxlimit = bus->rxbound;/* Rx frames to read before resched */ +uint txlimit = bus->txbound;/* Tx frames to send before resched */ uint framecnt =0 ;/* Temporary counter of tx/rx frames */ bool rxdone = true;/* Flag for no more read data */ bool resched = false;/* Flag indicating resched wanted */
@@ -2690,7 +2687,7 @@ clkwait:else if ((bus->clkstate ==CLK_AVAIL ) && !bus->fcstate &&brcmu_pktq_mlen (&bus->txq, ~bus->flowcontrol) && txlimit &&data_ok (bus)) { - framecnt = rxdone ? txlimit :min (txlimit, brcmf_txminmax); + framecnt = rxdone ? txlimit :min (txlimit, bus->txminmax); framecnt =brcmf_sdbrcm_sendfromq (bus, framecnt); txlimit -= framecnt; }
@@ -4779,10 +4776,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,* first time that the driver is initialized vs subsequent * initializations. */ - brcmf_txbound =BRCMF_TXBOUND ; - brcmf_rxbound =BRCMF_RXBOUND ; - brcmf_txminmax =BRCMF_TXMINMAX ; -brcmf_c_init ();brcmf_dbg (TRACE ,"Enter\n" );
@@ -4798,6 +4791,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, } bus->sdiodev = sdiodev; sdiodev->bus = bus; + bus->txbound =BRCMF_TXBOUND ; + bus->rxbound =BRCMF_RXBOUND ; + bus->txminmax =BRCMF_TXMINMAX ; bus->tx_seq =SDPCM_SEQUENCE_WRAP -1 ; bus->usebufpool = false;/* Use bufpool if allocated, else use locally malloced rxbuf */
Signature · 1 line
1.7.1
PATCH v2 13/19 staging: brcm80211: removed two fullmac sparse spinlock warnings
In reply to Franky LinFrom: Roland Vossen <[email protected]>
By deleting three redundant functions. The spinlock was related to event queue operation. Event queue data members were also renamed to make their function more clear.
--- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 49 ++++++++-------------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 6 +- 2 files changed, 20 insertions(+), 35 deletions(-)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +17 -32
@@ -3181,21 +3181,6 @@ init_priv_mem_out:return -ENOMEM ; } -static void brcmf_lock_eq (struct brcmf_cfg80211_priv *cfg_priv) -{ -spin_lock_irq (&cfg_priv->eq_lock); -} - -static void brcmf_unlock_eq (struct brcmf_cfg80211_priv *cfg_priv) -{ -spin_unlock_irq (&cfg_priv->eq_lock); -} - -static void brcmf_init_eq_lock (struct brcmf_cfg80211_priv *cfg_priv) -{ -spin_lock_init (&cfg_priv->eq_lock); -} -/* * retrieve first queued event from head */
@@ -3205,13 +3190,13 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event( {struct brcmf_cfg80211_event_q *e =NULL ; -brcmf_lock_eq (cfg_priv); -if (likely (!list_empty (&cfg_priv->eq_list))) { - e =list_first_entry (&cfg_priv->eq_list, - struct brcmf_cfg80211_event_q, eq_list); -list_del (&e->eq_list); +spin_lock_irq (&cfg_priv->evt_q_lock); +if (likely (!list_empty (&cfg_priv->evt_q_list))) { + e =list_first_entry (&cfg_priv->evt_q_list, + struct brcmf_cfg80211_event_q, evt_q_list); +list_del (&e->evt_q_list); } -brcmf_unlock_eq (cfg_priv); +spin_unlock_irq (&cfg_priv->evt_q_lock);return e; }
@@ -3236,9 +3221,9 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event, e->etype = event;memcpy (&e->emsg, msg,sizeof (struct brcmf_event_msg )); -brcmf_lock_eq (cfg_priv); -list_add_tail (&e->eq_list, &cfg_priv->eq_list); -brcmf_unlock_eq (cfg_priv); +spin_lock_irq (&cfg_priv->evt_q_lock); +list_add_tail (&e->evt_q_list, &cfg_priv->evt_q_list); +spin_unlock_irq (&cfg_priv->evt_q_lock);return err; }
@@ -3276,22 +3261,22 @@ static void brcmf_cfg80211_event_handler(struct work_struct *work)static void brcmf_init_eq (struct brcmf_cfg80211_priv *cfg_priv) { -brcmf_init_eq_lock (cfg_priv); -INIT_LIST_HEAD (&cfg_priv->eq_list); +spin_lock_init (&cfg_priv->evt_q_lock); +INIT_LIST_HEAD (&cfg_priv->evt_q_list); }static void brcmf_flush_eq (struct brcmf_cfg80211_priv *cfg_priv) {struct brcmf_cfg80211_event_q *e; -brcmf_lock_eq (cfg_priv); -while (!list_empty (&cfg_priv->eq_list)) { - e =list_first_entry (&cfg_priv->eq_list, - struct brcmf_cfg80211_event_q, eq_list); -list_del (&e->eq_list); +spin_lock_irq (&cfg_priv->evt_q_lock); +while (!list_empty (&cfg_priv->evt_q_list)) { + e =list_first_entry (&cfg_priv->evt_q_list, + struct brcmf_cfg80211_event_q, evt_q_list); +list_del (&e->evt_q_list);kfree (e); } -brcmf_unlock_eq (cfg_priv); +spin_unlock_irq (&cfg_priv->evt_q_lock); }static s32 wl_init_priv (struct brcmf_cfg80211_priv *cfg_priv)
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +3 -3
@@ -199,7 +199,7 @@ struct brcmf_cfg80211_ie {/* event queue for cfg80211 main event */ struct brcmf_cfg80211_event_q { -struct list_head eq_list; +struct list_head evt_q_list;u32 etype;struct brcmf_event_msg emsg;s8 edata[1 ];
@@ -282,8 +282,8 @@ struct brcmf_cfg80211_priv {struct cfg80211_scan_request *scan_request;/* scan request object */ struct brcmf_cfg80211_event_loop el;/* main event loop */ -struct list_head eq_list;/* used for event queue */ -spinlock_t eq_lock;/* for event queue synchronization */ +struct list_head evt_q_list;/* used for event queue */ +spinlock_t evt_q_lock;/* for event queue synchronization */ struct mutex usr_sync;/* maily for dongle up/down synchronization */ struct brcmf_scan_results *bss_list;/* bss_list holding scanned ap information */
Signature · 1 line
1.7.1
PATCH v2 16/19 staging: brcm80211: removed log after kzalloc()/kmalloc() failure
In reply to Franky LinFrom: Roland Vossen <[email protected]>
kzalloc/kmalloc already reports an allocation failure themselves.
--- drivers/staging/brcm80211/brcmfmac/dhd_cdc.c | 4 +- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 13 ++---- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 19 ++------ drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 26 ++--------- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 50 ++++++---------------- drivers/staging/brcm80211/brcmsmac/ampdu.c | 6 +-- drivers/staging/brcm80211/brcmsmac/antsel.c | 5 +-- drivers/staging/brcm80211/brcmsmac/channel.c | 5 +-- drivers/staging/brcm80211/brcmsmac/dma.c | 16 +------ drivers/staging/brcm80211/brcmsmac/mac80211_if.c | 11 +---- drivers/staging/brcm80211/brcmsmac/nicpci.c | 3 +- drivers/staging/brcm80211/brcmsmac/phy_shim.c | 7 +-- 12 files changed, 41 insertions(+), 124 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c +1 -3
@@ -417,10 +417,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)struct brcmf_proto *cdc; cdc =kzalloc (sizeof (struct brcmf_proto ),GFP_ATOMIC ); -if (!cdc) { -brcmf_dbg (ERROR ,"kmalloc failed\n" ); +if (!cdc) goto fail; - }/* ensure that the msg buf directly follows the cdc msg struct */ if ((unsigned long )(&cdc->msg +1 ) != (unsigned long )cdc->buf) {
drivers/staging/brcm80211/brcmfmac/dhd_common.c +4 -9
@@ -562,10 +562,9 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,struct brcmf_pkt_filter_enable *pkt_filterp; arg_save =kmalloc (strlen (arg) +1 ,GFP_ATOMIC ); -if (!arg_save) { -brcmf_dbg (ERROR ,"kmalloc failed\n" ); +if (!arg_save) goto fail; - } + arg_org = arg_save;memcpy (arg_save, arg,strlen (arg) +1 );
@@ -635,18 +634,14 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)char *arg_save =NULL , *arg_org =NULL ; arg_save =kstrdup (arg,GFP_ATOMIC ); -if (!arg_save) { -brcmf_dbg (ERROR ,"kmalloc failed\n" ); +if (!arg_save) goto fail; - } arg_org = arg_save; buf =kmalloc (PKTFILTER_BUF_SIZE ,GFP_ATOMIC ); -if (!buf) { -brcmf_dbg (ERROR ,"kmalloc failed\n" ); +if (!buf) goto fail; - } argv[i] =strsep (&arg_save," " );while (argv[i++])
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +5 -14
@@ -159,11 +159,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work) buflen =sizeof ("mcast_list" ) +sizeof (cnt) + (cnt *ETH_ALEN ); bufp = buf =kmalloc (buflen,GFP_ATOMIC ); -if (!bufp) { -brcmf_dbg (ERROR ,"%s: out of memory for mcast_list, cnt %d\n" , -brcmf_ifname (&drvr_priv->pub,0 ), cnt); +if (!bufp)return ; - }strcpy (bufp,"mcast_list" ); bufp +=strlen ("mcast_list" ) +1 ;
@@ -202,11 +199,9 @@ static void _brcmf_set_multicast_list(struct work_struct *work) buflen =sizeof ("allmulti" ) +sizeof (allmulti); buf =kmalloc (buflen,GFP_ATOMIC ); -if (!buf) { -brcmf_dbg (ERROR ,"%s: out of memory for allmulti\n" , -brcmf_ifname (&drvr_priv->pub,0 )); +if (!buf)return ; - } + allmulti_le =cpu_to_le32 (allmulti); if (!brcmu_mkiovar
@@ -963,10 +958,8 @@ brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, struct net_device *net, ifp = drvr_priv->iflist[ifidx];if (!ifp) { ifp =kmalloc (sizeof (struct brcmf_if ),GFP_ATOMIC ); -if (!ifp) { -brcmf_dbg (ERROR ,"OOM - struct brcmf_if\n" ); +if (!ifp)return -ENOMEM ; - } }memset (ifp,0 ,sizeof (struct brcmf_if ));
@@ -1019,10 +1012,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen)/* Allocate primary brcmf_info */ drvr_priv =kzalloc (sizeof (struct brcmf_info ),GFP_ATOMIC ); -if (!drvr_priv) { -brcmf_dbg (ERROR ,"OOM - alloc brcmf_info\n" ); +if (!drvr_priv) goto fail; - }/* * Save the brcmf_info into the priv
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +5 -21
@@ -2956,10 +2956,8 @@ static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus)/* Get full mem size */ size = bus->ramsize; buf =kmalloc (size,GFP_ATOMIC ); -if (!buf) { -brcmf_dbg (ERROR ,"Out of memory (%d bytes)\n" , size); +if (!buf)return -1 ; - }/* Read mem content */ printk (KERN_DEBUG "Dump dongle memory" );
@@ -3013,7 +3011,6 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size) size = msize; mbuffer = data =kmalloc (msize,GFP_ATOMIC );if (mbuffer ==NULL ) { -brcmf_dbg (ERROR ,"kmalloc(%d) failed\n" , msize); bcmerror = -ENOMEM ; goto done; }
@@ -3021,7 +3018,6 @@ static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size) str =kmalloc (maxstrlen,GFP_ATOMIC );if (str ==NULL ) { -brcmf_dbg (ERROR ,"kmalloc(%d) failed\n" , maxstrlen); bcmerror = -ENOMEM ; goto done; }
@@ -3737,8 +3733,6 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus) memptr = memblock =kmalloc (MEMBLOCK +BRCMF_SDALIGN ,GFP_ATOMIC );if (memblock ==NULL ) { -brcmf_dbg (ERROR ,"Failed to allocate memory %d bytes\n" , -MEMBLOCK ); ret = -ENOMEM ; goto err; }
@@ -3837,8 +3831,6 @@ static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus) memblock =kmalloc (MEMBLOCK ,GFP_ATOMIC );if (memblock ==NULL ) { -brcmf_dbg (ERROR ,"Failed to allocate memory %d bytes\n" , -MEMBLOCK ); ret = -ENOMEM ; goto err; }
@@ -4254,18 +4246,13 @@ static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus)roundup ((bus->drvr->maxctl +SDPCM_HDRLEN ),ALIGNMENT ) +BRCMF_SDALIGN ; bus->rxbuf =kmalloc (bus->rxblen,GFP_ATOMIC ); -if (!(bus->rxbuf)) { -brcmf_dbg (ERROR ,"kmalloc of %d-byte rxbuf failed\n" , - bus->rxblen); +if (!(bus->rxbuf)) goto fail; - } }/* Allocate buffer to receive glomed packet */ bus->databuf =kmalloc (MAX_DATA_BUF ,GFP_ATOMIC );if (!(bus->databuf)) { -brcmf_dbg (ERROR ,"kmalloc of %d-byte databuf failed\n" , -MAX_DATA_BUF );/* release rxbuf which was already located as above */ if (!bus->rxblen)kfree (bus->rxbuf);
@@ -4457,10 +4444,8 @@ brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs)/* alloc chip_info_t */ ci =kzalloc (sizeof (struct chip_info ),GFP_ATOMIC ); -if (NULL == ci) { -brcmf_dbg (ERROR ,"malloc failed!\n" ); +if (NULL == ci)return -ENOMEM ; - }/* bus/core/clk setup for register access */ /* Try forcing SDIO core to do ALPAvail request only */
@@ -4785,10 +4770,9 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,/* Allocate private bus interface state */ bus =kzalloc (sizeof (struct brcmf_bus ),GFP_ATOMIC ); -if (!bus) { -brcmf_dbg (ERROR ,"kmalloc of struct dhd_bus failed\n" ); +if (!bus) goto fail; - } + bus->sdiodev = sdiodev; sdiodev->bus = bus; bus->txbound =BRCMF_TXBOUND ;
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +13 -37
101 lines not on this page · raw message
drivers/staging/brcm80211/brcmsmac/ampdu.c +2 -4
@@ -227,11 +227,9 @@ struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc)int i; ampdu =kzalloc (sizeof (struct ampdu_info ),GFP_ATOMIC ); -if (!ampdu) { -wiphy_err (wlc->wiphy,"wl%d: brcms_c_ampdu_attach: out of mem" -"\n" , wlc->pub->unit); +if (!ampdu)return NULL ; - } + ampdu->wlc = wlc;for (i =0 ; i <AMPDU_MAX_SCB_TID ; i++)
drivers/staging/brcm80211/brcmsmac/antsel.c +1 -4
@@ -110,11 +110,8 @@ struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc)struct antsel_info *asi; asi =kzalloc (sizeof (struct antsel_info ),GFP_ATOMIC ); -if (!asi) { -wiphy_err (wlc->wiphy,"wl%d: brcms_c_antsel_attach: out of " -"mem\n" , wlc->pub->unit); +if (!asi)return NULL ; - } asi->wlc = wlc; asi->pub = wlc->pub;
drivers/staging/brcm80211/brcmsmac/channel.c +1 -4
@@ -1090,11 +1090,8 @@ struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc)BCMMSG (wlc->wiphy,"wl%d\n" , wlc->pub->unit); wlc_cm =kzalloc (sizeof (struct brcms_cm_info ),GFP_ATOMIC ); -if (wlc_cm ==NULL ) { -wiphy_err (wlc->wiphy,"wl%d: %s: out of memory" , pub->unit, - __func__); +if (wlc_cm ==NULL )return NULL ; - } wlc_cm->pub = pub; wlc_cm->wlc = wlc; wlc->cmi = wlc_cm;
drivers/staging/brcm80211/brcmsmac/dma.c +3 -13
@@ -559,12 +559,8 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,/* allocate private info structure */ di =kzalloc (sizeof (struct dma_info ),GFP_ATOMIC ); -if (di ==NULL ) { -#ifdef BCMDBG -printk (KERN_ERR "dma_attach: out of memory\n" ); -#endif +if (di ==NULL )return NULL ; - } di->msg_level = msg_level ? msg_level : &dma_msg_level;
@@ -651,22 +647,16 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,if (ntxd) { size = ntxd *sizeof (void *); di->txp =kzalloc (size,GFP_ATOMIC ); -if (di->txp ==NULL ) { -DMA_ERROR (("%s: dma_attach: out of tx memory\n" , - di->name)); +if (di->txp ==NULL ) goto fail; - } }/* allocate rx packet pointer vector */ if (nrxd) { size = nrxd *sizeof (void *); di->rxp =kzalloc (size,GFP_ATOMIC ); -if (di->rxp ==NULL ) { -DMA_ERROR (("%s: dma_attach: out of rx memory\n" , - di->name)); +if (di->rxp ==NULL ) goto fail; - } }/*
drivers/staging/brcm80211/brcmsmac/mac80211_if.c +3 -8
@@ -1541,11 +1541,8 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,struct brcms_timer *t; t =kzalloc (sizeof (struct brcms_timer ),GFP_ATOMIC ); -if (!t) { -wiphy_err (wl->wiphy,"wl%d: brcms_init_timer: out of memory\n" , - wl->pub->unit); +if (!t)return NULL ; - }init_timer (&t->timer); t->timer.data = (unsigned long ) t;
@@ -1659,11 +1656,9 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx) pdata = wl->fw.fw_bin[i]->data +le32_to_cpu (hdr->offset); *pbuf =kmalloc (len,GFP_ATOMIC ); -if (*pbuf ==NULL ) { -wiphy_err (wl->wiphy,"fail to alloc %d" -" bytes\n" , len); +if (*pbuf ==NULL ) goto fail; - } +memcpy (*pbuf, pdata, len);return 0 ; }
drivers/staging/brcm80211/brcmsmac/nicpci.c +1 -2
@@ -245,9 +245,8 @@ struct pcicore_info *pcicore_init(struct si_pub *sih, struct pci_dev *pdev,/* alloc struct pcicore_info */ pi =kzalloc (sizeof (struct pcicore_info ),GFP_ATOMIC ); -if (pi ==NULL ) { +if (pi ==NULL )return NULL ; - } pi->sih = sih; pi->dev = pdev;
drivers/staging/brcm80211/brcmsmac/phy_shim.c +2 -5
@@ -41,12 +41,9 @@ struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw,struct phy_shim_info *physhim =NULL ; physhim =kzalloc (sizeof (struct phy_shim_info ),GFP_ATOMIC ); -if (!physhim) { -wiphy_err (wlc_hw->wlc->wiphy, -"wl%d: wlc_phy_shim_attach: out of mem\n" , - wlc_hw->unit); +if (!physhim)return NULL ; - } + physhim->wlc_hw = wlc_hw; physhim->wlc = wlc; physhim->wl = wl;
Signature · 1 line
1.7.1
PATCH v2 4/19 staging: brcm80211: sparse endianness warnings for struct sdpcm_shared
In reply to Franky LinFrom: Roland Vossen <[email protected]>
Structure that is received from dongle has been annotated.
--- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 31 +++++++++++++++++------- 1 files changed, 22 insertions(+), 9 deletions(-)
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c +22 -9
@@ -530,6 +530,17 @@ struct sdpcm_shared {u8 tag[32 ]; }; +struct sdpcm_shared_le { +__le32 flags; +__le32 trap_addr; +__le32 assert_exp_addr; +__le32 assert_file_addr; +__le32 assert_line; +__le32 console_addr;/* Address of struct rte_console */ +__le32 msgtrace_addr; +u8 tag[32 ]; +}; +/* misc chip info needed by some of the routines */ struct chip_info {
@@ -2919,6 +2930,7 @@ brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)u32 addr;__le32 addr_le;int rv; +struct sdpcm_shared_le sh_le;/* Read last word in memory to determine address of sdpcm_shared structure */
@@ -2942,19 +2954,20 @@ brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh) }/* Read rte_shared structure */ - rv =brcmf_sdbrcm_membytes (bus, false, addr, (u8 *) sh, -sizeof (struct sdpcm_shared )); + rv =brcmf_sdbrcm_membytes (bus, false, addr, (u8 *) &sh_le, +sizeof (struct sdpcm_shared_le ));if (rv <0 )return rv;/* Endianness */ - sh->flags =le32_to_cpu (sh->flags); - sh->trap_addr =le32_to_cpu (sh->trap_addr); - sh->assert_exp_addr =le32_to_cpu (sh->assert_exp_addr); - sh->assert_file_addr =le32_to_cpu (sh->assert_file_addr); - sh->assert_line =le32_to_cpu (sh->assert_line); - sh->console_addr =le32_to_cpu (sh->console_addr); - sh->msgtrace_addr =le32_to_cpu (sh->msgtrace_addr); + sh->flags =le32_to_cpu (sh_le.flags); + sh->trap_addr =le32_to_cpu (sh_le.trap_addr); + sh->assert_exp_addr =le32_to_cpu (sh_le.assert_exp_addr); + sh->assert_file_addr =le32_to_cpu (sh_le.assert_file_addr); + sh->assert_line =le32_to_cpu (sh_le.assert_line); + sh->console_addr =le32_to_cpu (sh_le.console_addr); + sh->msgtrace_addr =le32_to_cpu (sh_le.msgtrace_addr); +memcpy (sh->tag, sh_le.tag,sizeof (sh->tag));if ((sh->flags &SDPCM_SHARED_VERSION_MASK ) !=SDPCM_SHARED_VERSION ) { brcmf_dbg(ERROR, "sdpcm_shared version %d in brcmf is different than sdpcm_shared version %d in dongle\n",
Signature · 1 line
1.7.1