summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaehyun Lim <chaehyun.lim@gmail.com>2016-03-03 13:05:20 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-04 02:58:46 +0100
commit7cc386e9def8f99bb7bbe8ca06a07a7b17198684 (patch)
treef2a61ca55b3bde4bae7db643a2981f64b381c540
parentstaging: wilc1000: rename hardwareProductVersion in struct wilc_mac_cfg (diff)
downloadlinux-7cc386e9def8f99bb7bbe8ca06a07a7b17198684.tar.xz
linux-7cc386e9def8f99bb7bbe8ca06a07a7b17198684.zip
staging: wilc1000: add enum cfg_type_cmd
This patch adds a new enum cfg_type_cmd to change hard-coded command type. 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.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index 6a33187ac6d2..9cf68b7ad35c 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -18,6 +18,13 @@
* Global Data
*
********************************************/
+enum cfg_cmd_type {
+ CFG_BYTE_CMD = 0,
+ CFG_HWORD_CMD = 1,
+ CFG_WORD_CMD = 2,
+ CFG_STR_CMD = 3,
+ CFG_BIN_CMD = 4
+};
struct wilc_mac_cfg {
int mac_status;
@@ -371,18 +378,18 @@ 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 == 0) { /* byte command */
+ if (type == CFG_BYTE_CMD) { /* byte command */
if (size >= 1)
ret = wilc_wlan_cfg_set_byte(frame, offset, id, *buf);
- } else if (type == 1) { /* half word command */
+ } else if (type == CFG_HWORD_CMD) { /* half word command */
if (size >= 2)
ret = wilc_wlan_cfg_set_hword(frame, offset, id, *((u16 *)buf));
- } else if (type == 2) { /* word command */
+ } else if (type == CFG_WORD_CMD) { /* word command */
if (size >= 4)
ret = wilc_wlan_cfg_set_word(frame, offset, id, *((u32 *)buf));
- } else if (type == 3) { /* string command */
+ } else if (type == CFG_STR_CMD) { /* string command */
ret = wilc_wlan_cfg_set_str(frame, offset, id, buf, size);
- } else if (type == 4) { /* binary command */
+ } else if (type == CFG_BIN_CMD) { /* binary command */
ret = wilc_wlan_cfg_set_bin(frame, offset, id, buf, size);
}
@@ -415,7 +422,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
}
i = 0;
- if (type == 0) { /* byte command */
+ if (type == CFG_BYTE_CMD) { /* byte command */
do {
if (g_cfg_byte[i].id == WID_NIL)
break;
@@ -427,7 +434,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
}
i++;
} while (1);
- } else if (type == 1) { /* half word command */
+ } else if (type == CFG_HWORD_CMD) { /* half word command */
do {
if (g_cfg_hword[i].id == WID_NIL)
break;
@@ -439,7 +446,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
}
i++;
} while (1);
- } else if (type == 2) { /* word command */
+ } else if (type == CFG_WORD_CMD) { /* word command */
do {
if (g_cfg_word[i].id == WID_NIL)
break;
@@ -451,7 +458,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
}
i++;
} while (1);
- } else if (type == 3) { /* string command */
+ } else if (type == CFG_STR_CMD) { /* string command */
do {
if (g_cfg_str[i].id == WID_NIL)
break;