staging: ks7010: avoid casting inside cpu_to_* assignments

cpu_to_*() functions already have a cast to u* built in,
so the cast is never required. Review and remove all of
them along the code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Sergio Paracuellos 2018-05-16 13:25:55 +02:00 committed by Greg Kroah-Hartman
parent dbbfae6af1
commit b2d187cc76
2 changed files with 31 additions and 32 deletions

View File

@ -1061,8 +1061,8 @@ static int send_stop_request(struct sdio_func *func)
return -ENOMEM; return -ENOMEM;
size = sizeof(*pp) - sizeof(pp->header.size); size = sizeof(*pp) - sizeof(pp->header.size);
pp->header.size = cpu_to_le16((u16)size); pp->header.size = cpu_to_le16(size);
pp->header.event = cpu_to_le16((u16)HIF_STOP_REQ); pp->header.event = cpu_to_le16(HIF_STOP_REQ);
sdio_claim_host(func); sdio_claim_host(func);
write_to_device(card->priv, (u8 *)pp, hif_align_size(sizeof(*pp))); write_to_device(card->priv, (u8 *)pp, hif_align_size(sizeof(*pp)));

View File

@ -989,7 +989,7 @@ static void *hostif_generic_request(size_t size, int event)
if (!p) if (!p)
return NULL; return NULL;
p->size = cpu_to_le16((u16)(size - sizeof(p->size))); p->size = cpu_to_le16(size - sizeof(p->size));
p->event = cpu_to_le16(event); p->event = cpu_to_le16(event);
return p; return p;
@ -1109,7 +1109,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
priv->wpa.key[1].key_len == 0 && priv->wpa.key[1].key_len == 0 &&
priv->wpa.key[2].key_len == 0 && priv->wpa.key[2].key_len == 0 &&
priv->wpa.key[3].key_len == 0) { priv->wpa.key[3].key_len == 0) {
pp->auth_type = cpu_to_le16((u16)TYPE_AUTH); pp->auth_type = cpu_to_le16(TYPE_AUTH);
} else { } else {
if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) {
michael_mic_function(&michael_mic, michael_mic_function(&michael_mic,
@ -1121,26 +1121,25 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
skb_len += 8; skb_len += 8;
p += 8; p += 8;
pp->auth_type = pp->auth_type =
cpu_to_le16((u16)TYPE_DATA); cpu_to_le16(TYPE_DATA);
} else if (priv->wpa.pairwise_suite == } else if (priv->wpa.pairwise_suite ==
IW_AUTH_CIPHER_CCMP) { IW_AUTH_CIPHER_CCMP) {
pp->auth_type = pp->auth_type =
cpu_to_le16((u16)TYPE_DATA); cpu_to_le16(TYPE_DATA);
} }
} }
} else { } else {
if (eth_proto == ETH_P_PAE) if (eth_proto == ETH_P_PAE)
pp->auth_type = cpu_to_le16((u16)TYPE_AUTH); pp->auth_type = cpu_to_le16(TYPE_AUTH);
else else
pp->auth_type = cpu_to_le16((u16)TYPE_DATA); pp->auth_type = cpu_to_le16(TYPE_DATA);
} }
/* header value set */ /* header value set */
pp->header.size = pp->header.size =
cpu_to_le16((u16) cpu_to_le16((sizeof(*pp) - sizeof(pp->header.size) + skb_len));
(sizeof(*pp) - sizeof(pp->header.size) + skb_len)); pp->header.event = cpu_to_le16(HIF_DATA_REQ);
pp->header.event = cpu_to_le16((u16)HIF_DATA_REQ);
/* tx request */ /* tx request */
result = ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + skb_len), result = ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + skb_len),
@ -1211,7 +1210,7 @@ static void hostif_mib_set_request(struct ks_wlan_private *priv,
return; return;
pp->mib_attribute = cpu_to_le32(attr); pp->mib_attribute = cpu_to_le32(attr);
pp->mib_value.size = cpu_to_le16((u16)size); pp->mib_value.size = cpu_to_le16(size);
pp->mib_value.type = cpu_to_le16(type); pp->mib_value.type = cpu_to_le16(type);
memcpy(&pp->mib_value.body, data, size); memcpy(&pp->mib_value.body, data, size);
@ -1221,7 +1220,7 @@ static void hostif_mib_set_request(struct ks_wlan_private *priv,
static inline void hostif_mib_set_request_int(struct ks_wlan_private *priv, static inline void hostif_mib_set_request_int(struct ks_wlan_private *priv,
enum mib_attribute attr, int val) enum mib_attribute attr, int val)
{ {
__le32 v = cpu_to_le32((u32)val); __le32 v = cpu_to_le32(val);
size_t size = sizeof(v); size_t size = sizeof(v);
hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_INT, &v, size); hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_INT, &v, size);
@ -1231,7 +1230,7 @@ static inline void hostif_mib_set_request_bool(struct ks_wlan_private *priv,
enum mib_attribute attr, enum mib_attribute attr,
bool val) bool val)
{ {
__le32 v = cpu_to_le32((u32)val); __le32 v = cpu_to_le32(val);
size_t size = sizeof(v); size_t size = sizeof(v);
hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_BOOL, &v, size); hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_BOOL, &v, size);
@ -1253,7 +1252,7 @@ void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode)
if (!pp) if (!pp)
return; return;
pp->mode = cpu_to_le16((u16)mode); pp->mode = cpu_to_le16(mode);
send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
@ -1281,9 +1280,9 @@ static __le16 ks_wlan_cap(struct ks_wlan_private *priv)
static void init_request(struct ks_wlan_private *priv, static void init_request(struct ks_wlan_private *priv,
struct hostif_request *req) struct hostif_request *req)
{ {
req->phy_type = cpu_to_le16((u16)(priv->reg.phy_type)); req->phy_type = cpu_to_le16(priv->reg.phy_type);
req->cts_mode = cpu_to_le16((u16)(priv->reg.cts_mode)); req->cts_mode = cpu_to_le16(priv->reg.cts_mode);
req->scan_type = cpu_to_le16((u16)(priv->reg.scan_type)); req->scan_type = cpu_to_le16(priv->reg.scan_type);
req->rate_set.size = priv->reg.rate_set.size; req->rate_set.size = priv->reg.rate_set.size;
req->capability = ks_wlan_cap(priv); req->capability = ks_wlan_cap(priv);
memcpy(&req->rate_set.body[0], &priv->reg.rate_set.body[0], memcpy(&req->rate_set.body[0], &priv->reg.rate_set.body[0],
@ -1300,7 +1299,7 @@ void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv)
return; return;
init_request(priv, &pp->request); init_request(priv, &pp->request);
pp->channel = cpu_to_le16((u16)(priv->reg.channel)); pp->channel = cpu_to_le16(priv->reg.channel);
send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
} }
@ -1318,8 +1317,8 @@ void hostif_infrastructure_set_request(struct ks_wlan_private *priv, int event)
pp->ssid.size = priv->reg.ssid.size; pp->ssid.size = priv->reg.ssid.size;
memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size); memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size);
pp->beacon_lost_count = pp->beacon_lost_count =
cpu_to_le16((u16)(priv->reg.beacon_lost_count)); cpu_to_le16(priv->reg.beacon_lost_count);
pp->auth_type = cpu_to_le16((u16)(priv->reg.authenticate_type)); pp->auth_type = cpu_to_le16(priv->reg.authenticate_type);
pp->channel_list.body[0] = 1; pp->channel_list.body[0] = 1;
pp->channel_list.body[1] = 8; pp->channel_list.body[1] = 8;
@ -1354,7 +1353,7 @@ void hostif_adhoc_set_request(struct ks_wlan_private *priv)
return; return;
init_request(priv, &pp->request); init_request(priv, &pp->request);
pp->channel = cpu_to_le16((u16)(priv->reg.channel)); pp->channel = cpu_to_le16(priv->reg.channel);
pp->ssid.size = priv->reg.ssid.size; pp->ssid.size = priv->reg.ssid.size;
memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size); memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size);
@ -1403,11 +1402,11 @@ void hostif_phy_information_request(struct ks_wlan_private *priv)
return; return;
if (priv->reg.phy_info_timer) { if (priv->reg.phy_info_timer) {
pp->type = cpu_to_le16((u16)TIME_TYPE); pp->type = cpu_to_le16(TIME_TYPE);
pp->time = cpu_to_le16((u16)(priv->reg.phy_info_timer)); pp->time = cpu_to_le16(priv->reg.phy_info_timer);
} else { } else {
pp->type = cpu_to_le16((u16)NORMAL_TYPE); pp->type = cpu_to_le16(NORMAL_TYPE);
pp->time = cpu_to_le16((u16)0); pp->time = cpu_to_le16(0);
} }
send_request_to_device(priv, pp, hif_align_size(sizeof(*pp))); send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
@ -1464,8 +1463,8 @@ void hostif_bss_scan_request(struct ks_wlan_private *priv,
pp->scan_type = scan_type; pp->scan_type = scan_type;
pp->ch_time_min = cpu_to_le32((u32)110); /* default value */ pp->ch_time_min = cpu_to_le32(110); /* default value */
pp->ch_time_max = cpu_to_le32((u32)130); /* default value */ pp->ch_time_max = cpu_to_le32(130); /* default value */
pp->channel_list.body[0] = 1; pp->channel_list.body[0] = 1;
pp->channel_list.body[1] = 8; pp->channel_list.body[1] = 8;
pp->channel_list.body[2] = 2; pp->channel_list.body[2] = 2;
@ -1619,7 +1618,7 @@ static void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
switch (type) { switch (type) {
case SME_RSN_UCAST_REQUEST: case SME_RSN_UCAST_REQUEST:
wpa_suite.size = cpu_to_le16((u16)1); wpa_suite.size = cpu_to_le16(1);
switch (priv->wpa.pairwise_suite) { switch (priv->wpa.pairwise_suite) {
case IW_AUTH_CIPHER_NONE: case IW_AUTH_CIPHER_NONE:
buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
@ -1682,7 +1681,7 @@ static void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
CIPHER_ID_LEN); CIPHER_ID_LEN);
break; break;
case SME_RSN_AUTH_REQUEST: case SME_RSN_AUTH_REQUEST:
wpa_suite.size = cpu_to_le16((u16)1); wpa_suite.size = cpu_to_le16(1);
switch (priv->wpa.key_mgmt_suite) { switch (priv->wpa.key_mgmt_suite) {
case IW_AUTH_KEY_MGMT_802_1X: case IW_AUTH_KEY_MGMT_802_1X:
buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ? buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
@ -1721,7 +1720,7 @@ static void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
(priv->wpa.version == IW_AUTH_WPA_VERSION_WPA) ? (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA) ?
RSN_MODE_WPA : RSN_MODE_NONE; RSN_MODE_WPA : RSN_MODE_NONE;
rsn_mode.rsn_mode = cpu_to_le32(mode); rsn_mode.rsn_mode = cpu_to_le32(mode);
rsn_mode.rsn_capability = cpu_to_le16((u16)0); rsn_mode.rsn_capability = cpu_to_le16(0);
hostif_mib_set_request_ostring(priv, LOCAL_RSN_MODE, hostif_mib_set_request_ostring(priv, LOCAL_RSN_MODE,
&rsn_mode, sizeof(rsn_mode)); &rsn_mode, sizeof(rsn_mode));
break; break;
@ -1979,7 +1978,7 @@ void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
memcpy(pmkcache.list[i].pmkid, pmk->pmkid, IW_PMKID_LEN); memcpy(pmkcache.list[i].pmkid, pmk->pmkid, IW_PMKID_LEN);
i++; i++;
} }
pmkcache.size = cpu_to_le16((u16)(priv->pmklist.size)); pmkcache.size = cpu_to_le16(priv->pmklist.size);
size = sizeof(priv->pmklist.size) + size = sizeof(priv->pmklist.size) +
((ETH_ALEN + IW_PMKID_LEN) * priv->pmklist.size); ((ETH_ALEN + IW_PMKID_LEN) * priv->pmklist.size);
hostif_mib_set_request_ostring(priv, LOCAL_PMK, &pmkcache, size); hostif_mib_set_request_ostring(priv, LOCAL_PMK, &pmkcache, size);