aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-12-17 15:09:34 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:08:58 -0500
commit593c2b9cf28355c6c409d71594bed797279d01f5 (patch)
tree3298fa1827ace85427c3be9e99b163c7a9682720 /drivers/net/wireless/airo.c
parent4958730e2b4e10d29aa80574a848308ed95f508f (diff)
airo: trivial endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 87b6adbc34da..76cd1036e2d2 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -38,6 +38,7 @@
38#include <linux/crypto.h> 38#include <linux/crypto.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/system.h> 40#include <asm/system.h>
41#include <asm/unaligned.h>
41 42
42#include <linux/netdevice.h> 43#include <linux/netdevice.h>
43#include <linux/etherdevice.h> 44#include <linux/etherdevice.h>
@@ -811,7 +812,7 @@ typedef struct {
811} MICRid; 812} MICRid;
812 813
813typedef struct { 814typedef struct {
814 u16 typelen; 815 __be16 typelen;
815 816
816 union { 817 union {
817 u8 snap[8]; 818 u8 snap[8];
@@ -823,8 +824,8 @@ typedef struct {
823 u8 fieldtype[2]; 824 u8 fieldtype[2];
824 } llc; 825 } llc;
825 } u; 826 } u;
826 u32 mic; 827 __be32 mic;
827 u32 seq; 828 __be32 seq;
828} MICBuffer; 829} MICBuffer;
829 830
830typedef struct { 831typedef struct {
@@ -943,7 +944,7 @@ typedef struct {
943 int position; // current position (byte offset) in message 944 int position; // current position (byte offset) in message
944 union { 945 union {
945 u8 d8[4]; 946 u8 d8[4];
946 u32 d32; 947 __be32 d32;
947 } part; // saves partial message word across update() calls 948 } part; // saves partial message word across update() calls
948} emmh32_context; 949} emmh32_context;
949 950
@@ -1635,7 +1636,7 @@ static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
1635 crypto_cipher_encrypt_one(tfm, plain, plain); 1636 crypto_cipher_encrypt_one(tfm, plain, plain);
1636 cipher = plain; 1637 cipher = plain;
1637 for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) { 1638 for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) {
1638 context->coeff[i++] = ntohl(*(u32 *)&cipher[j]); 1639 context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]);
1639 j += 4; 1640 j += 4;
1640 } 1641 }
1641 } 1642 }
@@ -1668,12 +1669,12 @@ static void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
1668 context->position++; 1669 context->position++;
1669 len--; 1670 len--;
1670 } while (byte_position < 4); 1671 } while (byte_position < 4);
1671 MIC_ACCUM(htonl(context->part.d32)); 1672 MIC_ACCUM(ntohl(context->part.d32));
1672 } 1673 }
1673 1674
1674 /* deal with full 32-bit words */ 1675 /* deal with full 32-bit words */
1675 while (len >= 4) { 1676 while (len >= 4) {
1676 MIC_ACCUM(htonl(*(u32 *)pOctets)); 1677 MIC_ACCUM(ntohl(*(__be32 *)pOctets));
1677 context->position += 4; 1678 context->position += 4;
1678 pOctets += 4; 1679 pOctets += 4;
1679 len -= 4; 1680 len -= 4;
@@ -1706,7 +1707,7 @@ static void emmh32_final(emmh32_context *context, u8 digest[4])
1706 byte_position = context->position & 3; 1707 byte_position = context->position & 3;
1707 if (byte_position) { 1708 if (byte_position) {
1708 /* have a partial word in part to deal with */ 1709 /* have a partial word in part to deal with */
1709 val = htonl(context->part.d32); 1710 val = ntohl(context->part.d32);
1710 MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */ 1711 MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */
1711 } 1712 }
1712 1713
@@ -2026,7 +2027,8 @@ static int mpi_send_packet (struct net_device *dev)
2026{ 2027{
2027 struct sk_buff *skb; 2028 struct sk_buff *skb;
2028 unsigned char *buffer; 2029 unsigned char *buffer;
2029 s16 len, *payloadLen; 2030 s16 len;
2031 __le16 *payloadLen;
2030 struct airo_info *ai = dev->priv; 2032 struct airo_info *ai = dev->priv;
2031 u8 *sendbuf; 2033 u8 *sendbuf;
2032 2034
@@ -2059,7 +2061,7 @@ static int mpi_send_packet (struct net_device *dev)
2059 memcpy((char *)ai->txfids[0].virtual_host_addr, 2061 memcpy((char *)ai->txfids[0].virtual_host_addr,
2060 (char *)&wifictlhdr8023, sizeof(wifictlhdr8023)); 2062 (char *)&wifictlhdr8023, sizeof(wifictlhdr8023));
2061 2063
2062 payloadLen = (s16 *)(ai->txfids[0].virtual_host_addr + 2064 payloadLen = (__le16 *)(ai->txfids[0].virtual_host_addr +
2063 sizeof(wifictlhdr8023)); 2065 sizeof(wifictlhdr8023));
2064 sendbuf = ai->txfids[0].virtual_host_addr + 2066 sendbuf = ai->txfids[0].virtual_host_addr +
2065 sizeof(wifictlhdr8023) + 2 ; 2067 sizeof(wifictlhdr8023) + 2 ;
@@ -2069,7 +2071,7 @@ static int mpi_send_packet (struct net_device *dev)
2069 * we don't need to account for it in the length 2071 * we don't need to account for it in the length
2070 */ 2072 */
2071 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && 2073 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
2072 (ntohs(((u16 *)buffer)[6]) != 0x888E)) { 2074 (ntohs(((__be16 *)buffer)[6]) != 0x888E)) {
2073 MICBuffer pMic; 2075 MICBuffer pMic;
2074 2076
2075 if (encapsulate(ai, (etherHead *)buffer, &pMic, len - sizeof(etherHead)) != SUCCESS) 2077 if (encapsulate(ai, (etherHead *)buffer, &pMic, len - sizeof(etherHead)) != SUCCESS)
@@ -2104,7 +2106,7 @@ static int mpi_send_packet (struct net_device *dev)
2104 2106
2105static void get_tx_error(struct airo_info *ai, s32 fid) 2107static void get_tx_error(struct airo_info *ai, s32 fid)
2106{ 2108{
2107 u16 status; 2109 __le16 status;
2108 2110
2109 if (fid < 0) 2111 if (fid < 0)
2110 status = ((WifiCtlHdr *)ai->txfids[0].virtual_host_addr)->ctlhdr.status; 2112 status = ((WifiCtlHdr *)ai->txfids[0].virtual_host_addr)->ctlhdr.status;
@@ -3300,11 +3302,11 @@ static irqreturn_t airo_interrupt(int irq, void *dev_id)
3300 u16 fc, len, hdrlen = 0; 3302 u16 fc, len, hdrlen = 0;
3301#pragma pack(1) 3303#pragma pack(1)
3302 struct { 3304 struct {
3303 u16 status, len; 3305 __le16 status, len;
3304 u8 rssi[2]; 3306 u8 rssi[2];
3305 u8 rate; 3307 u8 rate;
3306 u8 freq; 3308 u8 freq;
3307 u16 tmp[4]; 3309 __le16 tmp[4];
3308 } hdr; 3310 } hdr;
3309#pragma pack() 3311#pragma pack()
3310 u16 gap; 3312 u16 gap;
@@ -3681,11 +3683,11 @@ void mpi_receive_802_11 (struct airo_info *ai)
3681 __le16 fc; 3683 __le16 fc;
3682#pragma pack(1) 3684#pragma pack(1)
3683 struct { 3685 struct {
3684 u16 status, len; 3686 __le16 status, len;
3685 u8 rssi[2]; 3687 u8 rssi[2];
3686 u8 rate; 3688 u8 rate;
3687 u8 freq; 3689 u8 freq;
3688 u16 tmp[4]; 3690 __le16 tmp[4];
3689 } hdr; 3691 } hdr;
3690#pragma pack() 3692#pragma pack()
3691 u16 gap; 3693 u16 gap;
@@ -3721,9 +3723,8 @@ void mpi_receive_802_11 (struct airo_info *ai)
3721 ptr += hdrlen; 3723 ptr += hdrlen;
3722 if (hdrlen == 24) 3724 if (hdrlen == 24)
3723 ptr += 6; 3725 ptr += 6;
3724 memcpy ((char *)&gap, ptr, sizeof(gap)); 3726 gap = le16_to_cpu(get_unaligned((__le16 *)ptr));
3725 ptr += sizeof(gap); 3727 ptr += sizeof(__le16);
3726 gap = le16_to_cpu(gap);
3727 if (gap) { 3728 if (gap) {
3728 if (gap <= 8) 3729 if (gap <= 8)
3729 ptr += gap; 3730 ptr += gap;
@@ -4151,7 +4152,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in
4151 // read the rid length field 4152 // read the rid length field
4152 bap_read(ai, pBuf, 2, BAP1); 4153 bap_read(ai, pBuf, 2, BAP1);
4153 // length for remaining part of rid 4154 // length for remaining part of rid
4154 len = min(len, (int)le16_to_cpu(*(u16*)pBuf)) - 2; 4155 len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2;
4155 4156
4156 if ( len <= 2 ) { 4157 if ( len <= 2 ) {
4157 airo_print_err(ai->dev->name, 4158 airo_print_err(ai->dev->name,
@@ -4177,7 +4178,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
4177 u16 status; 4178 u16 status;
4178 int rc = SUCCESS; 4179 int rc = SUCCESS;
4179 4180
4180 *(u16*)pBuf = cpu_to_le16((u16)len); 4181 *(__le16*)pBuf = cpu_to_le16((u16)len);
4181 4182
4182 if (lock) { 4183 if (lock) {
4183 if (down_interruptible(&ai->sem)) 4184 if (down_interruptible(&ai->sem))
@@ -4251,7 +4252,7 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw)
4251 Cmd cmd; 4252 Cmd cmd;
4252 Resp rsp; 4253 Resp rsp;
4253 u16 txFid; 4254 u16 txFid;
4254 u16 txControl; 4255 __le16 txControl;
4255 4256
4256 cmd.cmd = CMD_ALLOCATETX; 4257 cmd.cmd = CMD_ALLOCATETX;
4257 cmd.parm0 = lenPayload; 4258 cmd.parm0 = lenPayload;
@@ -4305,7 +4306,7 @@ done:
4305 Make sure the BAP1 spinlock is held when this is called. */ 4306 Make sure the BAP1 spinlock is held when this is called. */
4306static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) 4307static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
4307{ 4308{
4308 u16 payloadLen; 4309 __le16 payloadLen;
4309 Cmd cmd; 4310 Cmd cmd;
4310 Resp rsp; 4311 Resp rsp;
4311 int miclen = 0; 4312 int miclen = 0;
@@ -4321,7 +4322,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
4321 len -= ETH_ALEN * 2; 4322 len -= ETH_ALEN * 2;
4322 4323
4323 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && 4324 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
4324 (ntohs(((u16 *)pPacket)[6]) != 0x888E)) { 4325 (ntohs(((__be16 *)pPacket)[6]) != 0x888E)) {
4325 if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) 4326 if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS)
4326 return ERROR; 4327 return ERROR;
4327 miclen = sizeof(pMic); 4328 miclen = sizeof(pMic);
@@ -4348,7 +4349,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
4348 4349
4349static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket) 4350static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket)
4350{ 4351{
4351 u16 fc, payloadLen; 4352 __le16 fc, payloadLen;
4352 Cmd cmd; 4353 Cmd cmd;
4353 Resp rsp; 4354 Resp rsp;
4354 int hdrlen; 4355 int hdrlen;