* [PATCH 1/5] staging: rtl8723bs: remove unused code
@ 2018-07-12 10:36 Michael Straube
2018-07-12 10:36 ` [PATCH 2/5] staging: rtl8723bs: refactor rtw_is_cckrates_included() Michael Straube
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Michael Straube @ 2018-07-12 10:36 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Michael Straube
Remove commented rtw_is_cckrates_included() and
rtw_is_cckratesonly_included() from os_dep/ioctl_linux.c.
Both are defined in core/rtw_ieee80211.c.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 32 -------------------
1 file changed, 32 deletions(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index ceb2b10fa0b2..63b79a7eaccf 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -79,38 +79,6 @@ void rtw_indicate_wx_disassoc_event(struct adapter *padapter)
eth_zero_addr(wrqu.ap_addr.sa_data);
}
-/*
-uint rtw_is_cckrates_included(u8 *rate)
-{
- u32 i = 0;
-
- while (rate[i]!= 0)
- {
- if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) ||
- (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22))
- return true;
- i++;
- }
-
- return false;
-}
-
-uint rtw_is_cckratesonly_included(u8 *rate)
-{
- u32 i = 0;
-
- while (rate[i]!= 0)
- {
- if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
- (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22))
- return false;
- i++;
- }
-
- return true;
-}
-*/
-
static char *translate_scan(struct adapter *padapter,
struct iw_request_info* info, struct wlan_network *pnetwork,
char *start, char *stop)
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/5] staging: rtl8723bs: refactor rtw_is_cckrates_included()
2018-07-12 10:36 [PATCH 1/5] staging: rtl8723bs: remove unused code Michael Straube
@ 2018-07-12 10:36 ` Michael Straube
2018-07-12 10:36 ` [PATCH 3/5] staging: rtl8723bs: refactor rtw_is_cckratesonly_included Michael Straube
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Michael Straube @ 2018-07-12 10:36 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Michael Straube
Refactor rtw_is_cckrates_included() to improve readability and
slightly reduce object file size.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 3f1c7bb0eb9f..3adb58759d5f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -68,13 +68,12 @@ int rtw_get_bit_value_from_ieee_value(u8 val)
uint rtw_is_cckrates_included(u8 *rate)
{
- u32 i = 0;
+ while (*rate) {
+ u8 r = *rate & 0x7f;
- while (rate[i] != 0) {
- if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) ||
- (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22))
+ if (r == 2 || r == 4 || r == 11 || r == 22)
return true;
- i++;
+ rate++;
}
return false;
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/5] staging: rtl8723bs: refactor rtw_is_cckratesonly_included
2018-07-12 10:36 [PATCH 1/5] staging: rtl8723bs: remove unused code Michael Straube
2018-07-12 10:36 ` [PATCH 2/5] staging: rtl8723bs: refactor rtw_is_cckrates_included() Michael Straube
@ 2018-07-12 10:36 ` Michael Straube
2018-07-12 10:36 ` [PATCH 4/5] staging: rtl8723bs: change return type to bool Michael Straube
2018-07-12 10:36 ` [PATCH 5/5] staging: rtl8723bs: fix comparsions to true Michael Straube
3 siblings, 0 replies; 5+ messages in thread
From: Michael Straube @ 2018-07-12 10:36 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Michael Straube
Refactor rtw_is_cckratesonly_included() to improve readability and
slightly reduce object file size.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 3adb58759d5f..e4a20a4a5e59 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -81,13 +81,12 @@ uint rtw_is_cckrates_included(u8 *rate)
uint rtw_is_cckratesonly_included(u8 *rate)
{
- u32 i = 0;
+ while (*rate) {
+ u8 r = *rate & 0x7f;
- while (rate[i] != 0) {
- if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) &&
- (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22))
+ if (r != 2 && r != 4 && r != 11 && r != 22)
return false;
- i++;
+ rate++;
}
return true;
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/5] staging: rtl8723bs: change return type to bool
2018-07-12 10:36 [PATCH 1/5] staging: rtl8723bs: remove unused code Michael Straube
2018-07-12 10:36 ` [PATCH 2/5] staging: rtl8723bs: refactor rtw_is_cckrates_included() Michael Straube
2018-07-12 10:36 ` [PATCH 3/5] staging: rtl8723bs: refactor rtw_is_cckratesonly_included Michael Straube
@ 2018-07-12 10:36 ` Michael Straube
2018-07-12 10:36 ` [PATCH 5/5] staging: rtl8723bs: fix comparsions to true Michael Straube
3 siblings, 0 replies; 5+ messages in thread
From: Michael Straube @ 2018-07-12 10:36 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Michael Straube
Both rtw_is_cckrates_included() and rtw_is_cckratesonly_included()
return true or false. Change the return type from uint to bool.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
drivers/staging/rtl8723bs/include/ieee80211.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e4a20a4a5e59..62718045f3cc 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -66,7 +66,7 @@ int rtw_get_bit_value_from_ieee_value(u8 val)
return 0;
}
-uint rtw_is_cckrates_included(u8 *rate)
+bool rtw_is_cckrates_included(u8 *rate)
{
while (*rate) {
u8 r = *rate & 0x7f;
@@ -79,7 +79,7 @@ uint rtw_is_cckrates_included(u8 *rate)
return false;
}
-uint rtw_is_cckratesonly_included(u8 *rate)
+bool rtw_is_cckratesonly_included(u8 *rate)
{
while (*rate) {
u8 r = *rate & 0x7f;
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 974e922f54fa..bcc8dfa8e672 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -1169,9 +1169,9 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv);
int rtw_get_bit_value_from_ieee_value(u8 val);
-uint rtw_is_cckrates_included(u8 *rate);
+bool rtw_is_cckrates_included(u8 *rate);
-uint rtw_is_cckratesonly_included(u8 *rate);
+bool rtw_is_cckratesonly_included(u8 *rate);
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/5] staging: rtl8723bs: fix comparsions to true
2018-07-12 10:36 [PATCH 1/5] staging: rtl8723bs: remove unused code Michael Straube
` (2 preceding siblings ...)
2018-07-12 10:36 ` [PATCH 4/5] staging: rtl8723bs: change return type to bool Michael Straube
@ 2018-07-12 10:36 ` Michael Straube
3 siblings, 0 replies; 5+ messages in thread
From: Michael Straube @ 2018-07-12 10:36 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Michael Straube
Use if(x) instead of if(x == true).
Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
.../staging/rtl8723bs/core/rtw_ieee80211.c | 6 ++--
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 28 +++++++++----------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 62718045f3cc..33f2649ba2ec 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -95,14 +95,14 @@ bool rtw_is_cckratesonly_included(u8 *rate)
int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
{
if (channel > 14) {
- if ((rtw_is_cckrates_included(rate)) == true)
+ if (rtw_is_cckrates_included(rate))
return WIRELESS_INVALID;
else
return WIRELESS_11A;
} else{ /* could be pure B, pure G, or B/G */
- if ((rtw_is_cckratesonly_included(rate)) == true)
+ if (rtw_is_cckratesonly_included(rate))
return WIRELESS_11B;
- else if ((rtw_is_cckrates_included(rate)) == true)
+ else if (rtw_is_cckrates_included(rate))
return WIRELESS_11BG;
else
return WIRELESS_11G;
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 63b79a7eaccf..c38298d960ff 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -126,26 +126,26 @@ static char *translate_scan(struct adapter *padapter,
/* Add the protocol name */
iwe.cmd = SIOCGIWNAME;
- if ((rtw_is_cckratesonly_included((u8 *)&pnetwork->network.SupportedRates)) == true) {
- if (ht_cap == true)
+ if (rtw_is_cckratesonly_included((u8 *)&pnetwork->network.SupportedRates)) {
+ if (ht_cap)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn");
else
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b");
- } else if ((rtw_is_cckrates_included((u8 *)&pnetwork->network.SupportedRates)) == true) {
- if (ht_cap == true)
+ } else if (rtw_is_cckrates_included((u8 *)&pnetwork->network.SupportedRates)) {
+ if (ht_cap)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn");
else
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bg");
} else {
if (pnetwork->network.Configuration.DSConfig > 14) {
- if (vht_cap == true)
+ if (vht_cap)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11AC");
- else if (ht_cap == true)
+ else if (ht_cap)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11an");
else
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11a");
} else {
- if (ht_cap == true)
+ if (ht_cap)
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11gn");
else
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11g");
@@ -785,26 +785,26 @@ static int rtw_wx_get_name(struct net_device *dev,
prates = &pcur_bss->SupportedRates;
- if (rtw_is_cckratesonly_included((u8 *)prates) == true) {
- if (ht_cap == true)
+ if (rtw_is_cckratesonly_included((u8 *)prates)) {
+ if (ht_cap)
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bn");
else
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b");
- } else if ((rtw_is_cckrates_included((u8 *)prates)) == true) {
- if (ht_cap == true)
+ } else if (rtw_is_cckrates_included((u8 *)prates)) {
+ if (ht_cap)
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bgn");
else
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bg");
} else {
if (pcur_bss->Configuration.DSConfig > 14) {
- if (vht_cap == true)
+ if (vht_cap)
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11AC");
- else if (ht_cap == true)
+ else if (ht_cap)
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11an");
else
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11a");
} else {
- if (ht_cap == true)
+ if (ht_cap)
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11gn");
else
snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11g");
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-12 10:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-12 10:36 [PATCH 1/5] staging: rtl8723bs: remove unused code Michael Straube
2018-07-12 10:36 ` [PATCH 2/5] staging: rtl8723bs: refactor rtw_is_cckrates_included() Michael Straube
2018-07-12 10:36 ` [PATCH 3/5] staging: rtl8723bs: refactor rtw_is_cckratesonly_included Michael Straube
2018-07-12 10:36 ` [PATCH 4/5] staging: rtl8723bs: change return type to bool Michael Straube
2018-07-12 10:36 ` [PATCH 5/5] staging: rtl8723bs: fix comparsions to true Michael Straube
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.