[PATCH 1/6] Move fw version check into a function
Eugene Krasnikov
k.eugene.e at gmail.com
Mon Aug 5 09:56:16 EDT 2013
This will make code more readable.
Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
main.c | 5 +----
smd.c | 10 ++--------
wcn36xx.h | 14 ++++++++++++++
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/main.c b/main.c
index 51bfb72..c18b321 100644
--- a/main.c
+++ b/main.c
@@ -260,10 +260,7 @@ static int wcn36xx_start(struct ieee80211_hw *hw)
wcn36xx_pmc_init(wcn);
wcn36xx_debugfs_init(wcn);
- if (!(wcn->fw_major == 1 &&
- wcn->fw_minor == 2 &&
- wcn->fw_version == 2 &&
- wcn->fw_revision == 24)) {
+ if (!is_old_fw_version(wcn)) {
ret = wcn36xx_smd_feature_caps_exchange(wcn);
if (ret)
wcn36xx_warn("Exchange feature caps failed");
diff --git a/smd.c b/smd.c
index 5fd6c08..75bee45 100644
--- a/smd.c
+++ b/smd.c
@@ -655,10 +655,7 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
- if (!(wcn->fw_major == 1 &&
- wcn->fw_minor == 2 &&
- wcn->fw_version == 2 &&
- wcn->fw_revision == 24))
+ if (!is_old_fw_version(wcn))
return wcn36xx_smd_config_sta_v1(wcn, &msg);
PREPARE_HAL_BUF(wcn->smd_buf, msg);
@@ -920,10 +917,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
bss->action = update;
- if (!(wcn->fw_major == 1 &&
- wcn->fw_minor == 2 &&
- wcn->fw_version == 2 &&
- wcn->fw_revision == 24))
+ if (!is_old_fw_version(wcn))
return wcn36xx_smd_config_bss_v1(wcn, &msg);
PREPARE_HAL_BUF(wcn->smd_buf, msg);
diff --git a/wcn36xx.h b/wcn36xx.h
index 86b6ce5..a63c6cb 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -94,6 +94,7 @@ static inline void buff_to_be(u32 *buf, size_t len)
for (i = 0; i < len; i++)
buf[i] = cpu_to_be32(buf[i]);
}
+
struct nv_data {
int is_valid;
void *table;
@@ -221,4 +222,17 @@ struct wcn36xx {
};
+static inline bool is_old_fw_version(struct wcn36xx *wcn)
+{
+ /*
+ * FW version 1.2.2.24 is old and does not support all functionality.
+ * HAL interface also differs e.g. wcn36xx_hal_config_sta_params and
+ * wcn36xx_hal_config_sta_params_v1 where v1 is for newer version.
+ */
+ return (wcn->fw_major <= 1 &&
+ wcn->fw_minor <= 2 &&
+ wcn->fw_version <= 2 &&
+ wcn->fw_revision <= 24);
+}
+
#endif /* _WCN36XX_H_ */
--
1.8.2.2
More information about the wcn36xx
mailing list