All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx
@ 2022-07-01  9:24 Felix Schlepper
  2022-07-01  9:24 ` [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes Felix Schlepper
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

This series addresses some issues raised by chechpatch.pl
and some very minor refactoring.

v2:
    - The first version, only addressed coding style issues.
      Now, I additionally refactored rtllib_modes and its uses, since
      there is no need to use string formatting.
    - Logically separated one assignement into two. So we dont have
      'fixed' = 'disabled', which was silly.

v3:
    - Fixed a checkpatch.pl warning, which was introduced with patch 1/6.

Felix Schlepper (6):
  Staging: rtl8192e: Refactored rtllib_modes
  Staging: rtl8192e: Avoid multiple assignments
  Staging: rtl8192e: Remove unnecessary parentheses
  Staging: rtl8192e: Added braces around else
  Staging: rtl8192e: Remove unnecessary blank line
  Staging: rtl8192e: Added spaces around '+'

 drivers/staging/rtl8192e/rtllib_wx.c | 37 +++++++++++-----------------
 1 file changed, 15 insertions(+), 22 deletions(-)

-- 
2.36.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
@ 2022-07-01  9:24 ` Felix Schlepper
  2022-07-02  6:07   ` Philipp Hortmann
  2022-07-01  9:24 ` [PATCH v3 2/6] Staging: rtl8192e: Avoid multiple assignments Felix Schlepper
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

The initial reason for looking at this code was an
issue raised by checkpatch.pl:

     $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
     CHECK: Please use a blank line after function/struct/union/enum
     declarations

The additional blank line above the struct/before the headers is
just cleaner.

However, as it turns out since there is no str formatting required
One can replace the error prone str + size struct with a char array.
The rest of this patch fixes the usecases.

Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
 drivers/staging/rtl8192e/rtllib_wx.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index cf9a240924f2..b7f19b38b0e1 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -17,17 +17,9 @@
 #include <linux/module.h>
 #include <linux/etherdevice.h>
 #include "rtllib.h"
-struct modes_unit {
-	char *mode_string;
-	int mode_size;
-};
-static struct modes_unit rtllib_modes[] = {
-	{"a", 1},
-	{"b", 1},
-	{"g", 1},
-	{"?", 1},
-	{"N-24G", 5},
-	{"N-5G", 4},
+
+static const char * const rtllib_modes[] = {
+	"a", "b", "g", "?", "N-24G", "N-5G"
 };
 
 #define MAX_CUSTOM_LEN 64
@@ -72,10 +64,9 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
 	/* Add the protocol name */
 	iwe.cmd = SIOCGIWNAME;
 	for (i = 0; i < ARRAY_SIZE(rtllib_modes); i++) {
-		if (network->mode&(1<<i)) {
-			sprintf(pname, rtllib_modes[i].mode_string,
-				rtllib_modes[i].mode_size);
-			pname += rtllib_modes[i].mode_size;
+		if (network->mode & BIT(i)) {
+			strcpy(pname, rtllib_modes[i]);
+			pname += strlen(rtllib_modes[i]);
 		}
 	}
 	*pname = '\0';
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/6] Staging: rtl8192e: Avoid multiple assignments
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
  2022-07-01  9:24 ` [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes Felix Schlepper
@ 2022-07-01  9:24 ` Felix Schlepper
  2022-07-02  6:08   ` Philipp Hortmann
  2022-07-01  9:24 ` [PATCH v3 3/6] Staging: rtl8192e: Remove unnecessary parentheses Felix Schlepper
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

This addresses an issue raised by checkpatch.pl:

     $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
     CHECK: multiple assignments should be avoided

Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
 drivers/staging/rtl8192e/rtllib_wx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index b7f19b38b0e1..121bf939c6a4 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -149,7 +149,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
 			max_rate = rate;
 	}
 	iwe.cmd = SIOCGIWRATE;
-	iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+	iwe.u.bitrate.disabled = 0;
+	iwe.u.bitrate.fixed = 0;
 	iwe.u.bitrate.value = max_rate * 500000;
 	start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_PARAM_LEN);
 	iwe.cmd = IWEVCUSTOM;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 3/6] Staging: rtl8192e: Remove unnecessary parentheses
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
  2022-07-01  9:24 ` [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes Felix Schlepper
  2022-07-01  9:24 ` [PATCH v3 2/6] Staging: rtl8192e: Avoid multiple assignments Felix Schlepper
@ 2022-07-01  9:24 ` Felix Schlepper
  2022-07-02  6:09   ` Philipp Hortmann
  2022-07-01  9:24 ` [PATCH v3 4/6] Staging: rtl8192e: Added braces around else Felix Schlepper
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

This addresses an issue raised by checkpatch.pl:

     $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
     Unnecessary parentheses around wrqu->encoding

Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
 drivers/staging/rtl8192e/rtllib_wx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index 121bf939c6a4..db076e819993 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -277,7 +277,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 			 struct iw_request_info *info,
 			 union iwreq_data *wrqu, char *keybuf)
 {
-	struct iw_point *erq = &(wrqu->encoding);
+	struct iw_point *erq = &wrqu->encoding;
 	struct net_device *dev = ieee->dev;
 	struct rtllib_security sec = {
 		.flags = 0
@@ -449,7 +449,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
 			 struct iw_request_info *info,
 			 union iwreq_data *wrqu, char *keybuf)
 {
-	struct iw_point *erq = &(wrqu->encoding);
+	struct iw_point *erq = &wrqu->encoding;
 	int len, key;
 	struct lib80211_crypt_data *crypt;
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 4/6] Staging: rtl8192e: Added braces around else
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
                   ` (2 preceding siblings ...)
  2022-07-01  9:24 ` [PATCH v3 3/6] Staging: rtl8192e: Remove unnecessary parentheses Felix Schlepper
@ 2022-07-01  9:24 ` Felix Schlepper
  2022-07-02  6:10   ` Philipp Hortmann
  2022-07-01  9:24 ` [PATCH v3 5/6] Staging: rtl8192e: Remove unnecessary blank line Felix Schlepper
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

This addresses two issues raised by checkpatch.pl:

     $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
     CHECK: braces {} should be used on all arms of this statement
     CHECK: Unbalanced braces around else statement

The coding style rule with not using unnecessary braces around if/else
does not apply if only one branch is a single statement.

Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
 drivers/staging/rtl8192e/rtllib_wx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index db076e819993..b949e7234150 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -304,8 +304,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
 			netdev_dbg(ieee->dev,
 				   "Disabling encryption on key %d.\n", key);
 			lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
-		} else
+		} else {
 			netdev_dbg(ieee->dev, "Disabling encryption.\n");
+		}
 
 		/* Check all the keys to see if any are still configured,
 		 * and if no key index was provided, de-init them all
@@ -724,8 +725,9 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee,
 		} else if (data->value & IW_AUTH_ALG_LEAP) {
 			ieee->open_wep = 1;
 			ieee->auth_mode = 2;
-		} else
+		} else {
 			return -EINVAL;
+		}
 		break;
 
 	case IW_AUTH_WPA_ENABLED:
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 5/6] Staging: rtl8192e: Remove unnecessary blank line
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
                   ` (3 preceding siblings ...)
  2022-07-01  9:24 ` [PATCH v3 4/6] Staging: rtl8192e: Added braces around else Felix Schlepper
@ 2022-07-01  9:24 ` Felix Schlepper
  2022-07-02  6:11   ` Philipp Hortmann
  2022-07-01  9:24 ` [PATCH v3 6/6] Staging: rtl8192e: Added spaces around '+' Felix Schlepper
  2022-07-02  6:17 ` [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Philipp Hortmann
  6 siblings, 1 reply; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

This addresses an issue raised by checkpatch.pl:

     $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
     CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
 drivers/staging/rtl8192e/rtllib_wx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index b949e7234150..6b11908032d7 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -601,7 +601,6 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
 			goto done;
 		}
 		*crypt = new_crypt;
-
 	}
 
 	if (ext->key_len > 0 && (*crypt)->ops->set_key &&
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 6/6] Staging: rtl8192e: Added spaces around '+'
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
                   ` (4 preceding siblings ...)
  2022-07-01  9:24 ` [PATCH v3 5/6] Staging: rtl8192e: Remove unnecessary blank line Felix Schlepper
@ 2022-07-01  9:24 ` Felix Schlepper
  2022-07-02  6:11   ` Philipp Hortmann
  2022-07-02  6:17 ` [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Philipp Hortmann
  6 siblings, 1 reply; 14+ messages in thread
From: Felix Schlepper @ 2022-07-01  9:24 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, wjsota, Felix Schlepper

This addresses two issues raised by checkpatch.pl:

     $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
     CHECK: spaces preferred around that '+' (ctx:VxV)

Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
---
 drivers/staging/rtl8192e/rtllib_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index 6b11908032d7..da2c41c9b92f 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -769,7 +769,7 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
 	kfree(ieee->wps_ie);
 	ieee->wps_ie = NULL;
 	if (len) {
-		if (len != ie[1]+2)
+		if (len != ie[1] + 2)
 			return -EINVAL;
 		buf = kmemdup(ie, len, GFP_KERNEL);
 		if (!buf)
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes
  2022-07-01  9:24 ` [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes Felix Schlepper
@ 2022-07-02  6:07   ` Philipp Hortmann
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:07 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> The initial reason for looking at this code was an
> issue raised by checkpatch.pl:
> 
>       $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
>       CHECK: Please use a blank line after function/struct/union/enum
>       declarations
> 
> The additional blank line above the struct/before the headers is
> just cleaner.
> 
> However, as it turns out since there is no str formatting required
> One can replace the error prone str + size struct with a char array.
> The rest of this patch fixes the usecases.
> 
> Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
> ---
>   drivers/staging/rtl8192e/rtllib_wx.c | 21 ++++++---------------
>   1 file changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index cf9a240924f2..b7f19b38b0e1 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -17,17 +17,9 @@
>   #include <linux/module.h>
>   #include <linux/etherdevice.h>
>   #include "rtllib.h"
> -struct modes_unit {
> -	char *mode_string;
> -	int mode_size;
> -};
> -static struct modes_unit rtllib_modes[] = {
> -	{"a", 1},
> -	{"b", 1},
> -	{"g", 1},
> -	{"?", 1},
> -	{"N-24G", 5},
> -	{"N-5G", 4},
> +
> +static const char * const rtllib_modes[] = {
> +	"a", "b", "g", "?", "N-24G", "N-5G"
>   };
>   
>   #define MAX_CUSTOM_LEN 64
> @@ -72,10 +64,9 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
>   	/* Add the protocol name */
>   	iwe.cmd = SIOCGIWNAME;
>   	for (i = 0; i < ARRAY_SIZE(rtllib_modes); i++) {
> -		if (network->mode&(1<<i)) {
> -			sprintf(pname, rtllib_modes[i].mode_string,
> -				rtllib_modes[i].mode_size);
> -			pname += rtllib_modes[i].mode_size;
> +		if (network->mode & BIT(i)) {
> +			strcpy(pname, rtllib_modes[i]);
> +			pname += strlen(rtllib_modes[i]);
>   		}
>   	}
>   	*pname = '\0';

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 2/6] Staging: rtl8192e: Avoid multiple assignments
  2022-07-01  9:24 ` [PATCH v3 2/6] Staging: rtl8192e: Avoid multiple assignments Felix Schlepper
@ 2022-07-02  6:08   ` Philipp Hortmann
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:08 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> This addresses an issue raised by checkpatch.pl:
> 
>       $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
>       CHECK: multiple assignments should be avoided
> 
> Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
> ---
>   drivers/staging/rtl8192e/rtllib_wx.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index b7f19b38b0e1..121bf939c6a4 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -149,7 +149,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
>   			max_rate = rate;
>   	}
>   	iwe.cmd = SIOCGIWRATE;
> -	iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
> +	iwe.u.bitrate.disabled = 0;
> +	iwe.u.bitrate.fixed = 0;
>   	iwe.u.bitrate.value = max_rate * 500000;
>   	start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_PARAM_LEN);
>   	iwe.cmd = IWEVCUSTOM;


Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 3/6] Staging: rtl8192e: Remove unnecessary parentheses
  2022-07-01  9:24 ` [PATCH v3 3/6] Staging: rtl8192e: Remove unnecessary parentheses Felix Schlepper
@ 2022-07-02  6:09   ` Philipp Hortmann
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:09 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> This addresses an issue raised by checkpatch.pl:
> 
>       $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
>       Unnecessary parentheses around wrqu->encoding
> 
> Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
> ---
>   drivers/staging/rtl8192e/rtllib_wx.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index 121bf939c6a4..db076e819993 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -277,7 +277,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
>   			 struct iw_request_info *info,
>   			 union iwreq_data *wrqu, char *keybuf)
>   {
> -	struct iw_point *erq = &(wrqu->encoding);
> +	struct iw_point *erq = &wrqu->encoding;
>   	struct net_device *dev = ieee->dev;
>   	struct rtllib_security sec = {
>   		.flags = 0
> @@ -449,7 +449,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
>   			 struct iw_request_info *info,
>   			 union iwreq_data *wrqu, char *keybuf)
>   {
> -	struct iw_point *erq = &(wrqu->encoding);
> +	struct iw_point *erq = &wrqu->encoding;
>   	int len, key;
>   	struct lib80211_crypt_data *crypt;
>   

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 4/6] Staging: rtl8192e: Added braces around else
  2022-07-01  9:24 ` [PATCH v3 4/6] Staging: rtl8192e: Added braces around else Felix Schlepper
@ 2022-07-02  6:10   ` Philipp Hortmann
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:10 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> This addresses two issues raised by checkpatch.pl:
> 
>       $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
>       CHECK: braces {} should be used on all arms of this statement
>       CHECK: Unbalanced braces around else statement
> 
> The coding style rule with not using unnecessary braces around if/else
> does not apply if only one branch is a single statement.
> 
> Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
> ---
>   drivers/staging/rtl8192e/rtllib_wx.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index db076e819993..b949e7234150 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -304,8 +304,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
>   			netdev_dbg(ieee->dev,
>   				   "Disabling encryption on key %d.\n", key);
>   			lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt);
> -		} else
> +		} else {
>   			netdev_dbg(ieee->dev, "Disabling encryption.\n");
> +		}
>   
>   		/* Check all the keys to see if any are still configured,
>   		 * and if no key index was provided, de-init them all
> @@ -724,8 +725,9 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee,
>   		} else if (data->value & IW_AUTH_ALG_LEAP) {
>   			ieee->open_wep = 1;
>   			ieee->auth_mode = 2;
> -		} else
> +		} else {
>   			return -EINVAL;
> +		}
>   		break;
>   
>   	case IW_AUTH_WPA_ENABLED:

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 5/6] Staging: rtl8192e: Remove unnecessary blank line
  2022-07-01  9:24 ` [PATCH v3 5/6] Staging: rtl8192e: Remove unnecessary blank line Felix Schlepper
@ 2022-07-02  6:11   ` Philipp Hortmann
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:11 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> This addresses an issue raised by checkpatch.pl:
> 
>       $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
>       CHECK: Blank lines aren't necessary before a close brace '}'
> 
> Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
> ---
>   drivers/staging/rtl8192e/rtllib_wx.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index b949e7234150..6b11908032d7 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -601,7 +601,6 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
>   			goto done;
>   		}
>   		*crypt = new_crypt;
> -
>   	}
>   
>   	if (ext->key_len > 0 && (*crypt)->ops->set_key &&

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 6/6] Staging: rtl8192e: Added spaces around '+'
  2022-07-01  9:24 ` [PATCH v3 6/6] Staging: rtl8192e: Added spaces around '+' Felix Schlepper
@ 2022-07-02  6:11   ` Philipp Hortmann
  0 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:11 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> This addresses two issues raised by checkpatch.pl:
> 
>       $ ./scripts/checkpatch.pl --terse -f drivers/staging/rtl8192e/rtllib_wx.c
>       CHECK: spaces preferred around that '+' (ctx:VxV)
> 
> Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
> ---
>   drivers/staging/rtl8192e/rtllib_wx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
> index 6b11908032d7..da2c41c9b92f 100644
> --- a/drivers/staging/rtl8192e/rtllib_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_wx.c
> @@ -769,7 +769,7 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
>   	kfree(ieee->wps_ie);
>   	ieee->wps_ie = NULL;
>   	if (len) {
> -		if (len != ie[1]+2)
> +		if (len != ie[1] + 2)
>   			return -EINVAL;
>   		buf = kmemdup(ie, len, GFP_KERNEL);
>   		if (!buf)


Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx
  2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
                   ` (5 preceding siblings ...)
  2022-07-01  9:24 ` [PATCH v3 6/6] Staging: rtl8192e: Added spaces around '+' Felix Schlepper
@ 2022-07-02  6:17 ` Philipp Hortmann
  6 siblings, 0 replies; 14+ messages in thread
From: Philipp Hortmann @ 2022-07-02  6:17 UTC (permalink / raw)
  To: Felix Schlepper, gregkh; +Cc: linux-staging, linux-kernel, wjsota

On 7/1/22 11:24, Felix Schlepper wrote:
> This series addresses some issues raised by chechpatch.pl
> and some very minor refactoring.
> 
> v2:
>      - The first version, only addressed coding style issues.
>        Now, I additionally refactored rtllib_modes and its uses, since
>        there is no need to use string formatting.
>      - Logically separated one assignement into two. So we dont have
>        'fixed' = 'disabled', which was silly.
> 
> v3:
>      - Fixed a checkpatch.pl warning, which was introduced with patch 1/6.
> 
> Felix Schlepper (6):
>    Staging: rtl8192e: Refactored rtllib_modes
>    Staging: rtl8192e: Avoid multiple assignments
>    Staging: rtl8192e: Remove unnecessary parentheses
>    Staging: rtl8192e: Added braces around else
>    Staging: rtl8192e: Remove unnecessary blank line
>    Staging: rtl8192e: Added spaces around '+'
> 
>   drivers/staging/rtl8192e/rtllib_wx.c | 37 +++++++++++-----------------
>   1 file changed, 15 insertions(+), 22 deletions(-)
> 

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

Sorry for sending one email for each patch. Next time I will just send 
one mail for one patch series.


When compiling I saw that the driver is divided into more modules. So 
the r8192e_pci.ko is not touched by this patch series.

kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ make -C . 
M=drivers/staging/rtl8192e
make: Entering directory '/home/kernel/Documents/git/kernels/staging'
   CC [M]  drivers/staging/rtl8192e/rtllib_wx.o
   LD [M]  drivers/staging/rtl8192e/rtllib.o
   MODPOST drivers/staging/rtl8192e/Module.symvers
   CC [M]  drivers/staging/rtl8192e/rtllib.mod.o
   LD [M]  drivers/staging/rtl8192e/rtllib.ko
make: Leaving directory '/home/kernel/Documents/git/kernels/staging'

kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ sudo insmod 
drivers/staging/rtl8192e/rtllib.ko
kernel@matrix-ESPRIMO-P710:~/Documents/git/kernels/staging$ sudo insmod 
drivers/staging/rtl8192e/rtl8192e/r8192e_pci.ko

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-07-02  6:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01  9:24 [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Felix Schlepper
2022-07-01  9:24 ` [PATCH v3 1/6] Staging: rtl8192e: Refactored rtllib_modes Felix Schlepper
2022-07-02  6:07   ` Philipp Hortmann
2022-07-01  9:24 ` [PATCH v3 2/6] Staging: rtl8192e: Avoid multiple assignments Felix Schlepper
2022-07-02  6:08   ` Philipp Hortmann
2022-07-01  9:24 ` [PATCH v3 3/6] Staging: rtl8192e: Remove unnecessary parentheses Felix Schlepper
2022-07-02  6:09   ` Philipp Hortmann
2022-07-01  9:24 ` [PATCH v3 4/6] Staging: rtl8192e: Added braces around else Felix Schlepper
2022-07-02  6:10   ` Philipp Hortmann
2022-07-01  9:24 ` [PATCH v3 5/6] Staging: rtl8192e: Remove unnecessary blank line Felix Schlepper
2022-07-02  6:11   ` Philipp Hortmann
2022-07-01  9:24 ` [PATCH v3 6/6] Staging: rtl8192e: Added spaces around '+' Felix Schlepper
2022-07-02  6:11   ` Philipp Hortmann
2022-07-02  6:17 ` [PATCH v3 0/6] Staging: rtl8192e: rtllib_wx Philipp Hortmann

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.