Skip to contentSkip to conversation

Remove wrapper functions and neat up code

PATCH In review Shivani Bhardwaj 2 participants 8 messages Oct 23, 2015 – Oct 27, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Remove wrapper functions and neat up code

Unnecessary wrapper functions are removed and their calls replaced with the appropriate functions. Also, unnecessary braces are removed.

After applying this patch, code becomes neat.

Shivani Bhardwaj (2):
Staging: wilc1000: coreconfigurator: Remove irrelevant wrapper
function
Staging: wilc1000: coreconfigurator: Remove unnecessary parentheses

 drivers/staging/wilc1000/coreconfigurator.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/2 Staging: wilc1000: coreconfigurator: Remove irrelevant wrapper function

Remove the function get_current_channel() and replace its calls by get_current_channel_802_11n() as the former function's definition involves only returning the value of latter function. Semantic patch used to find out the issue:

@@
identifier f,g;
@@

*f(...) {
return g(...); }

---
 drivers/staging/wilc1000/coreconfigurator.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +6 -9
index 6dfe26d..1403a33 100644
@@ -331,13 +331,6 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 	return 0;  /* no MIB here */
 }
 
-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
-{
-	/* Extract current channel information from */
-	/* the beacon/probe response frame          */
-	return get_current_channel_802_11n(pu8msa, u16RxLen);
-}
-
 /**
  *  @brief                      parses the received 'N' message
  *  @details
@@ -425,8 +418,12 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 		/* Get BSSID */
 		get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
 
-		/* Get the current channel */
-		pstrNetworkInfo->u8channel = get_current_channel(pu8msa, (u16RxLen + FCS_LEN));
+		/* 
+		 * Extract current channel information from
+		 * the beacon/probe response frame          
+		 */
+		pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
+							(u16RxLen + FCS_LEN));
 
 		/* Get beacon period */
 		u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);
Signature · 1 line
2.1.0
#5 lore raw

PATCH 2/2 Staging: wilc1000: coreconfigurator: Remove unnecessary parentheses

In reply to Shivani Bhardwaj

Parentheses around some arguments and expressions are not required and should be removed.

---
 drivers/staging/wilc1000/coreconfigurator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +3 -3
index 1403a33..d002cfb 100644
@@ -423,17 +423,17 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 		 * the beacon/probe response frame          
 		 */
 		pstrNetworkInfo->u8channel = get_current_channel_802_11n(pu8msa,
-							(u16RxLen + FCS_LEN));
+							u16RxLen + FCS_LEN);
 
 		/* Get beacon period */
-		u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);
+		u8index = MAC_HDR_LEN + TIME_STAMP_LEN;
 
 		pstrNetworkInfo->u16BeaconPeriod = get_beacon_period(pu8msa + u8index);
 
 		u8index += BEACON_INTERVAL_LEN + CAP_INFO_LEN;
 
 		/* Get DTIM Period */
-		pu8TimElm = get_tim_elm(pu8msa, (u16RxLen + FCS_LEN), u8index);
+		pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index);
 		if (pu8TimElm != NULL)
 			pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3];
 		pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN];
Signature · 1 line
2.1.0
maintainer
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: coreconfigurator: Remove irrelevant wrapper function

In reply to Shivani Bhardwaj
Quoted 9 lines · Shivani Bhardwaj

Remove the function get_current_channel() and replace its calls by get_current_channel_802_11n() as the former function's definition involves only returning the value of latter function. Semantic patch used to find out the issue:

@@
identifier f,g;
@@

Quoted 7 lines

*f(...) {
return g(...); }

---
 drivers/staging/wilc1000/coreconfigurator.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

This replaces a previous patch you sent, right?

I'm totally confused as to what patches you want applied, please resend all of them for this driver, the latest versions, with proper version information so I have a hint as to what to do...

thanks,

greg k-h

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: coreconfigurator: Remove irrelevant wrapper function

Quoted 20 lines · Greg KH
Quoted 9 lines · Shivani Bhardwaj

Remove the function get_current_channel() and replace its calls by get_current_channel_802_11n() as the former function's definition involves only returning the value of latter function. Semantic patch used to find out the issue:

@@
identifier f,g;
@@

Quoted 7 lines

*f(...) {
return g(...); }

---
 drivers/staging/wilc1000/coreconfigurator.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

This replaces a previous patch you sent, right?

Quoted 8 lines

I'm totally confused as to what patches you want applied, please resend all of them for this driver, the latest versions, with proper version information so I have a hint as to what to do...

thanks,

greg k-h

This is different. I'm sorry for not updating the version information in the patches. I completely missed it. I'm sending them all again. Thank you

maintainer
#4 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: wilc1000: coreconfigurator: Remove irrelevant wrapper function

In reply to Shivani Bhardwaj
Quoted 36 lines · Shivani Bhardwaj

Remove the function get_current_channel() and replace its calls by get_current_channel_802_11n() as the former function's definition involves only returning the value of latter function. Semantic patch used to find out the issue:

@@
identifier f,g;
@@

*f(...) {
return g(...); }

---
 drivers/staging/wilc1000/coreconfigurator.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..1403a33 100644
@@ -331,13 +331,6 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 	return 0;  /* no MIB here */
 }
 
-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
-{
-	/* Extract current channel information from */
-	/* the beacon/probe response frame          */
-	return get_current_channel_802_11n(pu8msa, u16RxLen);
-}
-
 /**
  *  @brief                      parses the received 'N' message
  *  @details

drivers/staging/wilc1000/coreconfigurator.c s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) · line 424

Quoted 9 lines
drivers/staging/wilc1000/coreconfigurator.c +4 -2
@@ -425,8 +418,12 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 		/* Get BSSID */
 		get_BSSID(pu8msa, pstrNetworkInfo->au8bssid);
 
-		/* Get the current channel */
-		pstrNetworkInfo->u8channel = get_current_channel(pu8msa, (u16RxLen + FCS_LEN));
+		/* 
+		 * Extract current channel information from
+		 * the beacon/probe response frame          
+		 */

Trailing whitespace :(

Always check your patches with checkpatch.pl so you don't get grumpy emails from maintainers telling you to run your patches through checkpatch.pl before sending them out...

thanks,

greg k-h

maintainer
#6 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: wilc1000: coreconfigurator: Remove unnecessary parentheses

In reply to Shivani Bhardwaj
Quoted 7 lines · Shivani Bhardwaj

Parentheses around some arguments and expressions are not required and should be removed.

---
 drivers/staging/wilc1000/coreconfigurator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Does not apply as I didn't take patch 1/2 :(

#7 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: wilc1000: coreconfigurator: Remove unnecessary parentheses

Quoted 11 lines · Greg KH
Quoted 7 lines · Shivani Bhardwaj

Parentheses around some arguments and expressions are not required and should be removed.

---
 drivers/staging/wilc1000/coreconfigurator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Does not apply as I didn't take patch 1/2 :(

Hi Greg,

I think you've applied the patch because I've just rebased my branch and these changes are already done. However, I'm sending a patch that corrects the trailing whitespace error. I'm really sorry for the inconvenience caused.

Thank you