Skip to content

Commit

Permalink
staging: brcm80211: Convert ETHER_ADDR_LEN to ETH_ALEN
Browse files Browse the repository at this point in the history
Add an #include of <linux/if_ether.h> to include/proto/ethernet.h
Convert ETHER_ADDR_LEN, remove the #define for ETHER_ADDR_LEN.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Joe Perches authored and Greg Kroah-Hartman committed Dec 16, 2010
1 parent ed95686 commit b8d6307
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 88 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ int dhd_prot_init(dhd_pub_t *dhd)
dhd_os_proto_unblock(dhd);
return ret;
}
memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN);
memcpy(dhd->mac.octet, buf, ETH_ALEN);

dhd_os_proto_unblock(dhd);

Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/brcm80211/brcmfmac/dhd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,15 +1256,15 @@ int dhd_preinit_ioctls(dhd_pub_t *dhd)
*/
ret = dhd_custom_get_mac_address(ea_addr.octet);
if (!ret) {
bcm_mkiovar("cur_etheraddr", (void *)&ea_addr, ETHER_ADDR_LEN,
bcm_mkiovar("cur_etheraddr", (void *)&ea_addr, ETH_ALEN,
buf, sizeof(buf));
ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf));
if (ret < 0) {
DHD_ERROR(("%s: can't set MAC address , error=%d\n",
__func__, ret));
} else
memcpy(dhd->mac.octet, (void *)&ea_addr,
ETHER_ADDR_LEN);
ETH_ALEN);
}
#endif /* GET_CUSTOM_MAC_ENABLE */

Expand Down Expand Up @@ -1534,7 +1534,7 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
break;

if (!memcmp
(bi->BSSID.octet, addr, ETHER_ADDR_LEN)) {
(bi->BSSID.octet, addr, ETH_ALEN)) {
DHD_ISCAN(("%s: Del BSS[%2.2d:%2.2d] "
"%X:%X:%X:%X:%X:%X\n",
__func__, l, i, bi->BSSID.octet[0],
Expand Down Expand Up @@ -1672,7 +1672,7 @@ int dhd_iscan_request(void *dhdp, u16 action)
char buf[WLC_IOCTL_SMLEN];

memset(&params, 0, sizeof(wl_iscan_params_t));
memcpy(&params.params.bssid, &ether_bcast, ETHER_ADDR_LEN);
memcpy(&params.params.bssid, &ether_bcast, ETH_ALEN);

params.params.bss_type = DOT11_BSSTYPE_ANY;
params.params.scan_type = DOT11_SCANTYPE_ACTIVE;
Expand Down
26 changes: 13 additions & 13 deletions drivers/staging/brcm80211/brcmfmac/dhd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ typedef struct dhd_if {
int idx; /* iface idx in dongle */
int state; /* interface state */
uint subunit; /* subunit */
u8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */
u8 mac_addr[ETH_ALEN]; /* assigned MAC address */
bool attached; /* Delayed attachment when unset */
bool txflowcontrol; /* Per interface flow control indicator */
char name[IFNAMSIZ]; /* linux interface name */
Expand Down Expand Up @@ -708,7 +708,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)

/* Send down the multicast list first. */

buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETHER_ADDR_LEN);
buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN);
bufp = buf = kmalloc(buflen, GFP_ATOMIC);
if (!bufp) {
DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n",
Expand All @@ -726,8 +726,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
netdev_for_each_mc_addr(ha, dev) {
if (!cnt)
break;
memcpy(bufp, ha->addr, ETHER_ADDR_LEN);
bufp += ETHER_ADDR_LEN;
memcpy(bufp, ha->addr, ETH_ALEN);
bufp += ETH_ALEN;
cnt--;
}

Expand Down Expand Up @@ -811,7 +811,7 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr)

DHD_TRACE(("%s enter\n", __func__));
if (!bcm_mkiovar
("cur_etheraddr", (char *)addr, ETHER_ADDR_LEN, buf, 32)) {
("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) {
DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n",
dhd_ifname(&dhd->pub, ifidx)));
return -1;
Expand All @@ -827,7 +827,7 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr)
DHD_ERROR(("%s: set cur_etheraddr failed\n",
dhd_ifname(&dhd->pub, ifidx)));
} else {
memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETHER_ADDR_LEN);
memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN);
}

return ret;
Expand Down Expand Up @@ -997,7 +997,7 @@ static int dhd_set_mac_address(struct net_device *dev, void *addr)
return -1;

ASSERT(dhd->sysioc_tsk);
memcpy(&dhd->macvalue, sa->sa_data, ETHER_ADDR_LEN);
memcpy(&dhd->macvalue, sa->sa_data, ETH_ALEN);
dhd->set_macaddress = true;
up(&dhd->sysioc_sem);

Expand Down Expand Up @@ -1028,7 +1028,7 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
return -ENODEV;

/* Update multicast statistic */
if (pktbuf->len >= ETHER_ADDR_LEN) {
if (pktbuf->len >= ETH_ALEN) {
u8 *pktdata = (u8 *) (pktbuf->data);
struct ether_header *eh = (struct ether_header *)pktdata;

Expand Down Expand Up @@ -1866,7 +1866,7 @@ static int dhd_open(struct net_device *net)
}
atomic_set(&dhd->pend_8021x_cnt, 0);

memcpy(net->dev_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN);
memcpy(net->dev_addr, dhd->pub.mac.octet, ETH_ALEN);

#ifdef TOE
/* Get current TOE mode from dongle */
Expand Down Expand Up @@ -1922,7 +1922,7 @@ dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
dhd->iflist[ifidx] = ifp;
strlcpy(ifp->name, name, IFNAMSIZ);
if (mac_addr != NULL)
memcpy(&ifp->mac_addr, mac_addr, ETHER_ADDR_LEN);
memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);

if (handle == NULL) {
ifp->state = WLC_E_IF_ADD;
Expand Down Expand Up @@ -2281,7 +2281,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
{
dhd_info_t *dhd = (dhd_info_t *) dhdp->info;
struct net_device *net;
u8 temp_addr[ETHER_ADDR_LEN] = {
u8 temp_addr[ETH_ALEN] = {
0x00, 0x90, 0x4c, 0x11, 0x22, 0x33};

DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx));
Expand All @@ -2299,7 +2299,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
*/
if (ifidx != 0) {
/* for virtual interfaces use the primary MAC */
memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN);
memcpy(temp_addr, dhd->pub.mac.octet, ETH_ALEN);

}

Expand Down Expand Up @@ -2327,7 +2327,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)

dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen;

memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN);
memcpy(net->dev_addr, temp_addr, ETH_ALEN);

if (register_netdev(net) != 0) {
DHD_ERROR(("%s: couldn't register the net device\n",
Expand Down
36 changes: 18 additions & 18 deletions drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,

static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid)
{
memcpy(&params->bssid, &ether_bcast, ETHER_ADDR_LEN);
memcpy(&params->bssid, &ether_bcast, ETH_ALEN);
params->bss_type = DOT11_BSSTYPE_ANY;
params->scan_type = 0;
params->nprobes = -1;
Expand Down Expand Up @@ -1044,9 +1044,9 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
join_params.ssid.SSID_len = htod32(params->ssid_len);
if (params->bssid)
memcpy(&join_params.params.bssid, params->bssid,
ETHER_ADDR_LEN);
ETH_ALEN);
else
memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN);
memset(&join_params.params.bssid, 0, ETH_ALEN);

err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params,
sizeof(join_params));
Expand Down Expand Up @@ -1373,7 +1373,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len);
join_params.ssid.SSID_len = htod32(join_params.ssid.SSID_len);
wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID);
memcpy(&join_params.params.bssid, &ether_bcast, ETHER_ADDR_LEN);
memcpy(&join_params.params.bssid, &ether_bcast, ETH_ALEN);

wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size);
WL_DBG(("join_param_size %d\n", join_params_size));
Expand Down Expand Up @@ -1406,7 +1406,7 @@ wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
act = *(bool *) wl_read_prof(wl, WL_PROF_ACT);
if (likely(act)) {
scbval.val = reason_code;
memcpy(&scbval.ea, &wl->bssid, ETHER_ADDR_LEN);
memcpy(&scbval.ea, &wl->bssid, ETH_ALEN);
scbval.val = htod32(scbval.val);
err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval,
sizeof(scb_val_t));
Expand Down Expand Up @@ -1533,7 +1533,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
/* Instead of bcast for ea address for default wep keys,
driver needs it to be Null */
if (!is_multicast_ether_addr(mac_addr))
memcpy((char *)&key.ea, (void *)mac_addr, ETHER_ADDR_LEN);
memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN);
key.len = (u32) params->key_len;
/* check for key index change */
if (key.len == 0) {
Expand Down Expand Up @@ -1826,7 +1826,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,

CHECK_SYS_UP();
if (unlikely
(memcmp(mac, wl_read_prof(wl, WL_PROF_BSSID), ETHER_ADDR_LEN))) {
(memcmp(mac, wl_read_prof(wl, WL_PROF_BSSID), ETH_ALEN))) {
WL_ERR(("Wrong Mac address\n"));
return -ENOENT;
}
Expand Down Expand Up @@ -2029,11 +2029,11 @@ wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
CHECK_SYS_UP();
for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++)
if (!memcmp(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID,
ETHER_ADDR_LEN))
ETH_ALEN))
break;
if (i < WL_NUM_PMKIDS_MAX) {
memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, pmksa->bssid,
ETHER_ADDR_LEN);
ETH_ALEN);
memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, pmksa->pmkid,
WPA2_PMKID_LEN);
if (i == wl->pmk_list->pmkids.npmkid)
Expand Down Expand Up @@ -2064,7 +2064,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
int i;

CHECK_SYS_UP();
memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETHER_ADDR_LEN);
memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN);
memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN);

WL_DBG(("del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n",
Expand All @@ -2076,7 +2076,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++)
if (!memcmp
(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID,
ETHER_ADDR_LEN))
ETH_ALEN))
break;

if ((wl->pmk_list->pmkids.npmkid > 0)
Expand All @@ -2085,7 +2085,7 @@ wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
for (; i < (wl->pmk_list->pmkids.npmkid - 1); i++) {
memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID,
&wl->pmk_list->pmkids.pmkid[i + 1].BSSID,
ETHER_ADDR_LEN);
ETH_ALEN);
memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID,
&wl->pmk_list->pmkids.pmkid[i + 1].PMKID,
WPA2_PMKID_LEN);
Expand Down Expand Up @@ -2284,7 +2284,7 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
notif_bss_info->rssi = bi->RSSI;
memcpy(mgmt->bssid, &bi->BSSID, ETHER_ADDR_LEN);
memcpy(mgmt->bssid, &bi->BSSID, ETH_ALEN);
mgmt_type = wl->active_scan ?
IEEE80211_STYPE_PROBE_RESP : IEEE80211_STYPE_BEACON;
if (!memcmp(bi->SSID, sr->ssid.SSID, bi->SSID_len)) {
Expand Down Expand Up @@ -2579,7 +2579,7 @@ static s32 wl_update_bss_info(struct wl_priv *wl)
goto update_bss_info_out;
}
bi = (struct wl_bss_info *)(wl->extra_buf + 4);
if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETHER_ADDR_LEN))) {
if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETH_ALEN))) {
err = -EIO;
goto update_bss_info_out;
}
Expand Down Expand Up @@ -2631,7 +2631,7 @@ wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev,
s32 err = 0;

wl_get_assoc_ies(wl);
memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
memcpy(&wl->bssid, &e->addr, ETH_ALEN);
wl_update_bss_info(wl);
cfg80211_roamed(ndev,
(u8 *)&wl->bssid,
Expand All @@ -2652,7 +2652,7 @@ wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev,
s32 err = 0;

wl_get_assoc_ies(wl);
memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN);
memcpy(&wl->bssid, &e->addr, ETH_ALEN);
wl_update_bss_info(wl);
if (test_and_clear_bit(WL_STATUS_CONNECTING, &wl->status)) {
cfg80211_connect_result(ndev,
Expand Down Expand Up @@ -3926,9 +3926,9 @@ wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data,
break;
case WL_PROF_BSSID:
if (data)
memcpy(wl->profile->bssid, data, ETHER_ADDR_LEN);
memcpy(wl->profile->bssid, data, ETH_ALEN);
else
memset(wl->profile->bssid, 0, ETHER_ADDR_LEN);
memset(wl->profile->bssid, 0, ETH_ALEN);
break;
case WL_PROF_SEC:
memcpy(&wl->profile->sec, data, sizeof(wl->profile->sec));
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct wl_ibss {
struct wl_profile {
u32 mode;
struct wlc_ssid ssid;
u8 bssid[ETHER_ADDR_LEN];
u8 bssid[ETH_ALEN];
u16 beacon_interval;
u8 dtim_period;
struct wl_security sec;
Expand Down
Loading

0 comments on commit b8d6307

Please sign in to comment.