rtl8188eu: Replace several local size defines/typedefs with kernel header version

These include the following:

SIZE_T => size_t
SSIZE_T => ssize_t
SIZE_PTR => size_t

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-07-24 12:19:14 -05:00
parent 41ad3e27c6
commit 2685b52404
18 changed files with 58 additions and 63 deletions

View file

@ -1349,12 +1349,12 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb)
if (iph->protocol == IPPROTO_UDP) /* UDP */
{
struct udphdr *udph = (struct udphdr *)((SIZE_PTR)iph + (iph->ihl << 2));
struct udphdr *udph = (struct udphdr *)((size_t)iph + (iph->ihl << 2));
if ((udph->source == __constant_htons(CLIENT_PORT)) &&
(udph->dest == __constant_htons(SERVER_PORT))) { /* DHCP request */
struct dhcpMessage *dhcph =
(struct dhcpMessage *)((SIZE_PTR)udph + sizeof(struct udphdr));
(struct dhcpMessage *)((size_t)udph + sizeof(struct udphdr));
u32 cookie = be32_to_cpu((__be32)dhcph->cookie);
if (cookie == DHCP_MAGIC) { /* match magic word */

View file

@ -60,7 +60,7 @@ _func_enter_;
goto exit;
}
pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ( (SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ( (size_t)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
@ -69,7 +69,7 @@ _func_enter_;
goto exit;
}
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ( (SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ( (size_t)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->cmd_issued_cnt = pcmdpriv->cmd_done_cnt = pcmdpriv->rsp_cnt = 0;

View file

@ -940,8 +940,8 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
sa = GetAddr2Ptr(pframe);
auth_mode = psecuritypriv->dot11AuthAlgrthm;
seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + 2));
algorithm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN));
seq = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + 2));
algorithm = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN));
DBG_88E("auth alg=%x, seq=%X\n", algorithm, seq);
@ -1120,8 +1120,8 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame)
offset = (GetPrivacy(pframe))? 4: 0;
seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2));
status = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4));
seq = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + offset + 2));
status = le16_to_cpu(*(__le16 *)((size_t)pframe + WLAN_HDR_A3_LEN + offset + 4));
if (status != 0) {
DBG_88E("clnt auth fail, status: %d\n", status);

View file

@ -148,7 +148,7 @@ static int init_mp_priv_by_os(struct mp_priv *pmp_priv)
goto _exit_init_mp_priv;
}
pmp_priv->pmp_xmtframe_buf = pmp_priv->pallocated_mp_xmitframe_buf + 4 - ((SIZE_PTR) (pmp_priv->pallocated_mp_xmitframe_buf) & 3);
pmp_priv->pmp_xmtframe_buf = pmp_priv->pallocated_mp_xmitframe_buf + 4 - ((size_t) (pmp_priv->pallocated_mp_xmitframe_buf) & 3);
pmp_xmitframe = (struct mp_xmit_frame*)pmp_priv->pmp_xmtframe_buf;
@ -847,7 +847,7 @@ void SetPacketTx(PADAPTER padapter)
DBG_88E("%s: malloc(%d) fail!!\n", __func__, pmp_priv->tx.buf_size);
return;
}
pmp_priv->tx.buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pmp_priv->tx.pallocated_buf), XMITBUF_ALIGN_SZ);
pmp_priv->tx.buf = (u8 *)N_BYTE_ALIGMENT((size_t)(pmp_priv->tx.pallocated_buf), XMITBUF_ALIGN_SZ);
ptr = pmp_priv->tx.buf;
desc = &(pmp_priv->tx.desc);
@ -1129,7 +1129,7 @@ void _rtw_mp_xmit_priv (struct xmit_priv *pxmitpriv)
goto exit;
}
pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_xmit_extbuf), 4);
pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmit_extbuf), 4);
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;

View file

@ -76,7 +76,7 @@ _func_enter_;
goto exit;
}
precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
precvframe = (union recv_frame*) precvpriv->precv_frame_buf;

View file

@ -218,7 +218,7 @@ _func_enter_;
arcfour_encrypt(&mycontext, payload+length, crc, 4);
pframe+=pxmitpriv->frag_len;
pframe=(u8 *)RND4((SIZE_PTR)(pframe));
pframe=(u8 *)RND4((size_t)(pframe));
}
@ -717,7 +717,7 @@ _func_enter_;
arcfour_encrypt(&mycontext, payload+length, crc, 4);
pframe+=pxmitpriv->frag_len;
pframe=(u8 *)RND4((SIZE_PTR)(pframe));
pframe=(u8 *)RND4((size_t)(pframe));
}
}
@ -1525,7 +1525,7 @@ _func_enter_;
aes_cipher(prwskey,pattrib->hdrlen,pframe, length);
pframe+=pxmitpriv->frag_len;
pframe=(u8*)RND4((SIZE_PTR)(pframe));
pframe=(u8*)RND4((size_t)(pframe));
}
}

View file

@ -89,7 +89,7 @@ _func_enter_;
return _FAIL;
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
((SIZE_PTR)(pstapriv->pallocated_stainfo_buf ) & 3);
((size_t)(pstapriv->pallocated_stainfo_buf ) & 3);
_rtw_init_queue(&pstapriv->free_sta_queue);

View file

@ -118,9 +118,9 @@ _func_enter_;
res= _FAIL;
goto exit;
}
pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_frame_buf), 4);
pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_frame_buf), 4);
/* pxmitpriv->pxmit_frame_buf = pxmitpriv->pallocated_frame_buf + 4 - */
/* ((SIZE_PTR) (pxmitpriv->pallocated_frame_buf) &3); */
/* ((size_t) (pxmitpriv->pallocated_frame_buf) &3); */
pxframe = (struct xmit_frame*) pxmitpriv->pxmit_frame_buf;
@ -158,9 +158,9 @@ _func_enter_;
goto exit;
}
pxmitpriv->pxmitbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_xmitbuf), 4);
pxmitpriv->pxmitbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmitbuf), 4);
/* pxmitpriv->pxmitbuf = pxmitpriv->pallocated_xmitbuf + 4 - */
/* ((SIZE_PTR) (pxmitpriv->pallocated_xmitbuf) &3); */
/* ((size_t) (pxmitpriv->pallocated_xmitbuf) &3); */
pxmitbuf = (struct xmit_buf*)pxmitpriv->pxmitbuf;
@ -200,7 +200,7 @@ _func_enter_;
goto exit;
}
pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_xmit_extbuf), 4);
pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmit_extbuf), 4);
pxmitbuf = (struct xmit_buf*)pxmitpriv->pxmit_extbuf;
@ -220,7 +220,7 @@ _func_enter_;
goto exit;
}
pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), 4);
pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), 4);
*/
if ((res=rtw_os_xmit_resource_alloc(padapter, pxmitbuf,max_xmit_extbuf_size + XMITBUF_ALIGN_SZ)) == _FAIL) {
@ -856,7 +856,7 @@ _func_enter_;
payload=pframe;
for (curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++){
payload=(u8 *)RND4((SIZE_PTR)(payload));
payload=(u8 *)RND4((size_t)(payload));
RT_TRACE(_module_rtl871x_xmit_c_,_drv_err_,("===curfragnum=%d, pframe= 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,!!!\n",
curfragnum,*payload, *(payload+1),*(payload+2),*(payload+3),*(payload+4),*(payload+5),*(payload+6),*(payload+7)));
@ -1162,7 +1162,7 @@ s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxm
s32 frg_inx, frg_len, mpdu_len, llc_sz, mem_sz;
SIZE_PTR addr;
size_t addr;
u8 *pframe, *mem_start;
u8 hw_hdr_offset;
@ -1311,7 +1311,7 @@ _func_enter_;
RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("%s: There're still something in packet!\n", __func__));
}
addr = (SIZE_PTR)(pframe);
addr = (size_t)(pframe);
mem_start = (unsigned char *)RND4(addr) + hw_hdr_offset;
_rtw_memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen);

View file

@ -71,7 +71,7 @@ int rtl8188eu_init_recv_priv(_adapter *padapter)
}
_rtw_memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF *sizeof(struct recv_buf) + 4);
precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_recv_buf), 4);
precvbuf = (struct recv_buf*)precvpriv->precv_buf;
@ -101,8 +101,8 @@ int rtl8188eu_init_recv_priv(_adapter *padapter)
{
int i;
SIZE_PTR tmpaddr=0;
SIZE_PTR alignment=0;
size_t tmpaddr=0;
size_t alignment=0;
struct sk_buff *pskb=NULL;
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
@ -120,7 +120,7 @@ int rtl8188eu_init_recv_priv(_adapter *padapter)
{
pskb->dev = padapter->pnetdev;
tmpaddr = (SIZE_PTR)pskb->data;
tmpaddr = (size_t)pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));

View file

@ -477,7 +477,7 @@ static s32 rtw_dump_xframe(_adapter *padapter, struct xmit_frame *pxmitframe)
mem_addr += w_sz;
mem_addr = (u8 *)RND4(((SIZE_PTR)(mem_addr)));
mem_addr = (u8 *)RND4(((size_t)(mem_addr)));
}

View file

@ -450,7 +450,7 @@ static int recvbuf2recvframe(_adapter *padapter, _pkt *pskb)
precvframe->u.hdr.pkt = pkt_copy;
precvframe->u.hdr.rx_head = pkt_copy->data;
precvframe->u.hdr.rx_end = pkt_copy->data + alloc_sz;
skb_reserve( pkt_copy, 8 - ((SIZE_PTR)( pkt_copy->data ) & 7 ));/* force pkt_copy->data at 8-byte alignment address */
skb_reserve( pkt_copy, 8 - ((size_t)( pkt_copy->data ) & 7 ));/* force pkt_copy->data at 8-byte alignment address */
skb_reserve( pkt_copy, shift_sz );/* force ip_hdr at 8-byte alignment address according to shift_sz. */
_rtw_memcpy(pkt_copy->data, (pbuf + pattrib->drvinfo_sz + RXDESC_SIZE), skb_len);
precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pkt_copy->data;
@ -643,8 +643,8 @@ static u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
unsigned long irqL;
int err;
unsigned int pipe;
SIZE_PTR tmpaddr=0;
SIZE_PTR alignment=0;
size_t tmpaddr=0;
size_t alignment=0;
u32 ret = _SUCCESS;
struct urb * purb = NULL;
struct recv_buf *precvbuf = (struct recv_buf *)rmem;
@ -683,7 +683,7 @@ _func_enter_;
return _FAIL;
}
tmpaddr = (SIZE_PTR)precvbuf->pskb->data;
tmpaddr = (size_t)precvbuf->pskb->data;
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));

View file

@ -36,15 +36,10 @@ typedef signed int sint;
typedef void (*proc_t)(void*);
typedef __kernel_size_t SIZE_T;
typedef __kernel_ssize_t SSIZE_T;
#define FIELD_OFFSET(s,field) ((SSIZE_T)&((s*)(0))->field)
#define FIELD_OFFSET(s,field) ((ssize_t)&((s*)(0))->field)
#define MEM_ALIGNMENT_OFFSET (sizeof (SIZE_T))
#define MEM_ALIGNMENT_PADDING (sizeof(SIZE_T) - 1)
#define SIZE_PTR SIZE_T
#define SSIZE_PTR SSIZE_T
#define MEM_ALIGNMENT_OFFSET (sizeof (size_t))
#define MEM_ALIGNMENT_PADDING (sizeof(size_t) - 1)
//port from fw by thomas
// TODO: Belows are Sync from SD7-Driver. It is necessary to check correctness

View file

@ -140,7 +140,7 @@ __inline static _list *get_list_head(_queue *queue)
#define LIST_CONTAINOR(ptr, type, member) \
((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
((type *)((char *)(ptr)-(size_t)(&((type *)0)->member)))
__inline static void _enter_critical(_lock *plock, unsigned long *pirqL)

View file

@ -504,7 +504,7 @@ __inline static union recv_frame *rxmem_to_recvframe(u8 *rxmem)
//from any given member of recv_frame.
// rxmem indicates the any member/address in recv_frame
return (union recv_frame*)(((SIZE_PTR)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
return (union recv_frame*)(((size_t)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
}

View file

@ -350,29 +350,29 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(type); \
} while (0)
#define GetSequence(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 22)) >> 4)
#define GetSequence(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) >> 4)
#define GetFragNum(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 22)) & 0x0f)
#define GetFragNum(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 22)) & 0x0f)
#define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)))
#define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((size_t)(pbuf) + 22)))
#define SetFragNum(pbuf, num) \
do { \
*(unsigned short *)((SIZE_PTR)(pbuf) + 22) = \
((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
*(unsigned short *)((size_t)(pbuf) + 22) = \
((*(unsigned short *)((size_t)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \
cpu_to_le16(0x0f & (num)); \
} while (0)
#define SetSeqNum(pbuf, num) \
do { \
*(__le16 *)((SIZE_PTR)(pbuf) + 22) = \
((*(__le16 *)((SIZE_PTR)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
*(__le16 *)((size_t)(pbuf) + 22) = \
((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \
cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \
} while (0)
#define SetDuration(pbuf, dur) \
do { \
*(__le16 *)((SIZE_PTR)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)); \
*(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)); \
} while (0)
@ -402,19 +402,19 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16( (amsdu & 1) << 7); \
} while (0)
#define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff)
#define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff)
#define GetTid(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + \
#define GetTid(pbuf) (le16_to_cpu(*(__le16 *)((size_t)(pbuf) + \
(((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ? \
30 : 24))) & 0x000f)
#define GetAddr1Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 4))
#define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4))
#define GetAddr2Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 10))
#define GetAddr2Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 10))
#define GetAddr3Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 16))
#define GetAddr3Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 16))
#define GetAddr4Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 24))
#define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24))
#define MacAddr_isBcst(addr) \
( \

View file

@ -25,11 +25,11 @@
struct pkt_file {
_pkt *pkt;
SIZE_T pkt_len; //the remainder length of the open_file
size_t pkt_len; //the remainder length of the open_file
_buffer *cur_buffer;
u8 *buf_start;
u8 *cur_addr;
SIZE_T buf_len;
size_t buf_len;
};
#ifdef CONFIG_80211N_HT

View file

@ -205,7 +205,7 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
goto exit;
}
dvobj->usb_vendor_req_buf =
(u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(dvobj->usb_alloc_vendor_req_buf ), ALIGNMENT_UNIT);
(u8 *)N_BYTE_ALIGMENT((size_t)(dvobj->usb_alloc_vendor_req_buf ), ALIGNMENT_UNIT);
exit:
return rst;
}

View file

@ -33,7 +33,7 @@
uint rtw_remainder_len(struct pkt_file *pfile)
{
return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start)));
return (pfile->buf_len - ((size_t)(pfile->cur_addr) - (size_t)(pfile->buf_start)));
}
void _rtw_open_pktfile (_pkt *pktptr, struct pkt_file *pfile)
@ -99,7 +99,7 @@ int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf,u32
return _FAIL;
}
pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
pxmitbuf->dma_transfer_addr = 0;
for (i=0; i<8; i++) {