2014-10-29 22:42:34

by Behan Webster

[permalink] [raw]
Subject: [PATCH 0/4] staging, rtl8192e, LLVMLinux: Patches to enable the kernel to be compiled with clang/LLVM

Removing a number of warnings generated from compiling stl8192e with clang.

The LLVMLinux project aims to fully build the Linux kernel using both gcc and
clang (the C front end for the LLVM compiler infrastructure project).

Behan Webster (4):
staging, rtl8192e, LLVMLinux: Change extern inline to static inline
staging, rtl8192e, LLVMLinux: Remove unused inline prototype
staging, rtl8192e, LLVMLinux: Remove unused prototype
staging, rtl8192e, LLVMLinux: Make static local in inline function
const

drivers/staging/rtl8192e/rtllib.h | 6 ++----
drivers/staging/rtl8192e/rtllib_softmac.c | 11 ++++++-----
2 files changed, 8 insertions(+), 9 deletions(-)

--
1.9.1


2014-10-29 22:42:42

by Behan Webster

[permalink] [raw]
Subject: [PATCH 1/4] staging, rtl8192e, LLVMLinux: Change extern inline to static inline

With compilers which follow the C99 standard (like modern versions of gcc and
clang), "extern inline" does the opposite thing from older versions of gcc
(emits code for an externally linkable version of the inline function).

"static inline" does the intended behavior in all cases instead.

Signed-off-by: Behan Webster <[email protected]>
Suggested-by: Arnd Bergmann <[email protected]>
Cc: Arnd Bergmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib.h | 4 ++--
drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 2d82f89..33995ac 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -2944,12 +2944,12 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);

extern const long rtllib_wlan_frequencies[];

-extern inline void rtllib_increment_scans(struct rtllib_device *ieee)
+static inline void rtllib_increment_scans(struct rtllib_device *ieee)
{
ieee->scans++;
}

-extern inline int rtllib_get_scans(struct rtllib_device *ieee)
+static inline int rtllib_get_scans(struct rtllib_device *ieee)
{
return ieee->scans;
}
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index abb6729..067a45a 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -343,7 +343,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb,
}
}

-inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee)
+static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee)
{
unsigned int len, rate_len;
u8 *tag;
--
1.9.1

2014-10-29 22:42:45

by Behan Webster

[permalink] [raw]
Subject: [PATCH 2/4] staging, rtl8192e, LLVMLinux: Remove unused inline prototype

rtllib_probe_req is defined as "static inline" in rtllib_softmac.c however it
is declared differently as "extern inline" in rtllib_softmac.h. Since it isn't
used outside of the scope of rtllib_softmac, it makes sense to remove the
incorrect declaration.

Signed-off-by: Behan Webster <[email protected]>
Suggested-by: Arnd Bergmann <[email protected]>
Cc: Arnd Bergmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 33995ac..1322782 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -2762,7 +2762,6 @@ extern void rtllib_stop_scan(struct rtllib_device *ieee);
extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
-extern inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee);
extern u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee);
extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee,
short pwr);
--
1.9.1

2014-10-29 22:42:48

by Behan Webster

[permalink] [raw]
Subject: [PATCH 3/4] staging, rtl8192e, LLVMLinux: Remove unused prototype

MgntQuery_MgntFrameTxRate is only used within rtllib_softmac.c, so it really
should be static instead of extern.

Since it is currently extern a warning is generated because a different
function of the same name is defined staticlly in ieee80211_softmac.c

Removing the incorrect extern declaration and defining the rtllib_softmac
version of this routine static fixes the warning.

Signed-off-by: Behan Webster <[email protected]>
Suggested-by: Arnd Bergmann <[email protected]>
Cc: Arnd Bergmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib.h | 1 -
drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 1322782..cef2dc2 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -2762,7 +2762,6 @@ extern void rtllib_stop_scan(struct rtllib_device *ieee);
extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
-extern u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee);
extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee,
short pwr);
extern void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl);
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 067a45a..089a058 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -193,7 +193,7 @@ MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee)
return QueryRate;
}

-u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee)
+static u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee)
{
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
u8 rate;
--
1.9.1

2014-10-29 22:42:57

by Behan Webster

[permalink] [raw]
Subject: [PATCH 4/4] staging, rtl8192e, LLVMLinux: Make static local in inline function const

rtllib_association_req is a (large) inline function which defines 2 constant
static arrays which aren't labelled as const. As a result clang complains with:

non-constant static local variable in inline function may be different in
different files
[-Wstatic-local-in-inline]
static u8 AironetIeOui[] = {0x00, 0x01, 0x66};
^
The solution is making them "static const".

However doing so requires dropping const when being used with struct
octet_string. However the value is used in a const fashion thereafter, so no
harm done.

Signed-off-by: Behan Webster <[email protected]>
Suggested-by: Arnd Bergmann <[email protected]>
Cc: Arnd Bergmann <[email protected]>
---
drivers/staging/rtl8192e/rtllib_softmac.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 089a058..e970db4 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -1311,7 +1311,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
}

if (beacon->bCkipSupported) {
- static u8 AironetIeOui[] = {0x00, 0x01, 0x66};
+ static const u8 AironetIeOui[] = {0x00, 0x01, 0x66};
u8 CcxAironetBuf[30];
struct octet_string osCcxAironetIE;

@@ -1331,10 +1331,11 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon,
}

if (beacon->bCcxRmEnable) {
- static u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 0x00};
+ static const u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01,
+ 0x00};
struct octet_string osCcxRmCap;

- osCcxRmCap.Octet = CcxRmCapBuf;
+ osCcxRmCap.Octet = (u8 *) CcxRmCapBuf;
osCcxRmCap.Length = sizeof(CcxRmCapBuf);
tag = skb_put(skb, ccxrm_ie_len);
*tag++ = MFIE_TYPE_GENERIC;
--
1.9.1