Commit 6fc1fbc0 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: remove unconditional code blocks from brcmfmac

Using a block statement to scope function variables is not
common in linux kernel development. Browsed through the brcmfmac
to remove those.
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d6a66afc
...@@ -198,6 +198,11 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) ...@@ -198,6 +198,11 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"} BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
}; };
uint event_type, flags, auth_type, datalen; 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); event_type = be32_to_cpu(event->event_type);
flags = be16_to_cpu(event->flags); flags = be16_to_cpu(event->flags);
status = be32_to_cpu(event->status); status = be32_to_cpu(event->status);
...@@ -348,19 +353,14 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) ...@@ -348,19 +353,14 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
break; break;
case BRCMF_E_TRACE: case BRCMF_E_TRACE:
{
static u32 seqnum_prev;
struct msgtrace_hdr hdr;
u32 nblost;
char *s, *p;
buf = (unsigned char *) event_data; buf = (unsigned char *) event_data;
memcpy(&hdr, buf, sizeof(struct msgtrace_hdr)); memcpy(&hdr, buf, sizeof(struct msgtrace_hdr));
if (hdr.version != MSGTRACE_VERSION) { if (hdr.version != MSGTRACE_VERSION) {
brcmf_dbg(ERROR, "MACEVENT: %s [unsupported version --> brcmf version:%d dongle version:%d]\n", brcmf_dbg(ERROR,
event_name, "MACEVENT: %s [unsupported version --> brcmf"
MSGTRACE_VERSION, hdr.version); " version:%d dongle version:%d]\n",
event_name, MSGTRACE_VERSION, hdr.version);
/* Reset datalen to avoid display below */ /* Reset datalen to avoid display below */
datalen = 0; datalen = 0;
break; break;
...@@ -372,14 +372,17 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) ...@@ -372,14 +372,17 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
if (be32_to_cpu(hdr.discarded_bytes) if (be32_to_cpu(hdr.discarded_bytes)
|| be32_to_cpu(hdr.discarded_printf)) || be32_to_cpu(hdr.discarded_printf))
brcmf_dbg(ERROR, "WLC_E_TRACE: [Discarded traces in dongle --> discarded_bytes %d discarded_printf %d]\n", 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_bytes),
be32_to_cpu(hdr.discarded_printf)); be32_to_cpu(hdr.discarded_printf));
nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1; nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
if (nblost > 0) if (nblost > 0)
brcmf_dbg(ERROR, "WLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n", brcmf_dbg(ERROR, "WLC_E_TRACE: [Event lost --> seqnum "
be32_to_cpu(hdr.seqnum), nblost); " %d nblost %d\n", be32_to_cpu(hdr.seqnum),
nblost);
seqnum_prev = be32_to_cpu(hdr.seqnum); seqnum_prev = be32_to_cpu(hdr.seqnum);
/* Display the trace buffer. Advance from \n to \n to /* Display the trace buffer. Advance from \n to \n to
...@@ -396,7 +399,6 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) ...@@ -396,7 +399,6 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
/* Reset datalen to avoid display below */ /* Reset datalen to avoid display below */
datalen = 0; datalen = 0;
}
break; break;
case BRCMF_E_RSSI: case BRCMF_E_RSSI:
...@@ -405,8 +407,9 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) ...@@ -405,8 +407,9 @@ brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data)
break; break;
default: default:
brcmf_dbg(EVENT, "MACEVENT: %s %d, MAC %s, status %d, reason %d, auth %d\n", brcmf_dbg(EVENT,
event_name, event_type, eabuf, "MACEVENT: %s %d, MAC %s, status %d, reason %d, "
"auth %d\n", event_name, event_type, eabuf,
(int)status, (int)reason, (int)auth_type); (int)status, (int)reason, (int)auth_type);
break; break;
} }
...@@ -428,6 +431,7 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata, ...@@ -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 */ /* check whether packet is a BRCM event pkt */
struct brcmf_event *pvt_data = (struct brcmf_event *) pktdata; struct brcmf_event *pvt_data = (struct brcmf_event *) pktdata;
struct brcmf_if_event *ifevent;
char *event_data; char *event_data;
u32 type, status; u32 type, status;
u16 flags; u16 flags;
...@@ -459,26 +463,22 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata, ...@@ -459,26 +463,22 @@ brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata,
switch (type) { switch (type) {
case BRCMF_E_IF: case BRCMF_E_IF:
{ ifevent = (struct brcmf_if_event *) event_data;
struct brcmf_if_event *ifevent =
(struct brcmf_if_event *) event_data;
brcmf_dbg(TRACE, "if event\n"); brcmf_dbg(TRACE, "if event\n");
if (ifevent->ifidx > 0 && if (ifevent->ifidx > 0 && ifevent->ifidx < BRCMF_MAX_IFS) {
ifevent->ifidx < BRCMF_MAX_IFS) {
if (ifevent->action == BRCMF_E_IF_ADD) if (ifevent->action == BRCMF_E_IF_ADD)
brcmf_add_if(drvr_priv, ifevent->ifidx, brcmf_add_if(drvr_priv, ifevent->ifidx, NULL,
NULL, event->ifname, event->ifname,
pvt_data->eth.h_dest, pvt_data->eth.h_dest,
ifevent->flags, ifevent->flags, ifevent->bssidx);
ifevent->bssidx);
else else
brcmf_del_if(drvr_priv, ifevent->ifidx); brcmf_del_if(drvr_priv, ifevent->ifidx);
} else { } else {
brcmf_dbg(ERROR, "Invalid ifidx %d for %s\n", brcmf_dbg(ERROR, "Invalid ifidx %d for %s\n",
ifevent->ifidx, event->ifname); ifevent->ifidx, event->ifname);
} }
}
/* send up the if event: btamp user needs it */ /* send up the if event: btamp user needs it */
*ifidx = brcmf_ifname2idx(drvr_priv, event->ifname); *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname);
break; break;
......
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