From: Shivani Bhardwaj <shivanib134@gmail.com>
To: outreachy-kernel@googlegroups.com
Subject: [PATCH v2] Staging: wilc1000: wilc_wfi_cfgoperations: Remove unnecessary constants
Date: Tue, 13 Oct 2015 15:55:48 +0530 [thread overview]
Message-ID: <20151013102548.GA8383@ubuntu> (raw)
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;
...+>
Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
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(-)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 6472777..f6259f7 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -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;
}
}
--
2.1.0
next reply other threads:[~2015-10-13 10:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 10:25 Shivani Bhardwaj [this message]
2015-10-13 10:41 ` [Outreachy kernel] [PATCH v2] Staging: wilc1000: wilc_wfi_cfgoperations: Remove unnecessary constants Julia Lawall
2015-10-13 10:44 ` Shivani Bhardwaj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151013102548.GA8383@ubuntu \
--to=shivanib134@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.