[PATCH 09/10] Use const with mac addresses
Kalle Valo
kvalo at qca.qualcomm.com
Mon May 27 07:53:31 EDT 2013
We shouldn't use ugly casts.
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
main.c | 18 +++++++++---------
smd.c | 10 +++++++---
smd.h | 9 ++++++---
3 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/main.c b/main.c
index 56f059f..8df9548 100644
--- a/main.c
+++ b/main.c
@@ -234,7 +234,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
if (vif->type == NL80211_IFTYPE_STATION &&
!is_zero_ether_addr(bss_conf->bssid)) {
- wcn36xx_smd_join(wcn, (u8*)bss_conf->bssid, vif->addr, wcn->ch);
+ wcn36xx_smd_join(wcn, bss_conf->bssid, vif->addr, wcn->ch);
wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
bss_conf->bssid, false);
}
@@ -260,25 +260,25 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
wcn->aid = bss_conf->aid;
- wcn36xx_smd_set_link_st(wcn, (u8*)bss_conf->bssid,
+ wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
vif->addr,
WCN36XX_HAL_LINK_POSTASSOC_STATE);
wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
- (u8*)bss_conf->bssid,
+ bss_conf->bssid,
true);
- wcn36xx_smd_config_sta(wcn, (u8*)bss_conf->bssid, vif->addr);
+ wcn36xx_smd_config_sta(wcn, bss_conf->bssid, vif->addr);
} else {
wcn36xx_dbg(WCN36XX_DBG_MAC,
"disassociated bss %pM vif %pM AID=%d",
- (u8*)bss_conf->bssid,
+ bss_conf->bssid,
vif->addr,
bss_conf->aid);
wcn->aid = 0;
wcn36xx_smd_delete_sta(wcn);
wcn36xx_smd_delete_bss(wcn);
wcn36xx_smd_set_link_st(wcn,
- (u8*)bss_conf->bssid,
+ bss_conf->bssid,
vif->addr,
WCN36XX_HAL_LINK_IDLE_STATE);
}
@@ -555,8 +555,8 @@ static int wcn36xx_read_mac_addresses(struct wcn36xx *wcn)
const struct firmware *addr_file = NULL;
int status;
u8 tmp[18];
- u8 qcom_oui[3] = {0x00, 0xA0, 0xC6};
- char *files[1] = {MAC_ADDR_0};
+ static const u8 qcom_oui[3] = {0x00, 0xA0, 0xC6};
+ static const char *files[1] = {MAC_ADDR_0};
int i;
for (i = 0; i < ARRAY_SIZE(wcn->addresses); i++) {
@@ -684,7 +684,7 @@ static int __init wcn36xx_init(void)
wcn->beacon_enable = false;
wcn36xx_read_mac_addresses(wcn);
- SET_IEEE80211_PERM_ADDR(wcn->hw, (u8*)(wcn->addresses[0].addr));
+ SET_IEEE80211_PERM_ADDR(wcn->hw, wcn->addresses[0].addr);
ret = ieee80211_register_hw(wcn->hw);
if (ret)
diff --git a/smd.c b/smd.c
index 61f3a05..01bc567 100644
--- a/smd.c
+++ b/smd.c
@@ -359,7 +359,7 @@ int wcn36xx_smd_delete_sta(struct wcn36xx *wcn)
return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
}
-int wcn36xx_smd_join(struct wcn36xx *wcn, u8 *bssid, u8 *vif, u8 ch)
+int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch)
{
struct wcn36xx_hal_join_req_msg msg_body;
@@ -381,7 +381,10 @@ int wcn36xx_smd_join(struct wcn36xx *wcn, u8 *bssid, u8 *vif, u8 ch)
return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
}
-int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac, enum wcn36xx_hal_link_state state)
+
+int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
+ const u8 *sta_mac,
+ enum wcn36xx_hal_link_state state)
{
struct wcn36xx_hal_set_link_state_req_msg msg_body;
@@ -443,7 +446,8 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
}
-int wcn36xx_smd_config_sta(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac)
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
+ const u8 *sta_mac)
{
struct wcn36xx_hal_config_sta_req_msg msg;
struct wcn36xx_hal_config_sta_params *sta;
diff --git a/smd.h b/smd.h
index 8be34cd..53d1655 100644
--- a/smd.h
+++ b/smd.h
@@ -58,12 +58,15 @@ int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn);
int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, u8 *addr, u32 status);
int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr);
int wcn36xx_smd_delete_sta(struct wcn36xx *wcn);
-int wcn36xx_smd_join(struct wcn36xx *wcn, u8 *bssid, u8 *vif, u8 ch);
-int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac, enum wcn36xx_hal_link_state state);
+int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch);
+int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
+ const u8 *sta_mac,
+ enum wcn36xx_hal_link_state state);
int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
const u8 *bssid, bool update);
int wcn36xx_smd_delete_bss(struct wcn36xx *wcn);
-int wcn36xx_smd_config_sta(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac);
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
+ const u8 *sta_mac);
int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct sk_buff *skb_beacon, u16 tim_off, u16 p2p_off);
int wcn36xx_smd_switch_channel_req(struct wcn36xx *wcn, int ch);
int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn, struct sk_buff *skb);
More information about the wcn36xx
mailing list