Skip to contentSkip to conversation

Staging: wilc1000: coreconfigurator: Remove unnecessary wrapper function

PATCH In review Shivani Bhardwaj 2 participants 7 messages Oct 22, 2015 – Oct 23, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wilc1000: coreconfigurator: Remove unnecessary 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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +5 -9
index 6dfe26d..f20f2f3 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,11 @@ 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
#1 lore raw
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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..f20f2f3 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 425

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +5 -2
@@ -425,8 +418,11 @@ 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));

This goes way over 80 characters. I know the code went over 80 characters before, but in constructing the new code, you could respect the 80 character limit at the same time.

Another issue, if someone is looking for something to do with Coccinelle, is that the parentheses on the second argument above and on the addition below are not necessary. But fixing that shouldn't be in the same patch.

julia

Quoted 13 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
 		/* Get beacon period */
 		u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);
Signature · 8 lines
2.1.0

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151022192006.GA23576%40ubuntu.
For more options, visit https://groups.google.com/d/optout.
#2 lore raw
Quoted 53 lines · Julia Lawall
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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..f20f2f3 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 425

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +5 -2
@@ -425,8 +418,11 @@ 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));

This goes way over 80 characters. I know the code went over 80 characters before, but in constructing the new code, you could respect the 80 character limit at the same time.

Quoted 4 lines

Another issue, if someone is looking for something to do with Coccinelle, is that the parentheses on the second argument above and on the addition below are not necessary. But fixing that shouldn't be in the same patch.

I don't understand this issue, can you please elaborate a tad bit more?

Quoted 15 lines

julia

Quoted 13 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -1
              /* Get beacon period */
              u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);
--

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151022192006.GA23576%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 54 lines · Shivani Bhardwaj
Quoted 53 lines · Julia Lawall
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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..f20f2f3 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 425

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +5 -2
@@ -425,8 +418,11 @@ 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));

This goes way over 80 characters. I know the code went over 80 characters before, but in constructing the new code, you could respect the 80 character limit at the same time.

Quoted 6 lines
Quoted 4 lines

Another issue, if someone is looking for something to do with Coccinelle, is that the parentheses on the second argument above and on the addition below are not necessary. But fixing that shouldn't be in the same patch.

I don't understand this issue, can you please elaborate a tad bit more?

See below.

Quoted 5 lines
Quoted 5 lines

julia

Quoted 3 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
              /* Get beacon period */
              u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);

This code could be u8index = MAC_HDR_LEN + TIME_STAMP_LEN;. Parentheses on the outside of an expression don't help anything.

julia

Quoted 17 lines
Quoted 9 lines
Quoted 9 lines

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151022192006.GA23576%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKHNQQGaEZ8DofL6F4psu-8Xg_PS5BShLh6Z%3DbtxUDN8xLDNBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
#4 lore raw
Quoted 70 lines · Julia Lawall
Quoted 54 lines · Shivani Bhardwaj
Quoted 53 lines · Julia Lawall
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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..f20f2f3 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 425

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +5 -2
@@ -425,8 +418,11 @@ 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));

This goes way over 80 characters. I know the code went over 80 characters before, but in constructing the new code, you could respect the 80 character limit at the same time.

Quoted 6 lines
Quoted 4 lines

Another issue, if someone is looking for something to do with Coccinelle, is that the parentheses on the second argument above and on the addition below are not necessary. But fixing that shouldn't be in the same patch.

I don't understand this issue, can you please elaborate a tad bit more?

See below.

Quoted 3 lines
Quoted 3 lines

julia

Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
              /* Get beacon period */
              u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);

This code could be u8index = MAC_HDR_LEN + TIME_STAMP_LEN;. Parentheses on the outside of an expression don't help anything.

julia

I get that. Thanks. I'm sending v2.

Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151022192006.GA23576%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKHNQQGaEZ8DofL6F4psu-8Xg_PS5BShLh6Z%3DbtxUDN8xLDNBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw
Quoted 74 lines · Shivani Bhardwaj
Quoted 73 lines · Julia Lawall
Quoted 54 lines · Shivani Bhardwaj
Quoted 53 lines · Julia Lawall
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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..f20f2f3 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 425

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +5 -2
@@ -425,8 +418,11 @@ 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));

This goes way over 80 characters. I know the code went over 80 characters before, but in constructing the new code, you could respect the 80 character limit at the same time.

Quoted 6 lines
Quoted 4 lines

Another issue, if someone is looking for something to do with Coccinelle, is that the parentheses on the second argument above and on the addition below are not necessary. But fixing that shouldn't be in the same patch.

I don't understand this issue, can you please elaborate a tad bit more?

See below.

Quoted 5 lines
Quoted 5 lines

julia

Quoted 3 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
              /* Get beacon period */
              u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);
Quoted 7 lines
Quoted 5 lines

This code could be u8index = MAC_HDR_LEN + TIME_STAMP_LEN;. Parentheses on the outside of an expression don't help anything.

julia

I get that. Thanks. I'm sending v2.

Dropping the parens shouldn't be in the same patch. It could be in a series.

julia

Quoted 19 lines
Quoted 18 lines
Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151022192006.GA23576%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKHNQQGaEZ8DofL6F4psu-8Xg_PS5BShLh6Z%3DbtxUDN8xLDNBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw
Quoted 84 lines · Julia Lawall
Quoted 80 lines · Shivani Bhardwaj
Quoted 78 lines · Julia Lawall
Quoted 54 lines · Shivani Bhardwaj
Quoted 53 lines · Julia Lawall
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 | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/coreconfigurator.c +0 -7
index 6dfe26d..f20f2f3 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 425

Quoted 10 lines
drivers/staging/wilc1000/coreconfigurator.c +5 -2
@@ -425,8 +418,11 @@ 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));

This goes way over 80 characters. I know the code went over 80 characters before, but in constructing the new code, you could respect the 80 character limit at the same time.

Quoted 6 lines
Quoted 4 lines

Another issue, if someone is looking for something to do with Coccinelle, is that the parentheses on the second argument above and on the addition below are not necessary. But fixing that shouldn't be in the same patch.

I don't understand this issue, can you please elaborate a tad bit more?

See below.

Quoted 5 lines
Quoted 5 lines

julia

Quoted 3 lines
drivers/staging/wilc1000/coreconfigurator.c +0 -0
              /* Get beacon period */
              u8index = (MAC_HDR_LEN + TIME_STAMP_LEN);

This code could be u8index = MAC_HDR_LEN + TIME_STAMP_LEN;. Parentheses on the outside of an expression don't help anything.

julia

Quoted 7 lines
Quoted 1 line

I get that. Thanks. I'm sending v2.

Dropping the parens shouldn't be in the same patch. It could be in a series.

julia

I'll take care. Thanks!

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 18 lines
Quoted 10 lines
Quoted 10 lines

2.1.0

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151022192006.GA23576%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAKHNQQGaEZ8DofL6F4psu-8Xg_PS5BShLh6Z%3DbtxUDN8xLDNBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.