1
0
Fork 0

staging: wlan-ng: replace WLAN_CTL_FRAMELEN with inline function in p80211hdr.h

checkpatch reports a "CHECK" diagnostic for WLAN_CTL_FRAMELEN as the
macro reuses its argument, leading to possible side-effects. Avoid
this by replacing the macro with an equivalent function, named
wlan_ctl_framelen (as recommended in the coding style). All references
to the macro also updated accordingly.

Signed-off-by: Tim Collier <osdevtc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
Tim Collier 2018-06-22 20:39:32 +01:00 committed by Greg Kroah-Hartman
parent a37545e5e5
commit 9e5ffffb68
1 changed files with 20 additions and 10 deletions

View File

@ -174,15 +174,25 @@ union p80211_hdr {
/* Frame and header length macros */
#define WLAN_CTL_FRAMELEN(fstype) (\
(fstype) == WLAN_FSTYPE_BLOCKACKREQ ? 24 : \
(fstype) == WLAN_FSTYPE_BLOCKACK ? 152 : \
(fstype) == WLAN_FSTYPE_PSPOLL ? 20 : \
(fstype) == WLAN_FSTYPE_RTS ? 20 : \
(fstype) == WLAN_FSTYPE_CTS ? 14 : \
(fstype) == WLAN_FSTYPE_ACK ? 14 : \
(fstype) == WLAN_FSTYPE_CFEND ? 20 : \
(fstype) == WLAN_FSTYPE_CFENDCFACK ? 20 : 4)
static inline u16 wlan_ctl_framelen(u16 fstype)
{
switch (fstype) {
case WLAN_FSTYPE_BLOCKACKREQ:
return 24;
case WLAN_FSTYPE_BLOCKACK:
return 152;
case WLAN_FSTYPE_PSPOLL:
case WLAN_FSTYPE_RTS:
case WLAN_FSTYPE_CFEND:
case WLAN_FSTYPE_CFENDCFACK:
return 20;
case WLAN_FSTYPE_CTS:
case WLAN_FSTYPE_ACK:
return 14;
default:
return 4;
}
}
#define WLAN_FCS_LEN 4
@ -201,7 +211,7 @@ static inline u16 p80211_headerlen(u16 fctl)
hdrlen += ETH_ALEN;
break;
case WLAN_FTYPE_CTL:
hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) -
hdrlen = wlan_ctl_framelen(WLAN_GET_FC_FSTYPE(fctl)) -
WLAN_FCS_LEN;
break;
default: