From: Stanislav Fomichev <kernel@xxxxxxxxxxx> htod32 -> cpu_to_le32 htod16 -> cpu_to_le16 dtoh32 -> le32_to_cpu dtoh16 -> le16_to_cpu For brcmfmac/dhd_common.c just removed defines. Signed-off-by: Stanislav Fomichev <kernel@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/staging/brcm80211/brcmfmac/dhd_common.c | 97 ++++----- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 134 ++++++------ drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 20 +-- drivers/staging/brcm80211/brcmfmac/wl_iw.c | 264 ++++++++++----------- 4 files changed, 239 insertions(+), 276 deletions(-) diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c index 5b8720d..44dabd1 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c @@ -37,11 +37,6 @@ u32 dhd_conn_event; u32 dhd_conn_status; u32 dhd_conn_reason; -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i - extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len); extern void dhd_ind_scan_confirm(void *h, bool status); @@ -975,10 +970,10 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1); /* Parse packet filter id. */ - enable_parm.id = htod32(simple_strtoul(argv[i], NULL, 0)); + enable_parm.id = simple_strtoul(argv[i], NULL, 0); /* Parse enable/disable value. */ - enable_parm.enable = htod32(enable); + enable_parm.enable = enable; buf_len += sizeof(enable_parm); memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm)); @@ -1063,7 +1058,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1); /* Parse packet filter id. */ - pkt_filter.id = htod32(simple_strtoul(argv[i], NULL, 0)); + pkt_filter.id = simple_strtoul(argv[i], NULL, 0); if (NULL == argv[++i]) { DHD_ERROR(("Polarity not provided\n")); @@ -1071,7 +1066,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) } /* Parse filter polarity. */ - pkt_filter.negate_match = htod32(simple_strtoul(argv[i], NULL, 0)); + pkt_filter.negate_match = simple_strtoul(argv[i], NULL, 0); if (NULL == argv[++i]) { DHD_ERROR(("Filter type not provided\n")); @@ -1079,7 +1074,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) } /* Parse filter type. */ - pkt_filter.type = htod32(simple_strtoul(argv[i], NULL, 0)); + pkt_filter.type = simple_strtoul(argv[i], NULL, 0); if (NULL == argv[++i]) { DHD_ERROR(("Offset not provided\n")); @@ -1087,7 +1082,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) } /* Parse pattern filter offset. */ - pkt_filter.u.pattern.offset = htod32(simple_strtoul(argv[i], NULL, 0)); + pkt_filter.u.pattern.offset = simple_strtoul(argv[i], NULL, 0); if (NULL == argv[++i]) { DHD_ERROR(("Bitmask not provided\n")); @@ -1096,8 +1091,8 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) /* Parse pattern filter mask. */ mask_size = - htod32(wl_pattern_atoh - (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern)); + wl_pattern_atoh + (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern); if (NULL == argv[++i]) { DHD_ERROR(("Pattern not provided\n")); @@ -1106,9 +1101,9 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) /* Parse pattern filter pattern. */ pattern_size = - htod32(wl_pattern_atoh(argv[i], + wl_pattern_atoh(argv[i], (char *)&pkt_filterp->u.pattern. - mask_and_pattern[mask_size])); + mask_and_pattern[mask_size]); if (mask_size != pattern_size) { DHD_ERROR(("Mask and pattern not the same size\n")); @@ -1428,8 +1423,7 @@ int dhd_iscan_print_cache(iscan_buf_t *iscan_skip) bi->BSSID.octet[2], bi->BSSID.octet[3], bi->BSSID.octet[4], bi->BSSID.octet[5])); - bi = (wl_bss_info_t *)((unsigned long)bi + - dtoh32(bi->length)); + bi = (wl_bss_info_t *)((unsigned long)bi + bi->length); } iscan_cur = iscan_cur->next; l++; @@ -1493,18 +1487,16 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip) bi->BSSID.octet[5])); bi_new = bi; - bi = (wl_bss_info_t *)((unsigned long)bi + - dtoh32 - (bi->length)); + bi = (wl_bss_info_t *)((unsigned long) + bi + bi->length); /* if(bi && bi_new) { memcpy(bi_new, bi, results->buflen - - dtoh32(bi_new->length)); - results->buflen -= dtoh32(bi_new->length); + bi_new->length); + results->buflen -= bi_new->length; } */ - results->buflen -= - dtoh32(bi_new->length); + results->buflen -= bi_new->length; results->count--; for (j = i; j < results->count; j++) { @@ -1520,16 +1512,13 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip) bi_next = (wl_bss_info_t *)((unsigned long)bi + - dtoh32 - (bi->length)); + bi->length); memcpy(bi_new, bi, - dtoh32 - (bi->length)); + bi->length); bi_new = (wl_bss_info_t *)((unsigned long)bi_new + - dtoh32 - (bi_new-> - length)); + bi_new-> + length); bi = bi_next; } } @@ -1544,7 +1533,7 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip) break; } bi = (wl_bss_info_t *)((unsigned long)bi + - dtoh32(bi->length)); + bi->length); } } iscan_cur = iscan_cur->next; @@ -1598,7 +1587,7 @@ int dhd_iscan_remove_duplicates(void *dhdp, iscan_buf_t *iscan_cur) dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur); - bi = (wl_bss_info_t *)((unsigned long)bi + dtoh32(bi->length)); + bi = (wl_bss_info_t *)((unsigned long)bi + bi->length); } done: @@ -1627,15 +1616,15 @@ int dhd_iscan_request(void *dhdp, u16 action) params.params.bss_type = DOT11_BSSTYPE_ANY; params.params.scan_type = DOT11_SCANTYPE_ACTIVE; - params.params.nprobes = htod32(-1); - params.params.active_time = htod32(-1); - params.params.passive_time = htod32(-1); - params.params.home_time = htod32(-1); - params.params.channel_num = htod32(0); + params.params.nprobes = -1; + params.params.active_time = -1; + params.params.passive_time = -1; + params.params.home_time = -1; + params.params.channel_num = 0; - params.version = htod32(ISCAN_REQ_VERSION); - params.action = htod16(action); - params.scan_duration = htod16(0); + params.version = ISCAN_REQ_VERSION; + params.action = action; + params.scan_duration = 0; bcm_mkiovar("iscan", (char *)¶ms, sizeof(wl_iscan_params_t), buf, WLC_IOCTL_SMLEN); @@ -1672,16 +1661,16 @@ static int dhd_iscan_get_partial_result(void *dhdp, uint *scan_count) results->count = 0; memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN); + list.results.buflen = WLC_IW_ISCAN_MAXLEN; bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE, iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN); rc = dhd_wl_ioctl(dhdp, WLC_GET_VAR, iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN); - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - *scan_count = results->count = dtoh32(results->count); - status = dtoh32(list_buf->status); + results->buflen = results->buflen; + results->version = results->version; + *scan_count = results->count = results->count; + status = list_buf->status; dhd_iscan_unlock(); @@ -1804,12 +1793,12 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc memset(&pfn_element, 0, sizeof(pfn_element)); /* set pfn parameters */ - pfn_param.version = htod32(PFN_VERSION); - pfn_param.flags = htod16((PFN_LIST_ORDER << SORT_CRITERIA_BIT)); + pfn_param.version = PFN_VERSION; + pfn_param.flags = (PFN_LIST_ORDER << SORT_CRITERIA_BIT); /* set up pno scan fr */ if (scan_fr != 0) - pfn_param.scan_freq = htod32(scan_fr); + pfn_param.scan_freq = scan_fr; bcm_mkiovar("pfn_set", (char *)&pfn_param, sizeof(pfn_param), iovbuf, sizeof(iovbuf)); @@ -1818,11 +1807,11 @@ dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char sc /* set all pfn ssid */ for (i = 0; i < nssid; i++) { - pfn_element.bss_type = htod32(DOT11_BSSTYPE_INFRASTRUCTURE); - pfn_element.auth = (DOT11_OPEN_SYSTEM); - pfn_element.wpa_auth = htod32(WPA_AUTH_PFN_ANY); - pfn_element.wsec = htod32(0); - pfn_element.infra = htod32(1); + pfn_element.bss_type = DOT11_BSSTYPE_INFRASTRUCTURE; + pfn_element.auth = DOT11_OPEN_SYSTEM; + pfn_element.wpa_auth = WPA_AUTH_PFN_ANY; + pfn_element.wsec = 0; + pfn_element.infra = 1; memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID, ssids_local[i].SSID_len); diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c index 54169c4..fe3379a 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c @@ -555,24 +555,24 @@ static const u32 __wl_cipher_suites[] = { static void swap_key_from_BE(struct wl_wsec_key *key) { - key->index = htod32(key->index); - key->len = htod32(key->len); - key->algo = htod32(key->algo); - key->flags = htod32(key->flags); - key->rxiv.hi = htod32(key->rxiv.hi); - key->rxiv.lo = htod16(key->rxiv.lo); - key->iv_initialized = htod32(key->iv_initialized); + key->index = cpu_to_le32(key->index); + key->len = cpu_to_le32(key->len); + key->algo = cpu_to_le32(key->algo); + key->flags = cpu_to_le32(key->flags); + key->rxiv.hi = cpu_to_le32(key->rxiv.hi); + key->rxiv.lo = cpu_to_le16(key->rxiv.lo); + key->iv_initialized = cpu_to_le32(key->iv_initialized); } static void swap_key_to_BE(struct wl_wsec_key *key) { - key->index = dtoh32(key->index); - key->len = dtoh32(key->len); - key->algo = dtoh32(key->algo); - key->flags = dtoh32(key->flags); - key->rxiv.hi = dtoh32(key->rxiv.hi); - key->rxiv.lo = dtoh16(key->rxiv.lo); - key->iv_initialized = dtoh32(key->iv_initialized); + key->index = le32_to_cpu(key->index); + key->len = le32_to_cpu(key->len); + key->algo = le32_to_cpu(key->algo); + key->flags = le32_to_cpu(key->flags); + key->rxiv.hi = le32_to_cpu(key->rxiv.hi); + key->rxiv.lo = le16_to_cpu(key->rxiv.lo); + key->iv_initialized = le32_to_cpu(key->iv_initialized); } static s32 @@ -626,8 +626,8 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, default: return -EINVAL; } - infra = htod32(infra); - ap = htod32(ap); + infra = cpu_to_le32(infra); + ap = cpu_to_le32(ap); wdev = ndev->ieee80211_ptr; wdev->iftype = type; WL_DBG("%s : ap (%d), infra (%d)\n", ndev->name, ap, infra); @@ -657,10 +657,10 @@ static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid) params->home_time = -1; params->channel_num = 0; - params->nprobes = htod32(params->nprobes); - params->active_time = htod32(params->active_time); - params->passive_time = htod32(params->passive_time); - params->home_time = htod32(params->home_time); + params->nprobes = cpu_to_le32(params->nprobes); + params->active_time = cpu_to_le32(params->active_time); + params->passive_time = cpu_to_le32(params->passive_time); + params->home_time = cpu_to_le32(params->home_time); if (ssid && ssid->SSID_len) memcpy(¶ms->ssid, ssid, sizeof(wlc_ssid_t)); @@ -707,9 +707,9 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action) wl_iscan_prep(¶ms->params, ssid); - params->version = htod32(ISCAN_REQ_VERSION); - params->action = htod16(action); - params->scan_duration = htod16(0); + params->version = cpu_to_le32(ISCAN_REQ_VERSION); + params->action = cpu_to_le16(action); + params->scan_duration = cpu_to_le16(0); /* params_size += offsetof(wl_iscan_params_t, params); */ err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size, @@ -812,7 +812,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, min_t(u8, sizeof(sr->ssid.SSID), ssids->ssid_len); if (sr->ssid.SSID_len) { memcpy(sr->ssid.SSID, ssids->ssid, sr->ssid.SSID_len); - sr->ssid.SSID_len = htod32(sr->ssid.SSID_len); + sr->ssid.SSID_len = cpu_to_le32(sr->ssid.SSID_len); WL_DBG("Specific scan ssid=\"%s\" len=%d\n", sr->ssid.SSID, sr->ssid.SSID_len); spec_scan = true; @@ -872,7 +872,7 @@ static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) u32 len; s32 err = 0; - val = htod32(val); + val = cpu_to_le32(val); len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf)); BUG_ON(!len); @@ -903,7 +903,7 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) if (unlikely(err)) { WL_ERR("error (%d)\n", err); } - *retval = dtoh32(var.val); + *retval = le32_to_cpu(var.val); return err; } @@ -937,7 +937,7 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) s32 err = 0; u32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL); - retry = htod32(retry); + retry = cpu_to_le32(retry); err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry)); if (unlikely(err)) { WL_ERR("cmd (%d) , error (%d)\n", cmd, err); @@ -1040,7 +1040,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, memset(&join_params, 0, sizeof(join_params)); memcpy((void *)join_params.ssid.SSID, (void *)params->ssid, params->ssid_len); - join_params.ssid.SSID_len = htod32(params->ssid_len); + join_params.ssid.SSID_len = cpu_to_le32(params->ssid_len); if (params->bssid) memcpy(&join_params.params.bssid, params->bssid, ETH_ALEN); @@ -1370,7 +1370,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len); memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len); - join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len); + join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len); wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID); memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN); @@ -1406,7 +1406,7 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, if (likely(act)) { scbval.val = reason_code; memcpy(&scbval.ea, &wl->bssid, ETH_ALEN); - scbval.val = htod32(scbval.val); + scbval.val = cpu_to_le32(scbval.val); err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t)); if (unlikely(err)) { @@ -1448,7 +1448,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, } /* Make sure radio is off or on as far as software is concerned */ disable = WL_RADIO_SW_DISABLE << 16; - disable = htod32(disable); + disable = cpu_to_le32(disable); err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable)); if (unlikely(err)) { WL_ERR("WLC_SET_RADIO error (%d)\n", err); @@ -1506,11 +1506,11 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, WL_ERR("WLC_GET_WSEC error (%d)\n", err); return err; } - wsec = dtoh32(wsec); + wsec = le32_to_cpu(wsec); if (wsec & WEP_ENABLED) { /* Just select a new current key */ index = (u32) key_idx; - index = htod32(index); + index = cpu_to_le32(index); err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, &index, sizeof(index)); if (unlikely(err)) { @@ -1683,7 +1683,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, } val = 1; /* assume shared key. otherwise 0 */ - val = htod32(val); + val = cpu_to_le32(val); err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); if (unlikely(err)) { WL_ERR("WLC_SET_AUTH error (%d)\n", err); @@ -1739,7 +1739,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, } val = 0; /* assume open key. otherwise 1 */ - val = htod32(val); + val = cpu_to_le32(val); err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); if (unlikely(err)) { WL_ERR("WLC_SET_AUTH error (%d)\n", err); @@ -1775,7 +1775,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, WL_ERR("WLC_GET_WSEC error (%d)\n", err); return err; } - wsec = dtoh32(wsec); + wsec = le32_to_cpu(wsec); switch (wsec) { case WEP_ENABLED: sec = wl_read_prof(wl, WL_PROF_SEC); @@ -1835,7 +1835,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, if (err) { WL_ERR("Could not get rate (%d)\n", err); } else { - rate = dtoh32(rate); + rate = le32_to_cpu(rate); sinfo->filled |= STATION_INFO_TX_BITRATE; sinfo->txrate.legacy = rate * 5; WL_DBG("Rate %d Mbps\n", rate / 2); @@ -1849,7 +1849,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, WL_ERR("Could not get rssi (%d)\n", err); return err; } - rssi = dtoh32(scb_val.val); + rssi = le32_to_cpu(scb_val.val); sinfo->filled |= STATION_INFO_SIGNAL; sinfo->signal = rssi; WL_DBG("RSSI %d dBm\n", rssi); @@ -1867,7 +1867,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, CHECK_SYS_UP(); pm = enabled ? PM_FAST : PM_OFF; - pm = htod32(pm); + pm = cpu_to_le32(pm); WL_DBG("power save %s\n", (pm ? "enabled" : "disabled")); err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)); if (unlikely(err)) { @@ -1930,7 +1930,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, return err; } - rateset.count = dtoh32(rateset.count); + rateset.count = le32_to_cpu(rateset.count); legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy); if (!legacy) @@ -2263,7 +2263,7 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi) u32 freq; s32 err = 0; - if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) { + if (unlikely(le32_to_cpu(bi->length) > WL_BSS_INFO_MAX)) { WL_DBG("Beacon is larger than buffer. Discarding\n"); return err; } @@ -2536,10 +2536,10 @@ static void wl_ch_to_chanspec(int ch, struct wl_join_params *join_params, join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; join_params->params.chanspec_list[0] |= chanspec; join_params->params.chanspec_list[0] = - htodchanspec(join_params->params.chanspec_list[0]); + cpu_to_le16(join_params->params.chanspec_list[0]); join_params->params.chanspec_num = - htod32(join_params->params.chanspec_num); + cpu_to_le32(join_params->params.chanspec_num); WL_DBG("join_params->params.chanspec_list[0]= %#X, channel %d, chanspec %#X\n", join_params->params.chanspec_list[0], ch, chanspec); @@ -2570,7 +2570,7 @@ static s32 wl_update_bss_info(struct wl_priv *wl) rtnl_lock(); if (unlikely(!bss)) { WL_DBG("Could not find the AP\n"); - *(u32 *) wl->extra_buf = htod32(WL_EXTRA_BUF_MAX); + *(u32 *) wl->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_BSS_INFO, wl->extra_buf, WL_EXTRA_BUF_MAX); if (unlikely(err)) { @@ -2722,7 +2722,7 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, WL_ERR("scan busy (%d)\n", err); goto scan_done_out; } - channel_inform.scan_channel = dtoh32(channel_inform.scan_channel); + channel_inform.scan_channel = le32_to_cpu(channel_inform.scan_channel); if (unlikely(channel_inform.scan_channel)) { WL_DBG("channel_inform.scan_channel (%d)\n", @@ -2731,16 +2731,16 @@ wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, wl->bss_list = wl->scan_results; bss_list = wl->bss_list; memset(bss_list, 0, len); - bss_list->buflen = htod32(len); + bss_list->buflen = cpu_to_le32(len); err = wl_dev_ioctl(ndev, WLC_SCAN_RESULTS, bss_list, len); if (unlikely(err)) { WL_ERR("%s Scan_results error (%d)\n", ndev->name, err); err = -EINVAL; goto scan_done_out; } - bss_list->buflen = dtoh32(bss_list->buflen); - bss_list->version = dtoh32(bss_list->version); - bss_list->count = dtoh32(bss_list->count); + bss_list->buflen = le32_to_cpu(bss_list->buflen); + bss_list->version = le32_to_cpu(bss_list->version); + bss_list->count = le32_to_cpu(bss_list->count); err = wl_inform_bss(wl); if (err) @@ -2949,7 +2949,7 @@ wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status, results->count = 0; memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WL_ISCAN_BUF_MAX); + list.results.buflen = cpu_to_le32(WL_ISCAN_BUF_MAX); err = wl_dev_iovar_getbuf(iscan->dev, "iscanresults", &list, WL_ISCAN_RESULTS_FIXED_SIZE, iscan->scan_buf, WL_ISCAN_BUF_MAX); @@ -2957,12 +2957,12 @@ wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status, WL_ERR("error (%d)\n", err); return err; } - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - results->count = dtoh32(results->count); + results->buflen = le32_to_cpu(results->buflen); + results->version = le32_to_cpu(results->version); + results->count = le32_to_cpu(results->count); WL_DBG("results->count = %d\n", results->count); WL_DBG("results->buflen = %d\n", results->buflen); - *status = dtoh32(list_buf->status); + *status = le32_to_cpu(list_buf->status); *bss_list = results; return err; @@ -3392,8 +3392,8 @@ static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype) WL_ERR("invalid type (%d)\n", iftype); return err; } - infra = htod32(infra); - ap = htod32(ap); + infra = cpu_to_le32(infra); + ap = cpu_to_le32(ap); WL_DBG("%s ap (%d), infra (%d)\n", ndev->name, ap, infra); err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra)); if (unlikely(err)) { @@ -3655,26 +3655,28 @@ static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode) pkt_filterp = (struct wl_pkt_filter *)(buf + str_len + 1); /* Parse packet filter id. */ - pkt_filter.id = htod32(100); + pkt_filter.id = cpu_to_le32(100); /* Parse filter polarity. */ - pkt_filter.negate_match = htod32(0); + pkt_filter.negate_match = cpu_to_le32(0); /* Parse filter type. */ - pkt_filter.type = htod32(0); + pkt_filter.type = cpu_to_le32(0); /* Parse pattern filter offset. */ - pkt_filter.u.pattern.offset = htod32(0); + pkt_filter.u.pattern.offset = cpu_to_le32(0); /* Parse pattern filter mask. */ - mask_size = htod32(wl_pattern_atoh("0xff", - (char *)pkt_filterp->u.pattern. - mask_and_pattern)); + mask_size = cpu_to_le32(wl_pattern_atoh("0xff", + (char *)pkt_filterp->u.pattern. + mask_and_pattern)); /* Parse pattern filter pattern. */ - pattern_size = htod32(wl_pattern_atoh("0x00", - (char *)&pkt_filterp->u.pattern. - mask_and_pattern[mask_size])); + pattern_size = cpu_to_le32(wl_pattern_atoh("0x00", + (char *)&pkt_filterp->u. + pattern. + mask_and_pattern + [mask_size])); if (mask_size != pattern_size) { WL_ERR("Mask and pattern not the same size\n"); diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h index b7e2e59..5112160 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h @@ -28,23 +28,6 @@ struct wl_priv; struct wl_security; struct wl_ibss; -#if defined(IL_BIGENDIAN) -#include <bcmendian.h> -#define htod32(i) (bcmswap32(i)) -#define htod16(i) (bcmswap16(i)) -#define dtoh32(i) (bcmswap32(i)) -#define dtoh16(i) (bcmswap16(i)) -#define htodchanspec(i) htod16(i) -#define dtohchanspec(i) dtoh16(i) -#else -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i -#endif - #define WL_DBG_NONE 0 #define WL_DBG_DBG (1 << 2) #define WL_DBG_INFO (1 << 1) @@ -365,7 +348,8 @@ static inline struct wl_bss_info *next_bss(struct wl_scan_results *list, { return bss = bss ? (struct wl_bss_info *)((unsigned long)bss + - dtoh32(bss->length)) : list->bss_info; + le32_to_cpu(bss->length)) : + list->bss_info; } #define for_each_bss(list, bss, __i) \ diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c index eb31c74..0e4b132 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c @@ -70,23 +70,6 @@ uint wl_msg_level = WL_ERROR_VAL; #define MAX_WLIW_IOCTL_LEN 1024 -#if defined(IL_BIGENDIAN) -#include <bcmendian.h> -#define htod32(i) (bcmswap32(i)) -#define htod16(i) (bcmswap16(i)) -#define dtoh32(i) (bcmswap32(i)) -#define dtoh16(i) (bcmswap16(i)) -#define htodchanspec(i) htod16(i) -#define dtohchanspec(i) dtoh16(i) -#else -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i -#endif - #ifdef CONFIG_WIRELESS_EXT extern struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev); @@ -159,24 +142,24 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, static void swap_key_from_BE(wl_wsec_key_t *key) { - key->index = htod32(key->index); - key->len = htod32(key->len); - key->algo = htod32(key->algo); - key->flags = htod32(key->flags); - key->rxiv.hi = htod32(key->rxiv.hi); - key->rxiv.lo = htod16(key->rxiv.lo); - key->iv_initialized = htod32(key->iv_initialized); + key->index = cpu_to_le32(key->index); + key->len = cpu_to_le32(key->len); + key->algo = cpu_to_le32(key->algo); + key->flags = cpu_to_le32(key->flags); + key->rxiv.hi = cpu_to_le32(key->rxiv.hi); + key->rxiv.lo = cpu_to_le16(key->rxiv.lo); + key->iv_initialized = cpu_to_le32(key->iv_initialized); } static void swap_key_to_BE(wl_wsec_key_t *key) { - key->index = dtoh32(key->index); - key->len = dtoh32(key->len); - key->algo = dtoh32(key->algo); - key->flags = dtoh32(key->flags); - key->rxiv.hi = dtoh32(key->rxiv.hi); - key->rxiv.lo = dtoh16(key->rxiv.lo); - key->iv_initialized = dtoh32(key->iv_initialized); + key->index = le32_to_cpu(key->index); + key->len = le32_to_cpu(key->len); + key->algo = le32_to_cpu(key->algo); + key->flags = le32_to_cpu(key->flags); + key->rxiv.hi = le32_to_cpu(key->rxiv.hi); + key->rxiv.lo = le16_to_cpu(key->rxiv.lo); + key->iv_initialized = le32_to_cpu(key->iv_initialized); } static int dev_wlc_ioctl(struct net_device *dev, int cmd, void *arg, int len) @@ -224,7 +207,7 @@ static int dev_wlc_intvar_set(struct net_device *dev, char *name, int val) char buf[WLC_IOCTL_SMLEN]; uint len; - val = htod32(val); + val = cpu_to_le32(val); len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf)); ASSERT(len); @@ -311,7 +294,7 @@ static int dev_wlc_intvar_get(struct net_device *dev, char *name, int *retval) ASSERT(len); error = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)&var, len); - *retval = dtoh32(var.val); + *retval = le32_to_cpu(var.val); return error; } @@ -341,7 +324,7 @@ wl_iw_config_commit(struct net_device *dev, if (error) return error; - ssid.SSID_len = dtoh32(ssid.SSID_len); + ssid.SSID_len = le32_to_cpu(ssid.SSID_len); if (!ssid.SSID_len) return 0; @@ -393,7 +376,7 @@ wl_iw_set_freq(struct net_device *dev, chan = wf_mhz2channel(fwrq->m, sf); } - chan = htod32(chan); + chan = cpu_to_le32(chan); error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan)); if (error) @@ -416,8 +399,8 @@ wl_iw_get_freq(struct net_device *dev, if (error) return error; - fwrq->m = dtoh32(ci.hw_channel); - fwrq->e = dtoh32(0); + fwrq->m = le32_to_cpu(ci.hw_channel); + fwrq->e = le32_to_cpu(0); return 0; } @@ -442,8 +425,8 @@ wl_iw_set_mode(struct net_device *dev, default: return -EINVAL; } - infra = htod32(infra); - ap = htod32(ap); + infra = cpu_to_le32(infra); + ap = cpu_to_le32(ap); error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra)); if (error) @@ -472,8 +455,8 @@ wl_iw_get_mode(struct net_device *dev, if (error) return error; - infra = dtoh32(infra); - ap = dtoh32(ap); + infra = le32_to_cpu(infra); + ap = le32_to_cpu(ap); *uwrq = infra ? ap ? IW_MODE_MASTER : IW_MODE_INFRA : IW_MODE_ADHOC; return 0; @@ -518,17 +501,18 @@ wl_iw_get_range(struct net_device *dev, range->min_nwid = range->max_nwid = 0; - list->count = htod32(MAXCHANNEL); + list->count = cpu_to_le32(MAXCHANNEL); error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels, (MAXCHANNEL + 1) * 4); if (error) { kfree(channels); return error; } - for (i = 0; i < dtoh32(list->count) && i < IW_MAX_FREQUENCIES; i++) { - range->freq[i].i = dtoh32(list->element[i]); + for (i = 0; i < le32_to_cpu(list->count) && i < IW_MAX_FREQUENCIES; + i++) { + range->freq[i].i = le32_to_cpu(list->element[i]); - ch = dtoh32(list->element[i]); + ch = le32_to_cpu(list->element[i]); if (ch <= CH_MAX_2G_CHANNEL) { range->freq[i].m = ieee80211_dsss_chan_to_freq(ch); } else { @@ -556,7 +540,7 @@ wl_iw_get_range(struct net_device *dev, kfree(channels); return error; } - rateset.count = dtoh32(rateset.count); + rateset.count = le32_to_cpu(rateset.count); range->num_bitrates = rateset.count; for (i = 0; i < rateset.count && i < IW_MAX_BITRATES; i++) range->bitrate[i] = (rateset.rates[i] & 0x7f) * 500000; @@ -568,7 +552,7 @@ wl_iw_get_range(struct net_device *dev, dev_wlc_intvar_get(dev, "sgi_tx", &sgi_tx); dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(channel_info_t)); - ci.hw_channel = dtoh32(ci.hw_channel); + ci.hw_channel = le32_to_cpu(ci.hw_channel); if (bw_cap == 0 || (bw_cap == 2 && ci.hw_channel <= 14)) { if (sgi_tx == 0) @@ -594,7 +578,7 @@ wl_iw_get_range(struct net_device *dev, kfree(channels); return error; } - i = dtoh32(i); + i = le32_to_cpu(i); if (i == WLC_PHY_TYPE_A) range->throughput = 24000000; else @@ -746,10 +730,10 @@ wl_iw_ch_to_chanspec(int ch, wl_join_params_t *join_params, join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; join_params->params.chanspec_list[0] |= chanspec; join_params->params.chanspec_list[0] = - htodchanspec(join_params->params.chanspec_list[0]); + cpu_to_le16(join_params->params.chanspec_list[0]); join_params->params.chanspec_num = - htod32(join_params->params.chanspec_num); + cpu_to_le32(join_params->params.chanspec_num); WL_TRACE("%s join_params->params.chanspec_list[0]= %X\n", __func__, join_params->params.chanspec_list[0]); @@ -785,7 +769,7 @@ wl_iw_set_wap(struct net_device *dev, join_params_size = sizeof(join_params.ssid); memcpy(join_params.ssid.SSID, g_ssid.SSID, g_ssid.SSID_len); - join_params.ssid.SSID_len = htod32(g_ssid.SSID_len); + join_params.ssid.SSID_len = cpu_to_le32(g_ssid.SSID_len); memcpy(&join_params.params.bssid, awrq->sa_data, ETH_ALEN); WL_TRACE("%s target_channel=%d\n", @@ -844,12 +828,12 @@ wl_iw_mlme(struct net_device *dev, memcpy(&scbval.ea, &mlme->addr.sa_data, ETH_ALEN); if (mlme->cmd == IW_MLME_DISASSOC) { - scbval.val = htod32(scbval.val); + scbval.val = cpu_to_le32(scbval.val); error = dev_wlc_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t)); } else if (mlme->cmd == IW_MLME_DEAUTH) { - scbval.val = htod32(scbval.val); + scbval.val = cpu_to_le32(scbval.val); error = dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval, sizeof(scb_val_t)); @@ -884,16 +868,16 @@ wl_iw_get_aplist(struct net_device *dev, if (!list) return -ENOMEM; memset(list, 0, buflen); - list->buflen = htod32(buflen); + list->buflen = cpu_to_le32(buflen); error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, buflen); if (error) { WL_ERROR("%d: Scan results error %d\n", __LINE__, error); kfree(list); return error; } - list->buflen = dtoh32(list->buflen); - list->version = dtoh32(list->version); - list->count = dtoh32(list->count); + list->buflen = le32_to_cpu(list->buflen); + list->version = le32_to_cpu(list->version); + list->count = le32_to_cpu(list->count); if (list->version != WL_BSS_INFO_VERSION) { WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", __func__, list->version); @@ -904,18 +888,18 @@ wl_iw_get_aplist(struct net_device *dev, for (i = 0, dwrq->length = 0; i < list->count && dwrq->length < IW_MAX_AP; i++) { bi = bi ? (wl_bss_info_t *) ((unsigned long)bi + - dtoh32(bi->length)) : list-> + le32_to_cpu(bi->length)) : list-> bss_info; - ASSERT(((unsigned long)bi + dtoh32(bi->length)) <= + ASSERT(((unsigned long)bi + le32_to_cpu(bi->length)) <= ((unsigned long)list + buflen)); - if (!(dtoh16(bi->capability) & WLAN_CAPABILITY_ESS)) + if (!(le16_to_cpu(bi->capability) & WLAN_CAPABILITY_ESS)) continue; memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETH_ALEN); addr[dwrq->length].sa_family = ARPHRD_ETHER; - qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI)); - qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI); + qual[dwrq->length].qual = rssi_to_qual(le16_to_cpu(bi->RSSI)); + qual[dwrq->length].level = 0x100 + le16_to_cpu(bi->RSSI); qual[dwrq->length].noise = 0x100 + bi->phy_noise; #if WIRELESS_EXT > 18 @@ -976,20 +960,22 @@ wl_iw_iscan_get_aplist(struct net_device *dev, for (i = 0, dwrq->length = 0; i < list->count && dwrq->length < IW_MAX_AP; i++) { bi = bi ? (wl_bss_info_t *) ((unsigned long)bi + - dtoh32(bi->length)) : + le32_to_cpu(bi->length)) : list->bss_info; - ASSERT(((unsigned long)bi + dtoh32(bi->length)) <= + ASSERT(((unsigned long)bi + le32_to_cpu(bi->length)) <= ((unsigned long)list + WLC_IW_ISCAN_MAXLEN)); - if (!(dtoh16(bi->capability) & WLAN_CAPABILITY_ESS)) + if (!(le16_to_cpu(bi->capability) & + WLAN_CAPABILITY_ESS)) continue; memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETH_ALEN); addr[dwrq->length].sa_family = ARPHRD_ETHER; qual[dwrq->length].qual = - rssi_to_qual(dtoh16(bi->RSSI)); - qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI); + rssi_to_qual(le16_to_cpu(bi->RSSI)); + qual[dwrq->length].level = 0x100 + + le16_to_cpu(bi->RSSI); qual[dwrq->length].noise = 0x100 + bi->phy_noise; #if WIRELESS_EXT > 18 @@ -1025,10 +1011,10 @@ static int wl_iw_iscan_prep(wl_scan_params_t *params, wlc_ssid_t *ssid) params->home_time = -1; params->channel_num = 0; - params->nprobes = htod32(params->nprobes); - params->active_time = htod32(params->active_time); - params->passive_time = htod32(params->passive_time); - params->home_time = htod32(params->home_time); + params->nprobes = cpu_to_le32(params->nprobes); + params->active_time = cpu_to_le32(params->active_time); + params->passive_time = cpu_to_le32(params->passive_time); + params->home_time = cpu_to_le32(params->home_time); if (ssid && ssid->SSID_len) memcpy(¶ms->ssid, ssid, sizeof(wlc_ssid_t)); @@ -1039,9 +1025,9 @@ static int wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, u16 action) { int err = 0; - iscan->iscan_ex_params_p->version = htod32(ISCAN_REQ_VERSION); - iscan->iscan_ex_params_p->action = htod16(action); - iscan->iscan_ex_params_p->scan_duration = htod16(0); + iscan->iscan_ex_params_p->version = cpu_to_le32(ISCAN_REQ_VERSION); + iscan->iscan_ex_params_p->action = cpu_to_le16(action); + iscan->iscan_ex_params_p->scan_duration = cpu_to_le16(0); WL_SCAN("%s : nprobes=%d\n", __func__, iscan->iscan_ex_params_p->params.nprobes); @@ -1125,19 +1111,19 @@ static u32 wl_iw_iscan_get(iscan_info_t *iscan) results->count = 0; memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN); + list.results.buflen = cpu_to_le32(WLC_IW_ISCAN_MAXLEN); res = dev_iw_iovar_getbuf(iscan->dev, "iscanresults", &list, WL_ISCAN_RESULTS_FIXED_SIZE, buf->iscan_buf, WLC_IW_ISCAN_MAXLEN); if (res == 0) { - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - results->count = dtoh32(results->count); + results->buflen = le32_to_cpu(results->buflen); + results->version = le32_to_cpu(results->version); + results->count = le32_to_cpu(results->count); WL_TRACE("results->count = %d\n", results->count); WL_TRACE("results->buflen = %d\n", results->buflen); - status = dtoh32(list_buf->status); + status = le32_to_cpu(list_buf->status); } else { WL_ERROR("%s returns error %d\n", __func__, res); status = WL_SCAN_RESULTS_NO_MEM; @@ -1284,7 +1270,7 @@ wl_iw_set_scan(struct net_device *dev, memcpy(g_specific_ssid.SSID, req->essid, g_specific_ssid.SSID_len); g_specific_ssid.SSID_len = - htod32(g_specific_ssid.SSID_len); + cpu_to_le32(g_specific_ssid.SSID_len); g_scan_specified_ssid = 1; WL_TRACE("### Specific scan ssid=%s len=%d\n", g_specific_ssid.SSID, @@ -1380,7 +1366,7 @@ wl_iw_iscan_set_scan(struct net_device *dev, ssid.SSID_len = min_t(size_t, sizeof(ssid.SSID), req->essid_len); memcpy(ssid.SSID, req->essid, ssid.SSID_len); - ssid.SSID_len = htod32(ssid.SSID_len); + ssid.SSID_len = cpu_to_le32(ssid.SSID_len); } else { g_scan_specified_ssid = 0; @@ -1506,7 +1492,7 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, } bi = bi ? (wl_bss_info_t *)((unsigned long)bi + - dtoh32(bi->length)) : list-> + le32_to_cpu(bi->length)) : list-> bss_info; WL_TRACE("%s : %s\n", __func__, bi->SSID); @@ -1517,15 +1503,15 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN); - iwe.u.data.length = dtoh32(bi->SSID_len); + iwe.u.data.length = le32_to_cpu(bi->SSID_len); iwe.cmd = SIOCGIWESSID; iwe.u.data.flags = 1; event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID); - if (dtoh16(bi->capability) & (WLAN_CAPABILITY_ESS | + if (le16_to_cpu(bi->capability) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { iwe.cmd = SIOCGIWMODE; - if (dtoh16(bi->capability) & WLAN_CAPABILITY_ESS) + if (le16_to_cpu(bi->capability) & WLAN_CAPABILITY_ESS) iwe.u.mode = IW_MODE_INFRA; else iwe.u.mode = IW_MODE_ADHOC; @@ -1550,8 +1536,8 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, IW_EV_FREQ_LEN); iwe.cmd = IWEVQUAL; - iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI)); - iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI); + iwe.u.qual.qual = rssi_to_qual(le16_to_cpu(bi->RSSI)); + iwe.u.qual.level = 0x100 + le16_to_cpu(bi->RSSI); iwe.u.qual.noise = 0x100 + bi->phy_noise; event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, @@ -1560,7 +1546,7 @@ wl_iw_get_scan_prep(wl_scan_results_t *list, wl_iw_handle_scanresults_ies(&event, end, info, bi); iwe.cmd = SIOCGIWENCODE; - if (dtoh16(bi->capability) & WLAN_CAPABILITY_PRIVACY) + if (le16_to_cpu(bi->capability) & WLAN_CAPABILITY_PRIVACY) iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; else iwe.u.data.flags = IW_ENCODE_DISABLED; @@ -1627,7 +1613,7 @@ wl_iw_get_scan(struct net_device *dev, error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)); if (error) return error; - ci.scan_channel = dtoh32(ci.scan_channel); + ci.scan_channel = le32_to_cpu(ci.scan_channel); if (ci.scan_channel) return -EAGAIN; @@ -1642,7 +1628,7 @@ wl_iw_get_scan(struct net_device *dev, } memset(list, 0, len); - list->buflen = htod32(len); + list->buflen = cpu_to_le32(len); error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len); if (error) { WL_ERROR("%s: %s : Scan_results ERROR %d\n", @@ -1654,9 +1640,9 @@ wl_iw_get_scan(struct net_device *dev, } return 0; } - list->buflen = dtoh32(list->buflen); - list->version = dtoh32(list->version); - list->count = dtoh32(list->count); + list->buflen = le32_to_cpu(list->buflen); + list->version = le32_to_cpu(list->version); + list->count = le32_to_cpu(list->count); if (list->version != WL_BSS_INFO_VERSION) { WL_ERROR("%s : list->version %d != WL_BSS_INFO_VERSION\n", @@ -1776,9 +1762,9 @@ wl_iw_iscan_get_scan(struct net_device *dev, for (ii = 0; ii < list->count && apcnt < IW_MAX_AP; apcnt++, ii++) { bi = bi ? (wl_bss_info_t *)((unsigned long)bi + - dtoh32(bi->length)) : + le32_to_cpu(bi->length)) : list->bss_info; - ASSERT(((unsigned long)bi + dtoh32(bi->length)) <= + ASSERT(((unsigned long)bi + le32_to_cpu(bi->length)) <= ((unsigned long)list + WLC_IW_ISCAN_MAXLEN)); if (event + ETH_ALEN + bi->SSID_len + @@ -1793,17 +1779,17 @@ wl_iw_iscan_get_scan(struct net_device *dev, IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN); - iwe.u.data.length = dtoh32(bi->SSID_len); + iwe.u.data.length = le32_to_cpu(bi->SSID_len); iwe.cmd = SIOCGIWESSID; iwe.u.data.flags = 1; event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID); - if (dtoh16(bi->capability) & + if (le16_to_cpu(bi->capability) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { iwe.cmd = SIOCGIWMODE; - if (dtoh16(bi->capability) & + if (le16_to_cpu(bi->capability) & WLAN_CAPABILITY_ESS) iwe.u.mode = IW_MODE_INFRA; else @@ -1832,8 +1818,8 @@ wl_iw_iscan_get_scan(struct net_device *dev, IW_EV_FREQ_LEN); iwe.cmd = IWEVQUAL; - iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI)); - iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI); + iwe.u.qual.qual = rssi_to_qual(le16_to_cpu(bi->RSSI)); + iwe.u.qual.level = 0x100 + le16_to_cpu(bi->RSSI); iwe.u.qual.noise = 0x100 + bi->phy_noise; event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, @@ -1842,7 +1828,8 @@ wl_iw_iscan_get_scan(struct net_device *dev, wl_iw_handle_scanresults_ies(&event, end, info, bi); iwe.cmd = SIOCGIWENCODE; - if (dtoh16(bi->capability) & WLAN_CAPABILITY_PRIVACY) + if (le16_to_cpu(bi->capability) & + WLAN_CAPABILITY_PRIVACY) iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; else @@ -1922,13 +1909,13 @@ wl_iw_set_essid(struct net_device *dev, } else { g_ssid.SSID_len = 0; } - g_ssid.SSID_len = htod32(g_ssid.SSID_len); + g_ssid.SSID_len = cpu_to_le32(g_ssid.SSID_len); memset(&join_params, 0, sizeof(join_params)); join_params_size = sizeof(join_params.ssid); memcpy(&join_params.ssid.SSID, g_ssid.SSID, g_ssid.SSID_len); - join_params.ssid.SSID_len = htod32(g_ssid.SSID_len); + join_params.ssid.SSID_len = cpu_to_le32(g_ssid.SSID_len); memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN); wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, @@ -1965,7 +1952,7 @@ wl_iw_get_essid(struct net_device *dev, return error; } - ssid.SSID_len = dtoh32(ssid.SSID_len); + ssid.SSID_len = le32_to_cpu(ssid.SSID_len); memcpy(extra, ssid.SSID, ssid.SSID_len); @@ -2027,7 +2014,7 @@ wl_iw_set_rate(struct net_device *dev, if (error) return error; - rateset.count = dtoh32(rateset.count); + rateset.count = le32_to_cpu(rateset.count); if (vwrq->value < 0) rate = rateset.rates[rateset.count - 1] & 0x7f; @@ -2052,7 +2039,7 @@ wl_iw_set_rate(struct net_device *dev, for (i = 0; i < rateset.count; i++) if ((rateset.rates[i] & 0x7f) > rate) break; - rateset.count = htod32(i); + rateset.count = cpu_to_le32(i); error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset, sizeof(rateset)); @@ -2074,7 +2061,7 @@ wl_iw_get_rate(struct net_device *dev, error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)); if (error) return error; - rate = dtoh32(rate); + rate = le32_to_cpu(rate); vwrq->value = rate * 500000; return 0; @@ -2174,7 +2161,7 @@ wl_iw_set_txpow(struct net_device *dev, disable = vwrq->disabled ? WL_RADIO_SW_DISABLE : 0; disable += WL_RADIO_SW_DISABLE << 16; - disable = htod32(disable); + disable = cpu_to_le32(disable); error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable)); if (error) return error; @@ -2216,7 +2203,7 @@ wl_iw_get_txpow(struct net_device *dev, if (error) return error; - disable = dtoh32(disable); + disable = le32_to_cpu(disable); result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE); vwrq->value = (s32) bcm_qdbm_to_mw(result); vwrq->fixed = 0; @@ -2251,7 +2238,7 @@ wl_iw_set_retry(struct net_device *dev, if ((vwrq->flags & IW_RETRY_MAX) || !(vwrq->flags & IW_RETRY_MIN)) { #endif - lrl = htod32(vwrq->value); + lrl = cpu_to_le32(vwrq->value); error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(lrl)); if (error) @@ -2266,7 +2253,7 @@ wl_iw_set_retry(struct net_device *dev, if ((vwrq->flags & IW_RETRY_MIN) || !(vwrq->flags & IW_RETRY_MAX)) { #endif - srl = htod32(vwrq->value); + srl = cpu_to_le32(vwrq->value); error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl, sizeof(srl)); if (error) @@ -2298,8 +2285,8 @@ wl_iw_get_retry(struct net_device *dev, if (error) return error; - lrl = dtoh32(lrl); - srl = dtoh32(srl); + lrl = le32_to_cpu(lrl); + srl = le32_to_cpu(srl); if (vwrq->flags & IW_RETRY_MAX) { vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; @@ -2330,12 +2317,12 @@ wl_iw_set_encode(struct net_device *dev, if ((dwrq->flags & IW_ENCODE_INDEX) == 0) { for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; key.index++) { - val = htod32(key.index); + val = cpu_to_le32(key.index); error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val)); if (error) return error; - val = dtoh32(val); + val = le32_to_cpu(val); if (val) break; } @@ -2348,7 +2335,7 @@ wl_iw_set_encode(struct net_device *dev, } if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) { - val = htod32(key.index); + val = cpu_to_le32(key.index); error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val, sizeof(val)); if (error) @@ -2399,7 +2386,7 @@ wl_iw_set_encode(struct net_device *dev, return error; val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0; - val = htod32(val); + val = cpu_to_le32(val); error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); if (error) return error; @@ -2427,7 +2414,7 @@ wl_iw_get_encode(struct net_device *dev, sizeof(val)); if (error) return error; - val = dtoh32(val); + val = le32_to_cpu(val); if (val) break; } @@ -2447,8 +2434,8 @@ wl_iw_get_encode(struct net_device *dev, swap_key_to_BE(&key); - wsec = dtoh32(wsec); - auth = dtoh32(auth); + wsec = le32_to_cpu(wsec); + auth = le32_to_cpu(auth); dwrq->length = min_t(u16, DOT11_MAX_KEY_SIZE, key.len); dwrq->flags = key.index + 1; @@ -2475,7 +2462,7 @@ wl_iw_set_power(struct net_device *dev, pm = vwrq->disabled ? PM_OFF : PM_MAX; - pm = htod32(pm); + pm = cpu_to_le32(pm); error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)); if (error) return error; @@ -2496,7 +2483,7 @@ wl_iw_get_power(struct net_device *dev, if (error) return error; - pm = dtoh32(pm); + pm = le32_to_cpu(pm); vwrq->disabled = pm ? 0 : 1; vwrq->flags = IW_POWER_ALL_R; @@ -2561,7 +2548,7 @@ wl_iw_set_encodeext(struct net_device *dev, if (iwe->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { WL_WSEC("Changing the the primary Key to %d\n", key.index); - key.index = htod32(key.index); + key.index = cpu_to_le32(key.index); error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &key.index, sizeof(key.index)); if (error) @@ -3579,7 +3566,7 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) if (res) goto done; - phy_noise = dtoh32(phy_noise); + phy_noise = le32_to_cpu(phy_noise); WL_TRACE("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise); memset(&scb_val, 0, sizeof(scb_val_t)); @@ -3587,7 +3574,7 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) if (res) goto done; - rssi = dtoh32(scb_val.val); + rssi = le32_to_cpu(scb_val.val); WL_TRACE("wl_iw_get_wireless_stats rssi=%d\n", rssi); if (rssi <= WL_IW_RSSI_NO_SIGNAL) wstats->qual.qual = 0; @@ -3624,7 +3611,7 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) goto done; } - cnt.version = dtoh16(cnt.version); + cnt.version = le16_to_cpu(cnt.version); if (cnt.version != WL_CNT_T_VERSION) { WL_TRACE("\tIncorrect counter version: expected %d; got %d\n", WL_CNT_T_VERSION, cnt.version); @@ -3632,28 +3619,29 @@ wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) } wstats->discard.nwid = 0; - wstats->discard.code = dtoh32(cnt.rxundec); - wstats->discard.fragment = dtoh32(cnt.rxfragerr); - wstats->discard.retries = dtoh32(cnt.txfail); - wstats->discard.misc = dtoh32(cnt.rxrunt) + dtoh32(cnt.rxgiant); + wstats->discard.code = le32_to_cpu(cnt.rxundec); + wstats->discard.fragment = le32_to_cpu(cnt.rxfragerr); + wstats->discard.retries = le32_to_cpu(cnt.txfail); + wstats->discard.misc = le32_to_cpu(cnt.rxrunt) + + le32_to_cpu(cnt.rxgiant); wstats->miss.beacon = 0; WL_TRACE("wl_iw_get_wireless_stats counters txframe=%d txbyte=%d\n", - dtoh32(cnt.txframe), dtoh32(cnt.txbyte)); + le32_to_cpu(cnt.txframe), le32_to_cpu(cnt.txbyte)); WL_TRACE("wl_iw_get_wireless_stats counters rxfrmtoolong=%d\n", - dtoh32(cnt.rxfrmtoolong)); + le32_to_cpu(cnt.rxfrmtoolong)); WL_TRACE("wl_iw_get_wireless_stats counters rxbadplcp=%d\n", - dtoh32(cnt.rxbadplcp)); + le32_to_cpu(cnt.rxbadplcp)); WL_TRACE("wl_iw_get_wireless_stats counters rxundec=%d\n", - dtoh32(cnt.rxundec)); + le32_to_cpu(cnt.rxundec)); WL_TRACE("wl_iw_get_wireless_stats counters rxfragerr=%d\n", - dtoh32(cnt.rxfragerr)); + le32_to_cpu(cnt.rxfragerr)); WL_TRACE("wl_iw_get_wireless_stats counters txfail=%d\n", - dtoh32(cnt.txfail)); + le32_to_cpu(cnt.txfail)); WL_TRACE("wl_iw_get_wireless_stats counters rxrunt=%d\n", - dtoh32(cnt.rxrunt)); + le32_to_cpu(cnt.rxrunt)); WL_TRACE("wl_iw_get_wireless_stats counters rxgiant=%d\n", - dtoh32(cnt.rxgiant)); + le32_to_cpu(cnt.rxgiant)); #endif /* WIRELESS_EXT > 11 */ done: -- 1.7.4.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel