* [PATCH 11/19] wireless: Change variable type to bool [not found] <1379802471-30252-1-git-send-email-peter.senna@gmail.com> @ 2013-09-21 22:27 ` Peter Senna Tschudin 2013-09-23 19:40 ` Bing Zhao 2013-09-21 22:27 ` [PATCH 12/19] " Peter Senna Tschudin 1 sibling, 1 reply; 5+ messages in thread From: Peter Senna Tschudin @ 2013-09-21 22:27 UTC (permalink / raw) To: bzhao Cc: linville, linux-wireless, netdev, linux-kernel, kernel-janitors, Peter Senna Tschudin The variables cancel_scan_cmd, enable_data, hs_activate and valid are only assigned the values true and false. Change its type to bool. The simplified semantic patch that find this problem is as follows (http://coccinelle.lip6.fr/): @exists@ type T; identifier b; @@ - T + bool b = ...; ... when any b = \(true\|false\) Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> --- drivers/net/wireless/mwifiex/cmdevt.c | 2 +- drivers/net/wireless/mwifiex/join.c | 2 +- drivers/net/wireless/mwifiex/sta_cmd.c | 2 +- drivers/net/wireless/mwifiex/wmm.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 2d76147..fb3fa18 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c @@ -1048,7 +1048,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; unsigned long cmd_flags; unsigned long scan_pending_q_flags; - uint16_t cancel_scan_cmd = false; + bool cancel_scan_cmd = false; if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 9d7c0e6..717fbe2 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c @@ -621,7 +621,7 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, int ret = 0; struct ieee_types_assoc_rsp *assoc_rsp; struct mwifiex_bssdescriptor *bss_desc; - u8 enable_data = true; + bool enable_data = true; u16 cap_info, status_code; assoc_rsp = (struct ieee_types_assoc_rsp *) &resp->params; diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c index c0268b5..7d66018 100644 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/mwifiex/sta_cmd.c @@ -327,7 +327,7 @@ mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv, { struct mwifiex_adapter *adapter = priv->adapter; struct host_cmd_ds_802_11_hs_cfg_enh *hs_cfg = &cmd->params.opt_hs_cfg; - u16 hs_activate = false; + bool hs_activate = false; if (!hscfg_param) /* New Activate command */ diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 2e8f9cd..8f8fea0 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c @@ -708,7 +708,7 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, { u8 *curr = (u8 *) &resp->params.get_wmm_status; uint16_t resp_len = le16_to_cpu(resp->size), tlv_len; - int valid = true; + bool valid = true; struct mwifiex_ie_types_data *tlv_hdr; struct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH 11/19] wireless: Change variable type to bool 2013-09-21 22:27 ` [PATCH 11/19] wireless: Change variable type to bool Peter Senna Tschudin @ 2013-09-23 19:40 ` Bing Zhao 0 siblings, 0 replies; 5+ messages in thread From: Bing Zhao @ 2013-09-23 19:40 UTC (permalink / raw) To: Peter Senna Tschudin Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Hi Peter, Thanks for your patch. > The variables cancel_scan_cmd, enable_data, hs_activate and valid are > only assigned the values true and false. Change its type to bool. > > The simplified semantic patch that find this problem is as > follows (http://coccinelle.lip6.fr/): > > @exists@ > type T; > identifier b; > @@ > - T > + bool > b = ...; > ... when any > b = \(true\|false\) > > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Acked-by: Bing Zhao <bzhao@marvell.com> Thanks, Bing > --- > drivers/net/wireless/mwifiex/cmdevt.c | 2 +- > drivers/net/wireless/mwifiex/join.c | 2 +- > drivers/net/wireless/mwifiex/sta_cmd.c | 2 +- > drivers/net/wireless/mwifiex/wmm.c | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 12/19] wireless: Change variable type to bool [not found] <1379802471-30252-1-git-send-email-peter.senna@gmail.com> 2013-09-21 22:27 ` [PATCH 11/19] wireless: Change variable type to bool Peter Senna Tschudin @ 2013-09-21 22:27 ` Peter Senna Tschudin 2013-09-22 8:22 ` Joe Perches 2013-09-24 10:54 ` Kalle Valo 1 sibling, 2 replies; 5+ messages in thread From: Peter Senna Tschudin @ 2013-09-21 22:27 UTC (permalink / raw) To: Larry.Finger Cc: chaoming_li, linville, linux-wireless, netdev, linux-kernel, kernel-janitors, Peter Senna Tschudin The variable continual is only assigned the values true and false. Change its type to bool. The simplified semantic patch that find this problem is as follows (http://coccinelle.lip6.fr/): @exists@ type T; identifier b; @@ - T + bool b = ...; ... when any b = \(true\|false\) Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> --- drivers/net/wireless/rtlwifi/efuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c index 838a1ed..63d370d 100644 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ b/drivers/net/wireless/rtlwifi/efuse.c @@ -1203,7 +1203,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate) static u16 efuse_get_current_size(struct ieee80211_hw *hw) { - int continual = true; + bool continual = true; u16 efuse_addr = 0; u8 hworden; u8 efuse_data, word_cnts; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 12/19] wireless: Change variable type to bool 2013-09-21 22:27 ` [PATCH 12/19] " Peter Senna Tschudin @ 2013-09-22 8:22 ` Joe Perches 2013-09-24 10:54 ` Kalle Valo 1 sibling, 0 replies; 5+ messages in thread From: Joe Perches @ 2013-09-22 8:22 UTC (permalink / raw) To: Peter Senna Tschudin Cc: Larry.Finger, chaoming_li, linville, linux-wireless, netdev, linux-kernel, kernel-janitors On Sun, 2013-09-22 at 00:27 +0200, Peter Senna Tschudin wrote: > The variable continual is only assigned the values true and false. > Change its type to bool. [] > diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c [] > @@ -1203,7 +1203,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate) > > static u16 efuse_get_current_size(struct ieee80211_hw *hw) > { > - int continual = true; > + bool continual = true; > u16 efuse_addr = 0; > u8 hworden; > u8 efuse_data, word_cnts; Yes, this could use bool, but would probably be better written without continual at all as it is before this patch: static u16 efuse_get_current_size(struct ieee80211_hw *hw) { int continual = true; u16 efuse_addr = 0; u8 hworden; u8 efuse_data, word_cnts; while (continual && efuse_one_byte_read(hw, efuse_addr, &efuse_data) && (efuse_addr < EFUSE_MAX_SIZE)) { if (efuse_data != 0xFF) { hworden = efuse_data & 0x0F; word_cnts = efuse_calculate_word_cnts(hworden); efuse_addr = efuse_addr + (word_cnts * 2) + 1; } else { continual = false; } } return efuse_addr; } I think writing it without continual, which is effectively an ersatz "break", would be better Something like: static u16 efuse_get_current_size(struct ieee80211_hw *hw) { u16 efuse_addr = 0; u8 hworden; u8 efuse_data, word_cnts; while (efuse_one_byte_read(hw, efuse_addr, &efuse_data) && (efuse_addr < EFUSE_MAX_SIZE) { if (efuse_data == 0xff) break; hworden = efuse_data & 0x0F; word_cnts = efuse_calculate_word_cnts(hworden); efuse_addr = efuse_addr + (word_cnts * 2) + 1; } return efuse_addr; } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 12/19] wireless: Change variable type to bool 2013-09-21 22:27 ` [PATCH 12/19] " Peter Senna Tschudin 2013-09-22 8:22 ` Joe Perches @ 2013-09-24 10:54 ` Kalle Valo 1 sibling, 0 replies; 5+ messages in thread From: Kalle Valo @ 2013-09-24 10:54 UTC (permalink / raw) To: Peter Senna Tschudin Cc: Larry.Finger, chaoming_li, linville, linux-wireless, netdev, linux-kernel, kernel-janitors Peter Senna Tschudin <peter.senna@gmail.com> writes: > The variable continual is only assigned the values true and false. > Change its type to bool. > > The simplified semantic patch that find this problem is as > follows (http://coccinelle.lip6.fr/): > > @exists@ > type T; > identifier b; > @@ > - T > + bool > b = ...; > ... when any > b = \(true\|false\) > > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> > --- > drivers/net/wireless/rtlwifi/efuse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Please prefix the patch title with "rtlwifi:". We use "wireless:" for changes to net/wireless. -- Kalle Valo ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-24 10:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1379802471-30252-1-git-send-email-peter.senna@gmail.com>
2013-09-21 22:27 ` [PATCH 11/19] wireless: Change variable type to bool Peter Senna Tschudin
2013-09-23 19:40 ` Bing Zhao
2013-09-21 22:27 ` [PATCH 12/19] " Peter Senna Tschudin
2013-09-22 8:22 ` Joe Perches
2013-09-24 10:54 ` Kalle Valo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox