]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
staging: brcm80211: replace broadcom specific byte swapping routines
authorStanislav Fomichev <kernel@fomichev.me>
Sun, 20 Feb 2011 18:43:32 +0000 (21:43 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Feb 2011 22:06:59 +0000 (14:06 -0800)
HTON16/hton16 -> cpu_to_be16 (htons for networking code)
HTON32/hton32 -> cpu_to_be32 (htonl for networking code)
NTOH16/ntoh32 -> be16_to_cpu (ntohs for networking code)
NTOH32/ntoh32 -> be32_to_cpu (ntohl for networking code)
LTOH16/ltoh16 -> le16_to_cpu
LTOH32/ltoh32 -> le32_to_cpu
HTOL16/htol16 -> cpu_to_le16
HTOL32/htol32 -> cpu_to_le32

Signed-off-by: Stanislav Fomichev <kernel@fomichev.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 files changed:
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
drivers/staging/brcm80211/brcmfmac/dhd_common.c
drivers/staging/brcm80211/brcmfmac/dhd_linux.c
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
drivers/staging/brcm80211/brcmfmac/wl_iw.c
drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_n.c
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
drivers/staging/brcm80211/include/bcmendian.h
drivers/staging/brcm80211/util/hnddma.c

index 6cde62ac7dfc681461557dbae15d29ea8025633f..8bf731f693ff0a4495a5fcf7d6b7b6ba9ae79409 100644 (file)
@@ -735,7 +735,7 @@ static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr)
        }
 
        /* Only the lower 17-bits are valid */
-       scratch = ltoh32(scratch);
+       scratch = le32_to_cpu(scratch);
        scratch &= 0x0001FFFF;
        return scratch;
 }
index ed204d535942927845d678fb494ef30178004b4e..0083f0c3775bb8c39877c21ba34f189635cb63b3 100644 (file)
@@ -65,7 +65,7 @@ typedef struct dhd_prot {
 static int dhdcdc_msg(dhd_pub_t *dhd)
 {
        dhd_prot_t *prot = dhd->prot;
-       int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t);
+       int len = le32_to_cpu(prot->msg.len) + sizeof(cdc_ioctl_t);
 
        DHD_TRACE(("%s: Enter\n", __func__));
 
@@ -93,7 +93,7 @@ static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len)
                                  len + sizeof(cdc_ioctl_t));
                if (ret < 0)
                        break;
-       } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id);
+       } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id);
 
        return ret;
 }
@@ -124,11 +124,11 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
 
        memset(msg, 0, sizeof(cdc_ioctl_t));
 
-       msg->cmd = htol32(cmd);
-       msg->len = htol32(len);
+       msg->cmd = cpu_to_le32(cmd);
+       msg->len = cpu_to_le32(len);
        msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT);
        CDC_SET_IF_IDX(msg, ifidx);
-       msg->flags = htol32(msg->flags);
+       msg->flags = cpu_to_le32(msg->flags);
 
        if (buf)
                memcpy(prot->buf, buf, len);
@@ -146,7 +146,7 @@ retry:
        if (ret < 0)
                goto done;
 
-       flags = ltoh32(msg->flags);
+       flags = le32_to_cpu(msg->flags);
        id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
 
        if ((id < prot->reqid) && (++retries < RETRIES))
@@ -170,7 +170,7 @@ retry:
 
        /* Check the ERROR flag */
        if (flags & CDCF_IOC_ERROR) {
-               ret = ltoh32(msg->status);
+               ret = le32_to_cpu(msg->status);
                /* Cache error from dongle */
                dhd->dongle_error = ret;
        }
@@ -191,11 +191,11 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
 
        memset(msg, 0, sizeof(cdc_ioctl_t));
 
-       msg->cmd = htol32(cmd);
-       msg->len = htol32(len);
+       msg->cmd = cpu_to_le32(cmd);
+       msg->len = cpu_to_le32(len);
        msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET;
        CDC_SET_IF_IDX(msg, ifidx);
-       msg->flags = htol32(msg->flags);
+       msg->flags = cpu_to_le32(msg->flags);
 
        if (buf)
                memcpy(prot->buf, buf, len);
@@ -208,7 +208,7 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
        if (ret < 0)
                goto done;
 
-       flags = ltoh32(msg->flags);
+       flags = le32_to_cpu(msg->flags);
        id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT;
 
        if (id != prot->reqid) {
@@ -220,7 +220,7 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
 
        /* Check the ERROR flag */
        if (flags & CDCF_IOC_ERROR) {
-               ret = ltoh32(msg->status);
+               ret = le32_to_cpu(msg->status);
                /* Cache error from dongle */
                dhd->dongle_error = ret;
        }
@@ -276,8 +276,8 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
                ret = 0;
        else {
                cdc_ioctl_t *msg = &prot->msg;
-               ioc->needed = ltoh32(msg->len); /* len == needed when set/query
-                                                fails from dongle */
+               /* len == needed when set/query fails from dongle */
+               ioc->needed = le32_to_cpu(msg->len);
        }
 
        /* Intercept the wme_dp ioctl here */
@@ -287,7 +287,7 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
                slen = strlen("wme_dp") + 1;
                if (len >= (int)(slen + sizeof(int)))
                        memcpy(&val, (char *)buf + slen, sizeof(int));
-               dhd->wme_dp = (u8) ltoh32(val);
+               dhd->wme_dp = (u8) le32_to_cpu(val);
        }
 
        prot->pending = false;
index b2a6fb247ef9b388a1c1740a97f7fc57102f66dc..326020049c3dab7004594251ca2135ca596c032d 100644 (file)
@@ -577,12 +577,12 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
                WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"}
        };
        uint event_type, flags, auth_type, datalen;
-       event_type = ntoh32(event->event_type);
-       flags = ntoh16(event->flags);
-       status = ntoh32(event->status);
-       reason = ntoh32(event->reason);
-       auth_type = ntoh32(event->auth_type);
-       datalen = ntoh32(event->datalen);
+       event_type = be32_to_cpu(event->event_type);
+       flags = be16_to_cpu(event->flags);
+       status = be32_to_cpu(event->status);
+       reason = be32_to_cpu(event->reason);
+       auth_type = be32_to_cpu(event->auth_type);
+       datalen = be32_to_cpu(event->datalen);
        /* debug dump of event messages */
        sprintf(eabuf, "%pM", event->addr);
 
@@ -750,24 +750,24 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
                        }
 
                        /* There are 2 bytes available at the end of data */
-                       buf[MSGTRACE_HDRLEN + ntoh16(hdr.len)] = '\0';
+                       buf[MSGTRACE_HDRLEN + be16_to_cpu(hdr.len)] = '\0';
 
-                       if (ntoh32(hdr.discarded_bytes)
-                           || ntoh32(hdr.discarded_printf)) {
+                       if (be32_to_cpu(hdr.discarded_bytes)
+                           || be32_to_cpu(hdr.discarded_printf)) {
                                DHD_ERROR(
                                    ("\nWLC_E_TRACE: [Discarded traces in dongle -->"
                                     "discarded_bytes %d discarded_printf %d]\n",
-                                    ntoh32(hdr.discarded_bytes),
-                                    ntoh32(hdr.discarded_printf)));
+                                    be32_to_cpu(hdr.discarded_bytes),
+                                    be32_to_cpu(hdr.discarded_printf)));
                        }
 
-                       nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1;
+                       nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1;
                        if (nblost > 0) {
                                DHD_ERROR(
                                    ("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n",
-                                    ntoh32(hdr.seqnum), nblost));
+                                    be32_to_cpu(hdr.seqnum), nblost));
                        }
-                       seqnum_prev = ntoh32(hdr.seqnum);
+                       seqnum_prev = be32_to_cpu(hdr.seqnum);
 
                        /* Display the trace buffer. Advance from \n to \n to
                         * avoid display big
@@ -788,7 +788,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
 
        case WLC_E_RSSI:
                DHD_EVENT(("MACEVENT: %s %d\n", event_name,
-                          ntoh32(*((int *)event_data))));
+                          be32_to_cpu(*((int *)event_data))));
                break;
 
        default:
@@ -898,7 +898,7 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
                        temp = ntoh32_ua((void *)&event->event_type);
                        DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp));
 
-                       temp = ntoh32(WLC_E_NDIS_LINK);
+                       temp = be32_to_cpu(WLC_E_NDIS_LINK);
                        memcpy((void *)(&pvt_data->event.event_type), &temp,
                               sizeof(pvt_data->event.event_type));
                }
index ffba7461700a73553122a55541c5dabcbd8e56f9..b6e3c0a87006956038727331c84cb2a549ac5e21 100644 (file)
@@ -713,7 +713,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
        strcpy(bufp, "mcast_list");
        bufp += strlen("mcast_list") + 1;
 
-       cnt = htol32(cnt);
+       cnt = cpu_to_le32(cnt);
        memcpy(bufp, &cnt, sizeof(cnt));
        bufp += sizeof(cnt);
 
@@ -752,7 +752,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
                           dhd_ifname(&dhd->pub, ifidx)));
                return;
        }
-       allmulti = htol32(allmulti);
+       allmulti = cpu_to_le32(allmulti);
 
        if (!bcm_mkiovar
            ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) {
@@ -772,7 +772,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
        ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
        if (ret < 0) {
                DHD_ERROR(("%s: set allmulti %d failed\n",
-                          dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
+                          dhd_ifname(&dhd->pub, ifidx),
+                          le32_to_cpu(allmulti)));
        }
 
        kfree(buf);
@@ -781,7 +782,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
                 driver does */
 
        allmulti = (dev->flags & IFF_PROMISC) ? true : false;
-       allmulti = htol32(allmulti);
+       allmulti = cpu_to_le32(allmulti);
 
        memset(&ioc, 0, sizeof(ioc));
        ioc.cmd = WLC_SET_PROMISC;
@@ -792,7 +793,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
        ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len);
        if (ret < 0) {
                DHD_ERROR(("%s: set promisc %d failed\n",
-                          dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti)));
+                          dhd_ifname(&dhd->pub, ifidx),
+                          le32_to_cpu(allmulti)));
        }
 }
 
@@ -1028,7 +1030,7 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
 
                if (is_multicast_ether_addr(eh->h_dest))
                        dhdp->tx_multicast++;
-               if (ntoh16(eh->h_proto) == ETH_P_PAE)
+               if (ntohs(eh->h_proto) == ETH_P_PAE)
                        atomic_inc(&dhd->pend_8021x_cnt);
        }
 
@@ -1208,7 +1210,7 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf,
                skb_pull(skb, ETH_HLEN);
 
                /* Process special event packets and then discard them */
-               if (ntoh16(skb->protocol) == ETH_P_BRCM)
+               if (ntohs(skb->protocol) == ETH_P_BRCM)
                        dhd_wl_host_event(dhd, &ifidx,
                                          skb_mac_header(skb),
                                          &event, &data);
@@ -1253,7 +1255,7 @@ void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success)
        dhd_prot_hdrpull(dhdp, &ifidx, txp);
 
        eh = (struct ethhdr *)(txp->data);
-       type = ntoh16(eh->h_proto);
+       type = ntohs(eh->h_proto);
 
        if (type == ETH_P_PAE)
                atomic_dec(&dhd->pend_8021x_cnt);
@@ -2749,7 +2751,7 @@ dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
 /* send up locally generated event */
 void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data)
 {
-       switch (ntoh32(event->event_type)) {
+       switch (be32_to_cpu(event->event_type)) {
        default:
                break;
        }
index 916c5557f7b4144aeff5acd755b8dc082ee295be..d47f697540e35a1669736c64d017bbd35ac3cee9 100644 (file)
@@ -966,8 +966,8 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
 
        /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
        len = (u16) (pkt->len);
-       *(u16 *) frame = htol16(len);
-       *(((u16 *) frame) + 1) = htol16(~len);
+       *(u16 *) frame = cpu_to_le16(len);
+       *(((u16 *) frame) + 1) = cpu_to_le16(~len);
 
        /* Software tag: channel, sequence number, data offset */
        swheader =
@@ -1281,8 +1281,8 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
        dhdsdio_clkctl(bus, CLK_AVAIL, false);
 
        /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
-       *(u16 *) frame = htol16((u16) msglen);
-       *(((u16 *) frame) + 1) = htol16(~msglen);
+       *(u16 *) frame = cpu_to_le16((u16) msglen);
+       *(((u16 *) frame) + 1) = cpu_to_le16(~msglen);
 
        /* Software tag: channel, sequence number, data offset */
        swheader =
@@ -1768,7 +1768,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
        if (rv < 0)
                return rv;
 
-       addr = ltoh32(addr);
+       addr = le32_to_cpu(addr);
 
        DHD_INFO(("sdpcm_shared address 0x%08X\n", addr));
 
@@ -1789,13 +1789,13 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
                return rv;
 
        /* Endianness */
-       sh->flags = ltoh32(sh->flags);
-       sh->trap_addr = ltoh32(sh->trap_addr);
-       sh->assert_exp_addr = ltoh32(sh->assert_exp_addr);
-       sh->assert_file_addr = ltoh32(sh->assert_file_addr);
-       sh->assert_line = ltoh32(sh->assert_line);
-       sh->console_addr = ltoh32(sh->console_addr);
-       sh->msgtrace_addr = ltoh32(sh->msgtrace_addr);
+       sh->flags = le32_to_cpu(sh->flags);
+       sh->trap_addr = le32_to_cpu(sh->trap_addr);
+       sh->assert_exp_addr = le32_to_cpu(sh->assert_exp_addr);
+       sh->assert_file_addr = le32_to_cpu(sh->assert_file_addr);
+       sh->assert_line = le32_to_cpu(sh->assert_line);
+       sh->console_addr = le32_to_cpu(sh->console_addr);
+       sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr);
 
        if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) {
                DHD_ERROR(("%s: sdpcm_shared version %d in dhd "
@@ -2008,13 +2008,13 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
 
        /* Allocate console buffer (one time only) */
        if (c->buf == NULL) {
-               c->bufsize = ltoh32(c->log.buf_size);
+               c->bufsize = le32_to_cpu(c->log.buf_size);
                c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
                if (c->buf == NULL)
                        return BCME_NOMEM;
        }
 
-       idx = ltoh32(c->log.idx);
+       idx = le32_to_cpu(c->log.idx);
 
        /* Protect against corrupt value */
        if (idx > c->bufsize)
@@ -2026,7 +2026,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
                return BCME_OK;
 
        /* Read the console buffer */
-       addr = ltoh32(c->log.buf);
+       addr = le32_to_cpu(c->log.buf);
        rv = dhdsdio_membytes(bus, false, addr, c->buf, c->bufsize);
        if (rv < 0)
                return rv;
@@ -2589,7 +2589,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
        } else {
                varsizew = varsize / 4;
                varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF);
-               varsizew = htol32(varsizew);
+               varsizew = cpu_to_le32(varsizew);
        }
 
        DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize,
@@ -4986,7 +4986,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
 
        /* Zero cbuf_index */
        addr = bus->console_addr + offsetof(hndrte_cons_t, cbuf_idx);
-       val = htol32(0);
+       val = cpu_to_le32(0);
        rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
        if (rv < 0)
                goto done;
@@ -4999,7 +4999,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
 
        /* Write length into vcons_in */
        addr = bus->console_addr + offsetof(hndrte_cons_t, vcons_in);
-       val = htol32(msglen);
+       val = cpu_to_le32(msglen);
        rv = dhdsdio_membytes(bus, true, addr, (u8 *)&val, sizeof(val));
        if (rv < 0)
                goto done;
index c798c75a4a88543fe4cfc39f7ae1bab4edb4569d..54169c49ee2e30ec7f7dbb520e10c827b3f8b0ea 100644 (file)
@@ -2336,8 +2336,8 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
 
 static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
 {
-       u32 event = ntoh32(e->event_type);
-       u16 flags = ntoh16(e->flags);
+       u32 event = be32_to_cpu(e->event_type);
+       u16 flags = be16_to_cpu(e->flags);
 
        if (event == WLC_E_LINK) {
                if (flags & WLC_EVENT_MSG_LINK) {
@@ -2355,8 +2355,8 @@ static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e)
 
 static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
 {
-       u32 event = ntoh32(e->event_type);
-       u16 flags = ntoh16(e->flags);
+       u32 event = be32_to_cpu(e->event_type);
+       u16 flags = be16_to_cpu(e->flags);
 
        if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) {
                return true;
@@ -2370,8 +2370,8 @@ static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e)
 
 static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e)
 {
-       u32 event = ntoh32(e->event_type);
-       u32 status = ntoh32(e->status);
+       u32 event = be32_to_cpu(e->event_type);
+       u32 status = be32_to_cpu(e->status);
 
        if (event == WLC_E_SET_SSID || event == WLC_E_LINK) {
                if (status == WLC_E_STATUS_NO_NETWORKS)
@@ -2681,7 +2681,7 @@ static s32
 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev,
                     const wl_event_msg_t *e, void *data)
 {
-       u16 flags = ntoh16(e->flags);
+       u16 flags = be16_to_cpu(e->flags);
        enum nl80211_key_type key_type;
 
        rtnl_lock();
@@ -3273,7 +3273,7 @@ static s32 wl_event_handler(void *data)
 void
 wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t * e, void *data)
 {
-       u32 event_type = ntoh32(e->event_type);
+       u32 event_type = be32_to_cpu(e->event_type);
        struct wl_priv *wl = ndev_to_wl(ndev);
 #if (WL_DBG_LEVEL > 0)
        s8 *estr = (event_type <= sizeof(wl_dbg_estr) / WL_DBG_ESTR_MAX - 1) ?
index 50cd22979d29115aeb004fe385a045d326c56a23..83e6d5c10450d2eb09206fd173195d05e6f161ac 100644 (file)
@@ -3353,9 +3353,9 @@ wl_iw_conn_status_str(u32 event_type, u32 status, u32 reason,
 static bool
 wl_iw_check_conn_fail(wl_event_msg_t *e, char *stringBuf, uint buflen)
 {
-       u32 event = ntoh32(e->event_type);
-       u32 status = ntoh32(e->status);
-       u32 reason = ntoh32(e->reason);
+       u32 event = be32_to_cpu(e->event_type);
+       u32 status = be32_to_cpu(e->status);
+       u32 reason = be32_to_cpu(e->reason);
 
        if (wl_iw_conn_status_str(event, status, reason, stringBuf, buflen)) {
                return true;
@@ -3374,10 +3374,10 @@ void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void *data)
        union iwreq_data wrqu;
        char extra[IW_CUSTOM_MAX + 1];
        int cmd = 0;
-       u32 event_type = ntoh32(e->event_type);
-       u16 flags = ntoh16(e->flags);
-       u32 datalen = ntoh32(e->datalen);
-       u32 status = ntoh32(e->status);
+       u32 event_type = be32_to_cpu(e->event_type);
+       u16 flags = be16_to_cpu(e->flags);
+       u32 datalen = be32_to_cpu(e->datalen);
+       u32 status = be32_to_cpu(e->status);
        wl_iw_t *iw;
        u32 toto;
        memset(&wrqu, 0, sizeof(wrqu));
index 0760d97b3ba193ca5bbdadc1af33158a0fb0f522..d869efa781d4d2eb4d589120444e5990b18dd2bc 100644 (file)
@@ -2859,7 +2859,7 @@ void BCMFASTPATH wlc_phy_rssi_compute(wlc_phy_t *pih, void *ctx)
 {
        wlc_d11rxhdr_t *wlc_rxhdr = (wlc_d11rxhdr_t *) ctx;
        d11rxhdr_t *rxh = &wlc_rxhdr->rxhdr;
-       int rssi = ltoh16(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK;
+       int rssi = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_JSSI_MASK;
        uint radioid = pih->radioid;
        phy_info_t *pi = (phy_info_t *) pih;
 
@@ -2869,13 +2869,13 @@ void BCMFASTPATH wlc_phy_rssi_compute(wlc_phy_t *pih, void *ctx)
        }
 
        if ((pi->sh->corerev >= 11)
-           && !(ltoh16(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
+           && !(le16_to_cpu(rxh->RxStatus2) & RXS_PHYRXST_VALID)) {
                rssi = WLC_RSSI_INVALID;
                goto end;
        }
 
        if (ISLCNPHY(pi)) {
-               u8 gidx = (ltoh16(rxh->PhyRxStatus_2) & 0xFC00) >> 10;
+               u8 gidx = (le16_to_cpu(rxh->PhyRxStatus_2) & 0xFC00) >> 10;
                phy_info_lcnphy_t *pi_lcn = pi->u.pi_lcnphy;
 
                if (rssi > 127)
index c6cce8de1aeeaab5ecf2b1be32641935c088e301..55ce0b8c4fdd457367ee54a187b2184d6c2f935d 100644 (file)
@@ -21478,16 +21478,16 @@ wlc_phy_rssi_compute_nphy(phy_info_t *pi, wlc_d11rxhdr_t *wlc_rxh)
        s16 phyRx0_l, phyRx2_l;
 
        rxpwr = 0;
-       rxpwr0 = ltoh16(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK;
-       rxpwr1 = (ltoh16(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >> 8;
+       rxpwr0 = le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR0_MASK;
+       rxpwr1 = (le16_to_cpu(rxh->PhyRxStatus_1) & PRXS1_nphy_PWR1_MASK) >> 8;
 
        if (rxpwr0 > 127)
                rxpwr0 -= 256;
        if (rxpwr1 > 127)
                rxpwr1 -= 256;
 
-       phyRx0_l = ltoh16(rxh->PhyRxStatus_0) & 0x00ff;
-       phyRx2_l = ltoh16(rxh->PhyRxStatus_2) & 0x00ff;
+       phyRx0_l = le16_to_cpu(rxh->PhyRxStatus_0) & 0x00ff;
+       phyRx2_l = le16_to_cpu(rxh->PhyRxStatus_2) & 0x00ff;
        if (phyRx2_l > 127)
                phyRx2_l -= 256;
 
index ca27e826e14fb68a49f60ab304f89a4d8fe17190..a5a4868ff3fac42d9c080b3e7af50297657d645f 100644 (file)
@@ -594,13 +594,13 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                txh = (d11txh_t *) p->data;
                plcp = (u8 *) (txh + 1);
                h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
-               seq = ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;
+               seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT;
                index = TX_SEQ_TO_INDEX(seq);
 
                /* check mcl fields and test whether it can be agg'd */
-               mcl = ltoh16(txh->MacTxControlLow);
+               mcl = le16_to_cpu(txh->MacTxControlLow);
                mcl &= ~TXC_AMPDU_MASK;
-               fbr_iscck = !(ltoh16(txh->XtraFrameTypes) & 0x3);
+               fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x3);
                ASSERT(!fbr_iscck);
                txh->PreloadSize = 0;   /* always default to 0 */
 
@@ -637,7 +637,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                        /* refill the bits since might be a retx mpdu */
                        mcl |= TXC_STARTMSDU;
                        rts = (struct ieee80211_rts *)&txh->rts_frame;
-                       fc = ltoh16(rts->frame_control);
+                       fc = le16_to_cpu(rts->frame_control);
                        if ((fc & FC_KIND_MASK) == FC_RTS) {
                                mcl |= TXC_SENDRTS;
                                use_rts = true;
@@ -659,7 +659,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                WL_AMPDU_TX("wl%d: wlc_sendampdu: ampdu_len %d seg_cnt %d null delim %d\n",
                            wlc->pub->unit, ampdu_len, seg_cnt, ndelim);
 
-               txh->MacTxControlLow = htol16(mcl);
+               txh->MacTxControlLow = cpu_to_le16(mcl);
 
                /* this packet is added */
                pkt[count++] = p;
@@ -784,10 +784,10 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
 
                /* patch up the last txh */
                txh = (d11txh_t *) pkt[count - 1]->data;
-               mcl = ltoh16(txh->MacTxControlLow);
+               mcl = le16_to_cpu(txh->MacTxControlLow);
                mcl &= ~TXC_AMPDU_MASK;
                mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT);
-               txh->MacTxControlLow = htol16(mcl);
+               txh->MacTxControlLow = cpu_to_le16(mcl);
 
                /* remove the null delimiter after last mpdu */
                ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
@@ -795,7 +795,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                ampdu_len -= ndelim * AMPDU_DELIMITER_LEN;
 
                /* remove the pad len from last mpdu */
-               fbr_iscck = ((ltoh16(txh->XtraFrameTypes) & 0x3) == 0);
+               fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0);
                len = fbr_iscck ? WLC_GET_CCK_PLCP_LEN(txh->FragPLCPFallback)
                    : WLC_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
                ampdu_len -= roundup(len, 4) - len;
@@ -812,24 +812,24 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                if (txh->MModeLen) {
                        u16 mmodelen =
                            wlc_calc_lsig_len(wlc, rspec, ampdu_len);
-                       txh->MModeLen = htol16(mmodelen);
+                       txh->MModeLen = cpu_to_le16(mmodelen);
                        preamble_type = WLC_MM_PREAMBLE;
                }
                if (txh->MModeFbrLen) {
                        u16 mmfbrlen =
                            wlc_calc_lsig_len(wlc, rspec_fallback, ampdu_len);
-                       txh->MModeFbrLen = htol16(mmfbrlen);
+                       txh->MModeFbrLen = cpu_to_le16(mmfbrlen);
                        fbr_preamble_type = WLC_MM_PREAMBLE;
                }
 
                /* set the preload length */
                if (MCS_RATE(mcs, true, false) >= f->dmaxferrate) {
                        dma_len = min(dma_len, f->ampdu_pld_size);
-                       txh->PreloadSize = htol16(dma_len);
+                       txh->PreloadSize = cpu_to_le16(dma_len);
                } else
                        txh->PreloadSize = 0;
 
-               mch = ltoh16(txh->MacTxControlHigh);
+               mch = le16_to_cpu(txh->MacTxControlHigh);
 
                /* update RTS dur fields */
                if (use_rts || use_cts) {
@@ -848,14 +848,14 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                                                   rspec, rts_preamble_type,
                                                   preamble_type, ampdu_len,
                                                   true);
-                       rts->duration = htol16(durid);
+                       rts->duration = cpu_to_le16(durid);
                        durid = wlc_compute_rtscts_dur(wlc, use_cts,
                                                       rts_rspec_fallback,
                                                       rspec_fallback,
                                                       rts_fbr_preamble_type,
                                                       fbr_preamble_type,
                                                       ampdu_len, true);
-                       txh->RTSDurFallback = htol16(durid);
+                       txh->RTSDurFallback = cpu_to_le16(durid);
                        /* set TxFesTimeNormal */
                        txh->TxFesTimeNormal = rts->duration;
                        /* set fallback rate version of TxFesTimeNormal */
@@ -867,7 +867,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                        WLCNTADD(ampdu->cnt->txfbr_mpdu, count);
                        WLCNTINCR(ampdu->cnt->txfbr_ampdu);
                        mch |= TXC_AMPDU_FBR;
-                       txh->MacTxControlHigh = htol16(mch);
+                       txh->MacTxControlHigh = cpu_to_le16(mch);
                        WLC_SET_MIMO_PLCP_AMPDU(plcp);
                        WLC_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback);
                }
@@ -876,7 +876,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, wlc_txq_info_t *qi,
                            wlc->pub->unit, count, ampdu_len);
 
                /* inform rate_sel if it this is a rate probe pkt */
-               frameid = ltoh16(txh->TxFrameID);
+               frameid = le16_to_cpu(txh->TxFrameID);
                if (frameid & TXFID_RATE_PROBE_MASK) {
                        WL_ERROR("%s: XXX what to do with TXFID_RATE_PROBE_MASK!?\n",
                                 __func__);
@@ -1082,14 +1082,14 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
                tx_info = IEEE80211_SKB_CB(p);
                ASSERT(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
                txh = (d11txh_t *) p->data;
-               mcl = ltoh16(txh->MacTxControlLow);
+               mcl = le16_to_cpu(txh->MacTxControlLow);
                plcp = (u8 *) (txh + 1);
                h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
-               seq = ltoh16(h->seq_ctrl) >> SEQNUM_SHIFT;
+               seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT;
 
                if (tot_mpdu == 0) {
                        mcs = plcp[0] & MIMO_PLCP_MCS_MASK;
-                       mimoantsel = ltoh16(txh->ABI_MimoAntSel);
+                       mimoantsel = le16_to_cpu(txh->ABI_MimoAntSel);
                }
 
                index = TX_SEQ_TO_INDEX(seq);
index ac068cdc578b32dda8f41e0062d2a02edf00f028..9419f27e7425a8b3e22414cdb6511f839cb1268b 100644 (file)
@@ -304,7 +304,7 @@ wlc_bmac_recv(struct wlc_hw_info *wlc_hw, uint fifo, bool bound)
 
                /* record the tsf_l in wlc_rxd11hdr */
                wlc_rxhdr = (wlc_d11rxhdr_t *) p->data;
-               wlc_rxhdr->tsf_l = htol32(tsf_l);
+               wlc_rxhdr->tsf_l = cpu_to_le32(tsf_l);
 
                /* compute the RSSI from d11rxhdr and record it in wlc_rxd11hr */
                wlc_phy_rssi_compute(wlc_hw->band->pi, wlc_rxhdr);
@@ -1701,9 +1701,9 @@ wlc_bmac_write_template_ram(struct wlc_hw_info *wlc_hw, int offset, int len,
                memcpy(&word, buf, sizeof(u32));
 
                if (be_bit)
-                       word = hton32(word);
+                       word = cpu_to_be32(word);
                else
-                       word = htol32(word);
+                       word = cpu_to_le32(word);
 
                W_REG(osh, &regs->tplatewrdata, word);
 
index b617b6417054dc12463f4cb39113eb9d3aa9d63a..e7628fa6fcd5c9198ebbbac6bec7d17ce55f522c 100644 (file)
@@ -1345,13 +1345,13 @@ void wlc_wme_initparams_sta(struct wlc_info *wlc, wme_param_ie_t *pe)
                0,
                {
                 {EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA,
-                 HTOL16(EDCF_AC_BE_TXOP_STA)},
+                 cpu_to_le16(EDCF_AC_BE_TXOP_STA)},
                 {EDCF_AC_BK_ACI_STA, EDCF_AC_BK_ECW_STA,
-                 HTOL16(EDCF_AC_BK_TXOP_STA)},
+                 cpu_to_le16(EDCF_AC_BK_TXOP_STA)},
                 {EDCF_AC_VI_ACI_STA, EDCF_AC_VI_ECW_STA,
-                 HTOL16(EDCF_AC_VI_TXOP_STA)},
+                 cpu_to_le16(EDCF_AC_VI_TXOP_STA)},
                 {EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA,
-                 HTOL16(EDCF_AC_VO_TXOP_STA)}
+                 cpu_to_le16(EDCF_AC_VO_TXOP_STA)}
                 }
        };
 
@@ -1390,7 +1390,7 @@ void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void *arg, bool suspend)
                /* wlc->wme_admctl |= 1 << aci; *//* should be set ??  seems like off by default */
 
                /* fill in shm ac params struct */
-               acp_shm.txop = ltoh16(params->txop);
+               acp_shm.txop = le16_to_cpu(params->txop);
                /* convert from units of 32us to us for ucode */
                wlc->edcf_txop[aci & 0x3] = acp_shm.txop =
                    EDCF_TXOP2USEC(acp_shm.txop);
@@ -1474,7 +1474,7 @@ void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend)
                }
 
                /* fill in shm ac params struct */
-               acp_shm.txop = ltoh16(edcf_acp->TXOP);
+               acp_shm.txop = le16_to_cpu(edcf_acp->TXOP);
                /* convert from units of 32us to us for ucode */
                wlc->edcf_txop[aci] = acp_shm.txop =
                    EDCF_TXOP2USEC(acp_shm.txop);
@@ -4750,7 +4750,7 @@ wlc_ctrupd_cache(u16 cur_stat, u16 *macstat_snapshot, u32 *macstat)
        u16 v;
        u16 delta;
 
-       v = ltoh16(cur_stat);
+       v = le16_to_cpu(cur_stat);
        delta = (u16)(v - *macstat_snapshot);
 
        if (delta != 0) {
@@ -4927,32 +4927,32 @@ bool wlc_chipmatch(u16 vendor, u16 device)
 #if defined(BCMDBG)
 void wlc_print_txdesc(d11txh_t *txh)
 {
-       u16 mtcl = ltoh16(txh->MacTxControlLow);
-       u16 mtch = ltoh16(txh->MacTxControlHigh);
-       u16 mfc = ltoh16(txh->MacFrameControl);
-       u16 tfest = ltoh16(txh->TxFesTimeNormal);
-       u16 ptcw = ltoh16(txh->PhyTxControlWord);
-       u16 ptcw_1 = ltoh16(txh->PhyTxControlWord_1);
-       u16 ptcw_1_Fbr = ltoh16(txh->PhyTxControlWord_1_Fbr);
-       u16 ptcw_1_Rts = ltoh16(txh->PhyTxControlWord_1_Rts);
-       u16 ptcw_1_FbrRts = ltoh16(txh->PhyTxControlWord_1_FbrRts);
-       u16 mainrates = ltoh16(txh->MainRates);
-       u16 xtraft = ltoh16(txh->XtraFrameTypes);
+       u16 mtcl = le16_to_cpu(txh->MacTxControlLow);
+       u16 mtch = le16_to_cpu(txh->MacTxControlHigh);
+       u16 mfc = le16_to_cpu(txh->MacFrameControl);
+       u16 tfest = le16_to_cpu(txh->TxFesTimeNormal);
+       u16 ptcw = le16_to_cpu(txh->PhyTxControlWord);
+       u16 ptcw_1 = le16_to_cpu(txh->PhyTxControlWord_1);
+       u16 ptcw_1_Fbr = le16_to_cpu(txh->PhyTxControlWord_1_Fbr);
+       u16 ptcw_1_Rts = le16_to_cpu(txh->PhyTxControlWord_1_Rts);
+       u16 ptcw_1_FbrRts = le16_to_cpu(txh->PhyTxControlWord_1_FbrRts);
+       u16 mainrates = le16_to_cpu(txh->MainRates);
+       u16 xtraft = le16_to_cpu(txh->XtraFrameTypes);
        u8 *iv = txh->IV;
        u8 *ra = txh->TxFrameRA;
-       u16 tfestfb = ltoh16(txh->TxFesTimeFallback);
+       u16 tfestfb = le16_to_cpu(txh->TxFesTimeFallback);
        u8 *rtspfb = txh->RTSPLCPFallback;
-       u16 rtsdfb = ltoh16(txh->RTSDurFallback);
+       u16 rtsdfb = le16_to_cpu(txh->RTSDurFallback);
        u8 *fragpfb = txh->FragPLCPFallback;
-       u16 fragdfb = ltoh16(txh->FragDurFallback);
-       u16 mmodelen = ltoh16(txh->MModeLen);
-       u16 mmodefbrlen = ltoh16(txh->MModeFbrLen);
-       u16 tfid = ltoh16(txh->TxFrameID);
-       u16 txs = ltoh16(txh->TxStatus);
-       u16 mnmpdu = ltoh16(txh->MaxNMpdus);
-       u16 mabyte = ltoh16(txh->MaxABytes_MRT);
-       u16 mabyte_f = ltoh16(txh->MaxABytes_FBR);
-       u16 mmbyte = ltoh16(txh->MinMBytes);
+       u16 fragdfb = le16_to_cpu(txh->FragDurFallback);
+       u16 mmodelen = le16_to_cpu(txh->MModeLen);
+       u16 mmodefbrlen = le16_to_cpu(txh->MModeFbrLen);
+       u16 tfid = le16_to_cpu(txh->TxFrameID);
+       u16 txs = le16_to_cpu(txh->TxStatus);
+       u16 mnmpdu = le16_to_cpu(txh->MaxNMpdus);
+       u16 mabyte = le16_to_cpu(txh->MaxABytes_MRT);
+       u16 mabyte_f = le16_to_cpu(txh->MaxABytes_FBR);
+       u16 mmbyte = le16_to_cpu(txh->MinMBytes);
 
        u8 *rtsph = txh->RTSPhyHeader;
        struct ieee80211_rts rts = txh->rts_frame;
@@ -5213,7 +5213,7 @@ wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
 
        ASSERT(sdu);
 
-       fc = ltoh16(d11_header->frame_control);
+       fc = le16_to_cpu(d11_header->frame_control);
        type = (fc & IEEE80211_FCTL_FTYPE);
 
        /* 802.11 standard requires management traffic to go at highest priority */
@@ -5315,7 +5315,8 @@ bcmc_fid_generate(struct wlc_info *wlc, wlc_bsscfg_t *bsscfg, d11txh_t *txh)
 {
        u16 frameid;
 
-       frameid = ltoh16(txh->TxFrameID) & ~(TXFID_SEQ_MASK | TXFID_QUEUE_MASK);
+       frameid = le16_to_cpu(txh->TxFrameID) & ~(TXFID_SEQ_MASK |
+                                                 TXFID_QUEUE_MASK);
        frameid |=
            (((wlc->
               mc_fid_counter++) << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
@@ -5338,7 +5339,7 @@ wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, bool commit,
         * ucode or BSS info as appropriate.
         */
        if (fifo == TX_BCMC_FIFO) {
-               frameid = ltoh16(txh->TxFrameID);
+               frameid = le16_to_cpu(txh->TxFrameID);
 
        }
 
@@ -5789,7 +5790,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 
        /* locate 802.11 MAC header */
        h = (struct ieee80211_hdr *)(p->data);
-       fc = ltoh16(h->frame_control);
+       fc = le16_to_cpu(h->frame_control);
        type = (fc & IEEE80211_FCTL_FTYPE);
 
        qos = (type == IEEE80211_FTYPE_DATA &&
@@ -5834,9 +5835,9 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                        }
 
                        /* extract fragment number from frame first */
-                       seq = ltoh16(seq) & FRAGNUM_MASK;
+                       seq = le16_to_cpu(seq) & FRAGNUM_MASK;
                        seq |= (SCB_SEQNUM(scb, p->priority) << SEQNUM_SHIFT);
-                       h->seq_ctrl = htol16(seq);
+                       h->seq_ctrl = cpu_to_le16(seq);
 
                        frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) |
                            (queue & TXFID_QUEUE_MASK);
@@ -6078,7 +6079,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                durid =
                    wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0],
                                          next_frag_len);
-               h->duration_id = htol16(durid);
+               h->duration_id = cpu_to_le16(durid);
        } else if (use_rifs) {
                /* NAV protect to end of next max packet size */
                durid =
@@ -6086,7 +6087,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                                                 preamble_type[0],
                                                 DOT11_MAX_FRAG_LEN);
                durid += RIFS_11N_TIME;
-               h->duration_id = htol16(durid);
+               h->duration_id = cpu_to_le16(durid);
        }
 
        /* DUR field for fallback rate */
@@ -6097,7 +6098,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
        else {
                durid = wlc_compute_frame_dur(wlc, rspec[1],
                                              preamble_type[1], next_frag_len);
-               txh->FragDurFallback = htol16(durid);
+               txh->FragDurFallback = cpu_to_le16(durid);
        }
 
        /* (4) MAC-HDR: MacTxControlLow */
@@ -6117,7 +6118,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
        if (hwtkmic)
                mcl |= TXC_AMIC;
 
-       txh->MacTxControlLow = htol16(mcl);
+       txh->MacTxControlLow = cpu_to_le16(mcl);
 
        /* MacTxControlHigh */
        mch = 0;
@@ -6133,28 +6134,28 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 
        /* MacFrameControl */
        memcpy(&txh->MacFrameControl, &h->frame_control, sizeof(u16));
-       txh->TxFesTimeNormal = htol16(0);
+       txh->TxFesTimeNormal = cpu_to_le16(0);
 
-       txh->TxFesTimeFallback = htol16(0);
+       txh->TxFesTimeFallback = cpu_to_le16(0);
 
        /* TxFrameRA */
        memcpy(&txh->TxFrameRA, &h->addr1, ETH_ALEN);
 
        /* TxFrameID */
-       txh->TxFrameID = htol16(frameid);
+       txh->TxFrameID = cpu_to_le16(frameid);
 
        /* TxStatus, Note the case of recreating the first frag of a suppressed frame
         * then we may need to reset the retry cnt's via the status reg
         */
-       txh->TxStatus = htol16(status);
+       txh->TxStatus = cpu_to_le16(status);
 
        /* extra fields for ucode AMPDU aggregation, the new fields are added to
         * the END of previous structure so that it's compatible in driver.
         */
-       txh->MaxNMpdus = htol16(0);
-       txh->MaxABytes_MRT = htol16(0);
-       txh->MaxABytes_FBR = htol16(0);
-       txh->MinMBytes = htol16(0);
+       txh->MaxNMpdus = cpu_to_le16(0);
+       txh->MaxABytes_MRT = cpu_to_le16(0);
+       txh->MaxABytes_FBR = cpu_to_le16(0);
+       txh->MinMBytes = cpu_to_le16(0);
 
        /* (5) RTS/CTS: determine RTS/CTS PLCP header and MAC duration, furnish d11txh_t */
        /* RTS PLCP header and RTS frame */
@@ -6184,10 +6185,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 
                /* RTS/CTS additions to MacTxControlLow */
                if (use_cts) {
-                       txh->MacTxControlLow |= htol16(TXC_SENDCTS);
+                       txh->MacTxControlLow |= cpu_to_le16(TXC_SENDCTS);
                } else {
-                       txh->MacTxControlLow |= htol16(TXC_SENDRTS);
-                       txh->MacTxControlLow |= htol16(TXC_LONGFRAME);
+                       txh->MacTxControlLow |= cpu_to_le16(TXC_SENDRTS);
+                       txh->MacTxControlLow |= cpu_to_le16(TXC_LONGFRAME);
                }
 
                /* RTS PLCP header */
@@ -6212,19 +6213,19 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                durid = wlc_compute_rtscts_dur(wlc, use_cts, rts_rspec[0],
                                               rspec[0], rts_preamble_type[0],
                                               preamble_type[0], phylen, false);
-               rts->duration = htol16(durid);
+               rts->duration = cpu_to_le16(durid);
                /* fallback rate version of RTS DUR field */
                durid = wlc_compute_rtscts_dur(wlc, use_cts,
                                               rts_rspec[1], rspec[1],
                                               rts_preamble_type[1],
                                               preamble_type[1], phylen, false);
-               txh->RTSDurFallback = htol16(durid);
+               txh->RTSDurFallback = cpu_to_le16(durid);
 
                if (use_cts) {
-                       rts->frame_control = htol16(FC_CTS);
+                       rts->frame_control = cpu_to_le16(FC_CTS);
                        memcpy(&rts->ra, &h->addr2, ETH_ALEN);
                } else {
-                       rts->frame_control = htol16((u16) FC_RTS);
+                       rts->frame_control = cpu_to_le16((u16) FC_RTS);
                        memcpy(&rts->ra, &h->addr1, 2 * ETH_ALEN);
                }
 
@@ -6253,10 +6254,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 #endif
 
        /* Now that RTS/RTS FB preamble types are updated, write the final value */
-       txh->MacTxControlHigh = htol16(mch);
+       txh->MacTxControlHigh = cpu_to_le16(mch);
 
        /* MainRates (both the rts and frag plcp rates have been calculated now) */
-       txh->MainRates = htol16(mainrates);
+       txh->MainRates = cpu_to_le16(mainrates);
 
        /* XtraFrameTypes */
        xfts = FRAMETYPE(rspec[1], wlc->mimoft);
@@ -6264,7 +6265,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
        xfts |= (FRAMETYPE(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT);
        xfts |=
            CHSPEC_CHANNEL(WLC_BAND_PI_RADIO_CHANSPEC) << XFTS_CHANNEL_SHIFT;
-       txh->XtraFrameTypes = htol16(xfts);
+       txh->XtraFrameTypes = cpu_to_le16(xfts);
 
        /* PhyTxControlWord */
        phyctl = FRAMETYPE(rspec[0], wlc->mimoft);
@@ -6279,22 +6280,22 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
 
        /* phytxant is properly bit shifted */
        phyctl |= wlc_stf_d11hdrs_phyctl_txant(wlc, rspec[0]);
-       txh->PhyTxControlWord = htol16(phyctl);
+       txh->PhyTxControlWord = cpu_to_le16(phyctl);
 
        /* PhyTxControlWord_1 */
        if (WLC_PHY_11N_CAP(wlc->band)) {
                u16 phyctl1 = 0;
 
                phyctl1 = wlc_phytxctl1_calc(wlc, rspec[0]);
-               txh->PhyTxControlWord_1 = htol16(phyctl1);
+               txh->PhyTxControlWord_1 = cpu_to_le16(phyctl1);
                phyctl1 = wlc_phytxctl1_calc(wlc, rspec[1]);
-               txh->PhyTxControlWord_1_Fbr = htol16(phyctl1);
+               txh->PhyTxControlWord_1_Fbr = cpu_to_le16(phyctl1);
 
                if (use_rts || use_cts) {
                        phyctl1 = wlc_phytxctl1_calc(wlc, rts_rspec[0]);
-                       txh->PhyTxControlWord_1_Rts = htol16(phyctl1);
+                       txh->PhyTxControlWord_1_Rts = cpu_to_le16(phyctl1);
                        phyctl1 = wlc_phytxctl1_calc(wlc, rts_rspec[1]);
-                       txh->PhyTxControlWord_1_FbrRts = htol16(phyctl1);
+                       txh->PhyTxControlWord_1_FbrRts = cpu_to_le16(phyctl1);
                }
 
                /*
@@ -6305,13 +6306,13 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                if (IS_MCS(rspec[0]) && (preamble_type[0] == WLC_MM_PREAMBLE)) {
                        u16 mmodelen =
                            wlc_calc_lsig_len(wlc, rspec[0], phylen);
-                       txh->MModeLen = htol16(mmodelen);
+                       txh->MModeLen = cpu_to_le16(mmodelen);
                }
 
                if (IS_MCS(rspec[1]) && (preamble_type[1] == WLC_MM_PREAMBLE)) {
                        u16 mmodefbrlen =
                            wlc_calc_lsig_len(wlc, rspec[1], phylen);
-                       txh->MModeFbrLen = htol16(mmodefbrlen);
+                       txh->MModeFbrLen = cpu_to_le16(mmodefbrlen);
                }
        }
 
@@ -6345,8 +6346,9 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                                    wlc_calc_cts_time(wlc, rts_rspec[1],
                                                      rts_preamble_type[1]);
                                /* (SIFS + CTS) + SIFS + frame + SIFS + ACK */
-                               dur += ltoh16(rts->duration);
-                               dur_fallback += ltoh16(txh->RTSDurFallback);
+                               dur += le16_to_cpu(rts->duration);
+                               dur_fallback +=
+                                       le16_to_cpu(txh->RTSDurFallback);
                        } else if (use_rifs) {
                                dur = frag_dur;
                                dur_fallback = 0;
@@ -6366,9 +6368,10 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
                                                          preamble_type[1], 0);
                        }
                        /* NEED to set TxFesTimeNormal (hard) */
-                       txh->TxFesTimeNormal = htol16((u16) dur);
+                       txh->TxFesTimeNormal = cpu_to_le16((u16) dur);
                        /* NEED to set fallback rate version of TxFesTimeNormal (hard) */
-                       txh->TxFesTimeFallback = htol16((u16) dur_fallback);
+                       txh->TxFesTimeFallback =
+                               cpu_to_le16((u16) dur_fallback);
 
                        /* update txop byte threshold (txop minus intraframe overhead) */
                        if (wlc->edcf_txop[ac] >= (dur - frag_dur)) {
@@ -6636,7 +6639,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
                goto fatal;
 
        txh = (d11txh_t *) (p->data);
-       mcl = ltoh16(txh->MacTxControlLow);
+       mcl = le16_to_cpu(txh->MacTxControlLow);
 
        if (txs->phyerr) {
                if (WL_ERROR_ON()) {
@@ -6647,13 +6650,13 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
                wlc_print_txstatus(txs);
        }
 
-       ASSERT(txs->frameid == htol16(txh->TxFrameID));
-       if (txs->frameid != htol16(txh->TxFrameID))
+       ASSERT(txs->frameid == cpu_to_le16(txh->TxFrameID));
+       if (txs->frameid != cpu_to_le16(txh->TxFrameID))
                goto fatal;
 
        tx_info = IEEE80211_SKB_CB(p);
        h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
-       fc = ltoh16(h->frame_control);
+       fc = le16_to_cpu(h->frame_control);
 
        scb = (struct scb *)tx_info->control.sta->drv_priv;
 
@@ -6676,7 +6679,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
                WL_NONE("%s: Pkt tx suppressed, possibly channel %d\n",
                        __func__, CHSPEC_CHANNEL(wlc->default_bss->chanspec));
 
-       tx_rts = htol16(txh->MacTxControlLow) & TXC_SENDRTS;
+       tx_rts = cpu_to_le16(txh->MacTxControlLow) & TXC_SENDRTS;
        tx_frame_count =
            (txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT;
        tx_rts_count =
@@ -7091,7 +7094,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
 
        /* check received pkt has at least frame control field */
        if (len >= D11_PHY_HDR_LEN + sizeof(h->frame_control)) {
-               fc = ltoh16(h->frame_control);
+               fc = le16_to_cpu(h->frame_control);
        } else {
                wlc->pub->_cnt->rxrunt++;
                goto toss;
@@ -7716,7 +7719,7 @@ wlc_bcn_prb_template(struct wlc_info *wlc, uint type, ratespec_t bcn_rspec,
                h = (struct ieee80211_mgmt *)&plcp[1];
 
        /* fill in 802.11 header */
-       h->frame_control = htol16((u16) type);
+       h->frame_control = cpu_to_le16((u16) type);
 
        /* DUR is 0 for multicast bcn, or filled in by MAC for prb resp */
        /* A1 filled in by MAC for prb resp, broadcast for bcn */
@@ -7892,10 +7895,10 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
        ASSERT(txh);
        h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN);
        ASSERT(h);
-       fc = ltoh16(h->frame_control);
+       fc = le16_to_cpu(h->frame_control);
 
        /* get the pkt queue info. This was put at wlc_sendctl or wlc_send for PDU */
-       fifo = ltoh16(txh->TxFrameID) & TXFID_QUEUE_MASK;
+       fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK;
 
        scb = NULL;
 
@@ -7908,8 +7911,7 @@ int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifop)
                return BCME_BUSY;
        }
 
-       if ((ltoh16(txh->MacFrameControl) & IEEE80211_FCTL_FTYPE) !=
-           IEEE80211_FTYPE_DATA)
+       if (!ieee80211_is_data(txh->MacFrameControl))
                wlc->pub->_cnt->txctl++;
 
        return 0;
index 4123aefa211c8e944b902fc82eca6bd31da182f6..44b9f91f60ee4173e1400e942a6441f02c422bd3 100644 (file)
        ((u32)((((u32)(val) & (u32)0x0000ffffU) << 16) | \
                  (((u32)(val) & (u32)0xffff0000U) >> 16)))
 
-/* Byte swapping macros
- *    Host <=> Network (Big Endian) for 16- and 32-bit values
- *    Host <=> Little-Endian for 16- and 32-bit values
- */
-#ifndef hton16
-#ifndef IL_BIGENDIAN
-#define HTON16(i) BCMSWAP16(i)
-#define        hton16(i) bcmswap16(i)
-#define        HTON32(i) BCMSWAP32(i)
-#define        hton32(i) bcmswap32(i)
-#define        NTOH16(i) BCMSWAP16(i)
-#define        ntoh16(i) bcmswap16(i)
-#define        NTOH32(i) BCMSWAP32(i)
-#define        ntoh32(i) bcmswap32(i)
-#define LTOH16(i) (i)
-#define ltoh16(i) (i)
-#define LTOH32(i) (i)
-#define ltoh32(i) (i)
-#define HTOL16(i) (i)
-#define htol16(i) (i)
-#define HTOL32(i) (i)
-#define htol32(i) (i)
-#else                          /* IL_BIGENDIAN */
-#define HTON16(i) (i)
-#define        hton16(i) (i)
-#define        HTON32(i) (i)
-#define        hton32(i) (i)
-#define        NTOH16(i) (i)
-#define        ntoh16(i) (i)
-#define        NTOH32(i) (i)
-#define        ntoh32(i) (i)
-#define        LTOH16(i) BCMSWAP16(i)
-#define        ltoh16(i) bcmswap16(i)
-#define        LTOH32(i) BCMSWAP32(i)
-#define        ltoh32(i) bcmswap32(i)
-#define HTOL16(i) BCMSWAP16(i)
-#define htol16(i) bcmswap16(i)
-#define HTOL32(i) BCMSWAP32(i)
-#define htol32(i) bcmswap32(i)
-#endif                         /* IL_BIGENDIAN */
-#endif                         /* hton16 */
-
 #ifndef IL_BIGENDIAN
 #define ltoh16_buf(buf, i)
 #define htol16_buf(buf, i)
index 3f1d63ee7c481ce8515e658a62e829872e37b3e5..5d6489121b0a1b893ff22f379aa06c2bf560bdd6 100644 (file)
@@ -746,7 +746,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
        if (head == NULL)
                return NULL;
 
-       len = ltoh16(*(u16 *) (head->data));
+       len = le16_to_cpu(*(u16 *) (head->data));
        DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));
 
 #if defined(__mips__)
@@ -755,7 +755,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
                while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
                        udelay(1);
 
-               *(u16 *) (head->data) = htol16((u16) len);
+               *(u16 *) (head->data) = cpu_to_le16((u16) len);
        }
 #endif                         /* defined(__mips__) */