Commit 593c2b9c authored by Al Viro's avatar Al Viro Committed by David S. Miller

airo: trivial endianness annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4958730e
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/unaligned.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -811,7 +812,7 @@ typedef struct { ...@@ -811,7 +812,7 @@ typedef struct {
} MICRid; } MICRid;
typedef struct { typedef struct {
u16 typelen; __be16 typelen;
union { union {
u8 snap[8]; u8 snap[8];
...@@ -823,8 +824,8 @@ typedef struct { ...@@ -823,8 +824,8 @@ typedef struct {
u8 fieldtype[2]; u8 fieldtype[2];
} llc; } llc;
} u; } u;
u32 mic; __be32 mic;
u32 seq; __be32 seq;
} MICBuffer; } MICBuffer;
typedef struct { typedef struct {
...@@ -943,7 +944,7 @@ typedef struct { ...@@ -943,7 +944,7 @@ typedef struct {
int position; // current position (byte offset) in message int position; // current position (byte offset) in message
union { union {
u8 d8[4]; u8 d8[4];
u32 d32; __be32 d32;
} part; // saves partial message word across update() calls } part; // saves partial message word across update() calls
} emmh32_context; } emmh32_context;
...@@ -1635,7 +1636,7 @@ static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, ...@@ -1635,7 +1636,7 @@ static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
crypto_cipher_encrypt_one(tfm, plain, plain); crypto_cipher_encrypt_one(tfm, plain, plain);
cipher = plain; cipher = plain;
for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) { for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) {
context->coeff[i++] = ntohl(*(u32 *)&cipher[j]); context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]);
j += 4; j += 4;
} }
} }
...@@ -1668,12 +1669,12 @@ static void emmh32_update(emmh32_context *context, u8 *pOctets, int len) ...@@ -1668,12 +1669,12 @@ static void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
context->position++; context->position++;
len--; len--;
} while (byte_position < 4); } while (byte_position < 4);
MIC_ACCUM(htonl(context->part.d32)); MIC_ACCUM(ntohl(context->part.d32));
} }
/* deal with full 32-bit words */ /* deal with full 32-bit words */
while (len >= 4) { while (len >= 4) {
MIC_ACCUM(htonl(*(u32 *)pOctets)); MIC_ACCUM(ntohl(*(__be32 *)pOctets));
context->position += 4; context->position += 4;
pOctets += 4; pOctets += 4;
len -= 4; len -= 4;
...@@ -1706,7 +1707,7 @@ static void emmh32_final(emmh32_context *context, u8 digest[4]) ...@@ -1706,7 +1707,7 @@ static void emmh32_final(emmh32_context *context, u8 digest[4])
byte_position = context->position & 3; byte_position = context->position & 3;
if (byte_position) { if (byte_position) {
/* have a partial word in part to deal with */ /* have a partial word in part to deal with */
val = htonl(context->part.d32); val = ntohl(context->part.d32);
MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */ MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */
} }
...@@ -2026,7 +2027,8 @@ static int mpi_send_packet (struct net_device *dev) ...@@ -2026,7 +2027,8 @@ static int mpi_send_packet (struct net_device *dev)
{ {
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *buffer; unsigned char *buffer;
s16 len, *payloadLen; s16 len;
__le16 *payloadLen;
struct airo_info *ai = dev->priv; struct airo_info *ai = dev->priv;
u8 *sendbuf; u8 *sendbuf;
...@@ -2059,7 +2061,7 @@ static int mpi_send_packet (struct net_device *dev) ...@@ -2059,7 +2061,7 @@ static int mpi_send_packet (struct net_device *dev)
memcpy((char *)ai->txfids[0].virtual_host_addr, memcpy((char *)ai->txfids[0].virtual_host_addr,
(char *)&wifictlhdr8023, sizeof(wifictlhdr8023)); (char *)&wifictlhdr8023, sizeof(wifictlhdr8023));
payloadLen = (s16 *)(ai->txfids[0].virtual_host_addr + payloadLen = (__le16 *)(ai->txfids[0].virtual_host_addr +
sizeof(wifictlhdr8023)); sizeof(wifictlhdr8023));
sendbuf = ai->txfids[0].virtual_host_addr + sendbuf = ai->txfids[0].virtual_host_addr +
sizeof(wifictlhdr8023) + 2 ; sizeof(wifictlhdr8023) + 2 ;
...@@ -2069,7 +2071,7 @@ static int mpi_send_packet (struct net_device *dev) ...@@ -2069,7 +2071,7 @@ static int mpi_send_packet (struct net_device *dev)
* we don't need to account for it in the length * we don't need to account for it in the length
*/ */
if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
(ntohs(((u16 *)buffer)[6]) != 0x888E)) { (ntohs(((__be16 *)buffer)[6]) != 0x888E)) {
MICBuffer pMic; MICBuffer pMic;
if (encapsulate(ai, (etherHead *)buffer, &pMic, len - sizeof(etherHead)) != SUCCESS) if (encapsulate(ai, (etherHead *)buffer, &pMic, len - sizeof(etherHead)) != SUCCESS)
...@@ -2104,7 +2106,7 @@ static int mpi_send_packet (struct net_device *dev) ...@@ -2104,7 +2106,7 @@ static int mpi_send_packet (struct net_device *dev)
static void get_tx_error(struct airo_info *ai, s32 fid) static void get_tx_error(struct airo_info *ai, s32 fid)
{ {
u16 status; __le16 status;
if (fid < 0) if (fid < 0)
status = ((WifiCtlHdr *)ai->txfids[0].virtual_host_addr)->ctlhdr.status; 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,11 +3302,11 @@ static irqreturn_t airo_interrupt(int irq, void *dev_id)
u16 fc, len, hdrlen = 0; u16 fc, len, hdrlen = 0;
#pragma pack(1) #pragma pack(1)
struct { struct {
u16 status, len; __le16 status, len;
u8 rssi[2]; u8 rssi[2];
u8 rate; u8 rate;
u8 freq; u8 freq;
u16 tmp[4]; __le16 tmp[4];
} hdr; } hdr;
#pragma pack() #pragma pack()
u16 gap; u16 gap;
...@@ -3681,11 +3683,11 @@ void mpi_receive_802_11 (struct airo_info *ai) ...@@ -3681,11 +3683,11 @@ void mpi_receive_802_11 (struct airo_info *ai)
__le16 fc; __le16 fc;
#pragma pack(1) #pragma pack(1)
struct { struct {
u16 status, len; __le16 status, len;
u8 rssi[2]; u8 rssi[2];
u8 rate; u8 rate;
u8 freq; u8 freq;
u16 tmp[4]; __le16 tmp[4];
} hdr; } hdr;
#pragma pack() #pragma pack()
u16 gap; u16 gap;
...@@ -3721,9 +3723,8 @@ void mpi_receive_802_11 (struct airo_info *ai) ...@@ -3721,9 +3723,8 @@ void mpi_receive_802_11 (struct airo_info *ai)
ptr += hdrlen; ptr += hdrlen;
if (hdrlen == 24) if (hdrlen == 24)
ptr += 6; ptr += 6;
memcpy ((char *)&gap, ptr, sizeof(gap)); gap = le16_to_cpu(get_unaligned((__le16 *)ptr));
ptr += sizeof(gap); ptr += sizeof(__le16);
gap = le16_to_cpu(gap);
if (gap) { if (gap) {
if (gap <= 8) if (gap <= 8)
ptr += gap; ptr += gap;
...@@ -4151,7 +4152,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in ...@@ -4151,7 +4152,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in
// read the rid length field // read the rid length field
bap_read(ai, pBuf, 2, BAP1); bap_read(ai, pBuf, 2, BAP1);
// length for remaining part of rid // length for remaining part of rid
len = min(len, (int)le16_to_cpu(*(u16*)pBuf)) - 2; len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2;
if ( len <= 2 ) { if ( len <= 2 ) {
airo_print_err(ai->dev->name, airo_print_err(ai->dev->name,
...@@ -4177,7 +4178,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid, ...@@ -4177,7 +4178,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
u16 status; u16 status;
int rc = SUCCESS; int rc = SUCCESS;
*(u16*)pBuf = cpu_to_le16((u16)len); *(__le16*)pBuf = cpu_to_le16((u16)len);
if (lock) { if (lock) {
if (down_interruptible(&ai->sem)) if (down_interruptible(&ai->sem))
...@@ -4251,7 +4252,7 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw) ...@@ -4251,7 +4252,7 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw)
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
u16 txFid; u16 txFid;
u16 txControl; __le16 txControl;
cmd.cmd = CMD_ALLOCATETX; cmd.cmd = CMD_ALLOCATETX;
cmd.parm0 = lenPayload; cmd.parm0 = lenPayload;
...@@ -4305,7 +4306,7 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw) ...@@ -4305,7 +4306,7 @@ static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw)
Make sure the BAP1 spinlock is held when this is called. */ Make sure the BAP1 spinlock is held when this is called. */
static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
{ {
u16 payloadLen; __le16 payloadLen;
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
int miclen = 0; int miclen = 0;
...@@ -4321,7 +4322,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) ...@@ -4321,7 +4322,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
len -= ETH_ALEN * 2; len -= ETH_ALEN * 2;
if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
(ntohs(((u16 *)pPacket)[6]) != 0x888E)) { (ntohs(((__be16 *)pPacket)[6]) != 0x888E)) {
if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS)
return ERROR; return ERROR;
miclen = sizeof(pMic); miclen = sizeof(pMic);
...@@ -4348,7 +4349,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) ...@@ -4348,7 +4349,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket) static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket)
{ {
u16 fc, payloadLen; __le16 fc, payloadLen;
Cmd cmd; Cmd cmd;
Resp rsp; Resp rsp;
int hdrlen; int hdrlen;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment