Staging: wilc1000: wilc_wfi_cfgoperations: Remove unnecessary constants
PATCH v2 1/1 Staging: wilc1000: wilc_wfi_cfgoperations: Remove unnecessary constants
Remove constants wherever not required and change variables to bool type to get rid of constants.
Semantic patch used:
@@
type T;
identifier i;
constant C;
position p != e.p;
@@
- T i@p;
<+... when != i
- i = C;
...+>
---
Changes in v2:
-Improve the patch by completely eliminating the constant.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +3 -5
@@ -1714,7 +1714,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, {u32 i;s32 s32Error =0 ; -u8 flag =0 ; +bool flag =0 ;struct wilc_priv *priv =wiphy_priv (wiphy);
@@ -1725,7 +1725,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,if (!memcmp (pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,ETH_ALEN )) {/*If bssid already exists and pmkid value needs to reset*/ - flag =PMKID_FOUND ; + flag =1 ;PRINT_D (CFG80211_DBG ,"PMKID already exists\n" );break ; }
@@ -1736,7 +1736,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, ETH_ALEN);memcpy (priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid,PMKID_LEN ); -if (!(flag ==PMKID_FOUND )) +if (!flag) priv->pmkid_list.numpmkid++; }else {PRINT_ER ("Invalid PMKID index\n" );
@@ -1764,7 +1764,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, {u32 i; -u8 flag =0 ;s32 s32Error =0 ;struct wilc_priv *priv =wiphy_priv (wiphy);
@@ -1777,7 +1776,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,/*If bssid is found, reset the values*/ PRINT_D (CFG80211_DBG ,"Reseting PMKID values\n" );memset (&priv->pmkid_list.pmkidlist[i],0 ,sizeof (struct host_if_pmkid )); - flag =PMKID_FOUND ;break ; } }
Signature · 1 line
2.1.0
Quoted 2 lines · Shivani Bhardwaj
Remove constants wherever not required and change variables to bool type to get rid of constants.
This seems like two unrelated things. I think you could put them in different patches.
Quoted 27 lines
Semantic patch used:
@@
type T;
identifier i;
constant C;
position p != e.p;
@@- T i@p;
<+... when != i
- i = C;
...+>Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Improve the patch by completely eliminating the constant.drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0
-0
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, · line 1717
Quoted 5 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-1@@ -1714,7 +1714,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, {u32 i;s32 s32Error =0 ; -u8 flag =0 ; +bool flag =0 ;
Actually, my thought was to have a bool variable called pmkid_found. That would be more understandable than flag.
Also the initial value should be false, not 0.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, · line 1728
Quoted 8 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-1struct wilc_priv *priv =wiphy_priv (wiphy);@@ -1725,7 +1725,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,if (!memcmp (pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,ETH_ALEN )) {/*If bssid already exists and pmkid value needs to reset*/ - flag =PMKID_FOUND ; + flag =1 ;
And here the value would be true.
julia
Quoted 38 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-4PRINT_D (CFG80211_DBG ,"PMKID already exists\n" );break ; }@@ -1736,7 +1736,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, ETH_ALEN);memcpy (priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid,PMKID_LEN ); -if (!(flag ==PMKID_FOUND )) +if (!flag) priv->pmkid_list.numpmkid++; }else {PRINT_ER ("Invalid PMKID index\n" );@@ -1764,7 +1764,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, {u32 i; -u8 flag =0 ;s32 s32Error =0 ;struct wilc_priv *priv =wiphy_priv (wiphy);@@ -1777,7 +1776,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,/*If bssid is found, reset the values*/ PRINT_D (CFG80211_DBG ,"Reseting PMKID values\n" );memset (&priv->pmkid_list.pmkidlist[i],0 ,sizeof (struct host_if_pmkid )); - flag =PMKID_FOUND ;break ; } } --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/20151013102548.GA8383%40ubuntu.
For more options, visit https://groups.google.com/d/optout.
Quoted 44 lines · Julia Lawall
Quoted 2 lines · Shivani Bhardwaj
Remove constants wherever not required and change variables to bool type to get rid of constants.
This seems like two unrelated things. I think you could put them in different patches.
Quoted 27 lines
Semantic patch used:
@@
type T;
identifier i;
constant C;
position p != e.p;
@@- T i@p;
<+... when != i
- i = C;
...+>Signed-off-by Shivani Bhardwaj <[email protected]>---
Changes in v2:
-Improve the patch by completely eliminating the constant.drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0
-0drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, · line 1717
Quoted 5 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-1@@ -1714,7 +1714,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, {u32 i;s32 s32Error =0 ; -u8 flag =0 ; +bool flag =0 ;Actually, my thought was to have a bool variable called
pmkid_found. That would be more understandable than flag.
Quoted 2 lines
Also the initial value should be false, not 0.
Fine. I'm sending a patch set.
Thank you. :)
Quoted 51 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, · line 1728
Quoted 8 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-1struct wilc_priv *priv =wiphy_priv (wiphy);@@ -1725,7 +1725,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev,if (!memcmp (pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid,ETH_ALEN )) {/*If bssid already exists and pmkid value needs to reset*/ - flag =PMKID_FOUND ; + flag =1 ;And here the value would be true.
julia
Quoted 38 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-4PRINT_D (CFG80211_DBG ,"PMKID already exists\n" );break ; }@@ -1736,7 +1736,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, ETH_ALEN);memcpy (priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid,PMKID_LEN ); -if (!(flag ==PMKID_FOUND )) +if (!flag) priv->pmkid_list.numpmkid++; }else {PRINT_ER ("Invalid PMKID index\n" );@@ -1764,7 +1764,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, {u32 i; -u8 flag =0 ;s32 s32Error =0 ;struct wilc_priv *priv =wiphy_priv (wiphy);@@ -1777,7 +1776,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev,/*If bssid is found, reset the values*/ PRINT_D (CFG80211_DBG ,"Reseting PMKID values\n" );memset (&priv->pmkid_list.pmkidlist[i],0 ,sizeof (struct host_if_pmkid )); - flag =PMKID_FOUND ;break ; } } --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/20151013102548.GA8383%40ubuntu.
For more options, visit https://groups.google.com/d/optout.