diff options
author | Chaehyun Lim <chaehyun.lim@gmail.com> | 2016-03-03 21:05:22 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-03 17:58:46 -0800 |
commit | 9bad1d0a5a0313b69597269474fd15849414cfae (patch) | |
tree | fa5bc03c9d3cb2eae52e38e8dd62edf2afc53bfc | |
parent | 9e58c36c7796736362bf1a3fbc7a8376e07e9357 (diff) |
staging: wilc1000: use switch statement instead of multiple if statement
It is more readable than multiple if-else statement.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/wilc1000/wilc_wlan_cfg.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 92f6d32656e4..b3425b9cec94 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -378,19 +378,31 @@ int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size) u8 type = (id >> 12) & 0xf; int ret = 0; - if (type == CFG_BYTE_CMD) { + switch (type) { + case CFG_BYTE_CMD: if (size >= 1) ret = wilc_wlan_cfg_set_byte(frame, offset, id, *buf); - } else if (type == CFG_HWORD_CMD) { + break; + + case CFG_HWORD_CMD: if (size >= 2) - ret = wilc_wlan_cfg_set_hword(frame, offset, id, *((u16 *)buf)); - } else if (type == CFG_WORD_CMD) { + ret = wilc_wlan_cfg_set_hword(frame, offset, id, + *((u16 *)buf)); + break; + + case CFG_WORD_CMD: if (size >= 4) - ret = wilc_wlan_cfg_set_word(frame, offset, id, *((u32 *)buf)); - } else if (type == CFG_STR_CMD) { + ret = wilc_wlan_cfg_set_word(frame, offset, id, + *((u32 *)buf)); + break; + + case CFG_STR_CMD: ret = wilc_wlan_cfg_set_str(frame, offset, id, buf, size); - } else if (type == CFG_BIN_CMD) { + break; + + case CFG_BIN_CMD: ret = wilc_wlan_cfg_set_bin(frame, offset, id, buf, size); + break; } return ret; |