do {} while (0) allows #defines to be used in if tests. Neaten arguments and statements in the macros. Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> --- drivers/staging/ath6kl/bmi/src/bmi.c | 6 +- .../staging/ath6kl/hif/common/hif_sdio_common.h | 6 +- .../staging/ath6kl/hif/sdio/linux_sdio/src/hif.c | 22 ++-- .../ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c | 2 +- drivers/staging/ath6kl/htc2/AR6000/ar6k.c | 23 ++-- drivers/staging/ath6kl/htc2/AR6000/ar6k.h | 25 ++-- .../ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c | 17 ++- drivers/staging/ath6kl/htc2/htc_internal.h | 78 +++++++------ drivers/staging/ath6kl/htc2/htc_recv.c | 54 +++++---- drivers/staging/ath6kl/htc2/htc_send.c | 6 +- drivers/staging/ath6kl/include/a_debug.h | 8 +- drivers/staging/ath6kl/include/athbtfilter.h | 40 ++++--- drivers/staging/ath6kl/include/common/a_hci.h | 5 +- drivers/staging/ath6kl/include/common/dsetid.h | 2 +- .../staging/ath6kl/include/common/epping_test.h | 22 ++-- drivers/staging/ath6kl/include/common/htc.h | 22 ++-- .../staging/ath6kl/include/common/htc_services.h | 2 +- .../include/common/regulatory/reg_dbschema.h | 38 +++--- drivers/staging/ath6kl/include/common/wlan_defs.h | 24 ++-- drivers/staging/ath6kl/include/common/wmi_thin.h | 16 ++- drivers/staging/ath6kl/include/dl_list.h | 37 ++++--- drivers/staging/ath6kl/include/htc_packet.h | 127 +++++++++++--------- drivers/staging/ath6kl/miscdrv/common_drv.c | 6 +- drivers/staging/ath6kl/miscdrv/credit_dist.c | 12 +- drivers/staging/ath6kl/miscdrv/miscdrv.h | 2 +- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 29 +++-- drivers/staging/ath6kl/os/linux/hci_bridge.c | 3 +- .../staging/ath6kl/os/linux/include/ar6000_drv.h | 126 +++++++++++-------- .../staging/ath6kl/os/linux/include/debug_linux.h | 17 ++- .../staging/ath6kl/os/linux/include/osapi_linux.h | 83 ++++++++----- drivers/staging/ath6kl/os/linux/ioctl.c | 17 ++-- drivers/staging/ath6kl/os/linux/wireless_ext.c | 5 +- drivers/staging/ath6kl/wlan/include/ieee80211.h | 32 +++--- .../staging/ath6kl/wlan/include/ieee80211_node.h | 15 ++- drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c | 24 ++-- drivers/staging/ath6kl/wmi/wmi.c | 2 +- 36 files changed, 535 insertions(+), 420 deletions(-) diff --git a/drivers/staging/ath6kl/bmi/src/bmi.c b/drivers/staging/ath6kl/bmi/src/bmi.c index dc034d7..34030a1 100644 --- a/drivers/staging/ath6kl/bmi/src/bmi.c +++ b/drivers/staging/ath6kl/bmi/src/bmi.c @@ -57,9 +57,9 @@ static bool pendingEventsFuncCheck = false; static u32 *pBMICmdCredits; static A_UCHAR *pBMICmdBuf; #define MAX_BMI_CMDBUF_SZ (BMI_DATASZ_MAX + \ - sizeof(u32) /* cmd */ + \ - sizeof(u32) /* addr */ + \ - sizeof(u32))/* length */ + sizeof(u32) + /* cmd */ \ + sizeof(u32) + /* addr */ \ + sizeof(u32)) /* length */ #define BMI_COMMAND_FITS(sz) ((sz) <= MAX_BMI_CMDBUF_SZ) /* APIs visible to the driver */ diff --git a/drivers/staging/ath6kl/hif/common/hif_sdio_common.h b/drivers/staging/ath6kl/hif/common/hif_sdio_common.h index 5dad450..3979cee 100644 --- a/drivers/staging/ath6kl/hif/common/hif_sdio_common.h +++ b/drivers/staging/ath6kl/hif/common/hif_sdio_common.h @@ -35,10 +35,10 @@ /* Mailbox address in SDIO address space */ #define HIF_MBOX_BASE_ADDR 0x800 #define HIF_MBOX_WIDTH 0x800 -#define HIF_MBOX_START_ADDR(mbox) \ - ( HIF_MBOX_BASE_ADDR + mbox * HIF_MBOX_WIDTH) +#define HIF_MBOX_START_ADDR(mbox) \ + (HIF_MBOX_BASE_ADDR + mbox * HIF_MBOX_WIDTH) -#define HIF_MBOX_END_ADDR(mbox) \ +#define HIF_MBOX_END_ADDR(mbox) \ (HIF_MBOX_START_ADDR(mbox) + HIF_MBOX_WIDTH - 1) /* extended MBOX address for larger MBOX writes to MBOX 0*/ diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c index c4c27b9..c35102cf 100644 --- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c +++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif.c @@ -1248,19 +1248,19 @@ void HIFDetachHTC(HIF_DEVICE *device) A_MEMZERO(&device->htcCallbacks,sizeof(device->htcCallbacks)); } -#define SDIO_SET_CMD52_ARG(arg,rw,func,raw,address,writedata) \ - (arg) = (((rw) & 1) << 31) | \ - (((func) & 0x7) << 28) | \ - (((raw) & 1) << 27) | \ - (1 << 26) | \ - (((address) & 0x1FFFF) << 9) | \ - (1 << 8) | \ +#define SDIO_SET_CMD52_ARG(arg, rw, func, raw, address, writedata) \ + (arg) = (((rw) & 1) << 31) | \ + (((func) & 0x7) << 28) | \ + (((raw) & 1) << 27) | \ + (1 << 26) | \ + (((address) & 0x1FFFF) << 9) | \ + (1 << 8) | \ ((writedata) & 0xFF) -#define SDIO_SET_CMD52_READ_ARG(arg,func,address) \ - SDIO_SET_CMD52_ARG(arg,0,(func),0,address,0x00) -#define SDIO_SET_CMD52_WRITE_ARG(arg,func,address,value) \ - SDIO_SET_CMD52_ARG(arg,1,(func),0,address,value) +#define SDIO_SET_CMD52_READ_ARG(arg, func, address) \ + SDIO_SET_CMD52_ARG(arg, 0, (func), 0, address, 0x00) +#define SDIO_SET_CMD52_WRITE_ARG(arg,func,address,value) \ + SDIO_SET_CMD52_ARG(arg, 1, (func), 0, address, value) static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte) { diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c index ff1368d..4229b62 100644 --- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c +++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c @@ -40,7 +40,7 @@ #define _CMD53_ARG_FIXED_ADDRESS 0 #define _CMD53_ARG_INCR_ADDRESS 1 -#define SDIO_SET_CMD53_ARG(arg,rw,func,mode,opcode,address,bytes_blocks) \ +#define SDIO_SET_CMD53_ARG(arg, rw, func, mode, opcode, address, bytes_blocks) \ (arg) = (((rw) & 1) << 31) | \ (((func) & 0x7) << 28) | \ (((mode) & 1) << 27) | \ diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k.c index 9484766..1f45d85 100644 --- a/drivers/staging/ath6kl/htc2/AR6000/ar6k.c +++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k.c @@ -993,10 +993,11 @@ int DevSubmitScatterRequest(AR6K_DEVICE *pDev, HIF_SCATTER_REQ *pScatterReq, boo #define BUFFER4 800 #endif -#define TOTAL_BYTES (A_ROUND_UP_PWR2(BUFFER1,BUFFER_BLOCK_PAD) + \ - A_ROUND_UP_PWR2(BUFFER2,BUFFER_BLOCK_PAD) + \ - A_ROUND_UP_PWR2(BUFFER3,BUFFER_BLOCK_PAD) + \ - A_ROUND_UP_PWR2(BUFFER4,BUFFER_BLOCK_PAD) ) +#define TOTAL_BYTES \ + (A_ROUND_UP_PWR2(BUFFER1,BUFFER_BLOCK_PAD) + \ + A_ROUND_UP_PWR2(BUFFER2,BUFFER_BLOCK_PAD) + \ + A_ROUND_UP_PWR2(BUFFER3,BUFFER_BLOCK_PAD) + \ + A_ROUND_UP_PWR2(BUFFER4,BUFFER_BLOCK_PAD) ) #define TEST_BYTES (BUFFER1 + BUFFER2 + BUFFER3 + BUFFER4) @@ -1014,13 +1015,13 @@ typedef struct _BUFFER_PROC_LIST{ }BUFFER_PROC_LIST; -#define PUSH_BUFF_PROC_ENTRY(pList,len,pCurrpos) \ -{ \ - (pList)->pBuffer = (pCurrpos); \ - (pList)->length = (len); \ - (pCurrpos) += (len); \ - (pList)++; \ -} +#define PUSH_BUFF_PROC_ENTRY(pList, len, pCurrpos) \ +do { \ + (pList)->pBuffer = (pCurrpos); \ + (pList)->length = (len); \ + (pCurrpos) += (len); \ + (pList)++; \ +} while (0) /* a simple and crude way to send different "message" sizes */ static void AssembleBufferList(BUFFER_PROC_LIST *pList) diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k.h b/drivers/staging/ath6kl/htc2/AR6000/ar6k.h index 31c0f8c..2e53ed3 100644 --- a/drivers/staging/ath6kl/htc2/AR6000/ar6k.h +++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k.h @@ -35,9 +35,10 @@ #define AR6K_TARGET_DEBUG_INTR_MASK 0x01 -#define OTHER_INTS_ENABLED (INT_STATUS_ENABLE_ERROR_MASK | \ - INT_STATUS_ENABLE_CPU_MASK | \ - INT_STATUS_ENABLE_COUNTER_MASK) +#define OTHER_INTS_ENABLED \ + (INT_STATUS_ENABLE_ERROR_MASK | \ + INT_STATUS_ENABLE_CPU_MASK | \ + INT_STATUS_ENABLE_COUNTER_MASK) //#define MBOXHW_UNIT_TEST 1 @@ -260,7 +261,7 @@ static INLINE int DevRecvPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, u32 Recv return status; } -#define DEV_CHECK_RECV_YIELD(pDev) \ +#define DEV_CHECK_RECV_YIELD(pDev) \ ((pDev)->CurrentDSRRecvCount >= (pDev)->HifIRQYieldParams.RecvPacketYieldCount) #define IS_DEV_IRQ_PROC_SYNC_MODE(pDev) (HIF_DEVICE_IRQ_SYNC_ONLY == (pDev)->HifIRQProcessingMode) @@ -365,14 +366,14 @@ void GMboxProtocolUninstall(AR6K_DEVICE *pDev); /* API used by GMBOX protocol modules */ AR6K_DEVICE *HTCGetAR6KDevice(void *HTCHandle); -#define DEV_GMBOX_SET_PROTOCOL(pDev,recv_callback,credits_pending,failure,statedump,context) \ -{ \ - (pDev)->GMboxInfo.pProtocolContext = (context); \ - (pDev)->GMboxInfo.pMessagePendingCallBack = (recv_callback); \ - (pDev)->GMboxInfo.pCreditsPendingCallback = (credits_pending); \ - (pDev)->GMboxInfo.pTargetFailureCallback = (failure); \ - (pDev)->GMboxInfo.pStateDumpCallback = (statedump); \ -} +#define DEV_GMBOX_SET_PROTOCOL(pDev, recv_callback, credits_pending, failure, statedump, context) \ +do { \ + (pDev)->GMboxInfo.pProtocolContext = (context); \ + (pDev)->GMboxInfo.pMessagePendingCallBack = (recv_callback); \ + (pDev)->GMboxInfo.pCreditsPendingCallback = (credits_pending); \ + (pDev)->GMboxInfo.pTargetFailureCallback = (failure); \ + (pDev)->GMboxInfo.pStateDumpCallback = (statedump); \ +} while (0) #define DEV_GMBOX_GET_PROTOCOL(pDev) (pDev)->GMboxInfo.pProtocolContext diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c index 8263b2c..a85a221 100644 --- a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c +++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c @@ -82,10 +82,10 @@ typedef struct { #define LOCK_HCI_TX(t) A_MUTEX_LOCK(&(t)->HCITxLock); #define UNLOCK_HCI_TX(t) A_MUTEX_UNLOCK(&(t)->HCITxLock); -#define DO_HCI_RECV_INDICATION(p, pt) \ -do { \ +#define DO_HCI_RECV_INDICATION(p, pt) \ +do { \ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, \ - ("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d \n", \ + ("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d\n", \ (unsigned long)(pt), \ (pt)->Status, \ !(pt)->Status ? (pt)->ActualLength : 0, \ @@ -93,11 +93,14 @@ do { \ (p)->HCIConfig.pHCIPktRecv((p)->HCIConfig.pContext, (pt)); \ } while (0) -#define DO_HCI_SEND_INDICATION(p,pt) \ -{ AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: Indicate Send on packet:0x%lX status:%d type:%d \n", \ - (unsigned long)(pt),(pt)->Status,HCI_GET_PACKET_TYPE(pt))); \ +#define DO_HCI_SEND_INDICATION(p, pt) \ +do { \ + AR_DEBUG_PRINTF(ATH_DEBUG_SEND, \ + ("HCI: Indicate Send on packet:0x%lX status:%d type:%d\n", \ + (unsigned long)(pt), (pt)->Status, \ + HCI_GET_PACKET_TYPE(pt))); \ (p)->HCIConfig.pHCISendComplete((p)->HCIConfig.pContext, (pt)); \ -} +} while (0) static int HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, bool Synchronous); diff --git a/drivers/staging/ath6kl/htc2/htc_internal.h b/drivers/staging/ath6kl/htc2/htc_internal.h index 316ff2e..257556e 100644 --- a/drivers/staging/ath6kl/htc2/htc_internal.h +++ b/drivers/staging/ath6kl/htc2/htc_internal.h @@ -88,9 +88,9 @@ typedef struct _HTC_ENDPOINT { } HTC_ENDPOINT; #ifdef HTC_EP_STAT_PROFILING -#define INC_HTC_EP_STAT(p,stat,count) (p)->EndPointStats.stat += (count); +#define INC_HTC_EP_STAT(p, stat, count) (p)->EndPointStats.stat += (count) #else -#define INC_HTC_EP_STAT(p,stat,count) +#define INC_HTC_EP_STAT(p, stat, count) do {} while (0) #endif #define HTC_SERVICE_TX_PACKET_TAG HTC_TX_PACKET_TAG_INTERNAL @@ -140,26 +140,25 @@ typedef struct _HTC_TARGET { } HTC_TARGET; #define HTC_STOPPING(t) ((t)->OpStateFlags & HTC_OP_STATE_STOPPING) -#define LOCK_HTC(t) A_MUTEX_LOCK(&(t)->HTCLock); -#define UNLOCK_HTC(t) A_MUTEX_UNLOCK(&(t)->HTCLock); -#define LOCK_HTC_RX(t) A_MUTEX_LOCK(&(t)->HTCRxLock); -#define UNLOCK_HTC_RX(t) A_MUTEX_UNLOCK(&(t)->HTCRxLock); -#define LOCK_HTC_TX(t) A_MUTEX_LOCK(&(t)->HTCTxLock); -#define UNLOCK_HTC_TX(t) A_MUTEX_UNLOCK(&(t)->HTCTxLock); +#define LOCK_HTC(t) A_MUTEX_LOCK(&(t)->HTCLock) +#define UNLOCK_HTC(t) A_MUTEX_UNLOCK(&(t)->HTCLock) +#define LOCK_HTC_RX(t) A_MUTEX_LOCK(&(t)->HTCRxLock) +#define UNLOCK_HTC_RX(t) A_MUTEX_UNLOCK(&(t)->HTCRxLock) +#define LOCK_HTC_TX(t) A_MUTEX_LOCK(&(t)->HTCTxLock) +#define UNLOCK_HTC_TX(t) A_MUTEX_UNLOCK(&(t)->HTCTxLock) #define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd)) -#define HTC_RECYCLE_RX_PKT(target,p,e) \ -{ \ +#define HTC_RECYCLE_RX_PKT(target, p, e) \ +do { \ if ((p)->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_NO_RECYCLE) { \ - HTC_PACKET_RESET_RX(pPacket); \ - pPacket->Status = A_ECANCELED; \ - (e)->EpCallBacks.EpRecv((e)->EpCallBacks.pContext, \ - (p)); \ + HTC_PACKET_RESET_RX(pPacket); \ + pPacket->Status = A_ECANCELED; \ + (e)->EpCallBacks.EpRecv((e)->EpCallBacks.pContext, (p));\ } else { \ HTC_PACKET_RESET_RX(pPacket); \ HTCAddReceivePkt((HTC_HANDLE)(target),(p)); \ } \ -} +} while (0) /* internal HTC functions */ void HTCControlTxComplete(void *Context, HTC_PACKET *pPacket); @@ -190,28 +189,37 @@ static INLINE HTC_PACKET *HTC_ALLOC_CONTROL_TX(HTC_TARGET *target) { return pPacket; } -#define HTC_FREE_CONTROL_TX(t,p) HTCFreeControlBuffer((t),(p),&(t)->ControlBufferTXFreeList) -#define HTC_ALLOC_CONTROL_RX(t) HTCAllocControlBuffer((t),&(t)->ControlBufferRXFreeList) -#define HTC_FREE_CONTROL_RX(t,p) \ -{ \ - HTC_PACKET_RESET_RX(p); \ - HTCFreeControlBuffer((t),(p),&(t)->ControlBufferRXFreeList); \ -} - -#define HTC_PREPARE_SEND_PKT(pP,sendflags,ctrl0,ctrl1) \ -{ \ - u8 *pHdrBuf; \ - (pP)->pBuffer -= HTC_HDR_LENGTH; \ +#define HTC_FREE_CONTROL_TX(t, p) \ + HTCFreeControlBuffer((t), (p), &(t)->ControlBufferTXFreeList) +#define HTC_ALLOC_CONTROL_RX(t) \ + HTCAllocControlBuffer((t), &(t)->ControlBufferRXFreeList) +#define HTC_FREE_CONTROL_RX(t, p) \ +do { \ + HTC_PACKET_RESET_RX(p); \ + HTCFreeControlBuffer((t), (p), &(t)->ControlBufferRXFreeList); \ +} while (0) + +#define HTC_PREPARE_SEND_PKT(pP, sendflags, ctrl0, ctrl1) \ +do { \ + u8 *pHdrBuf; \ + (pP)->pBuffer -= HTC_HDR_LENGTH; \ pHdrBuf = (pP)->pBuffer; \ - A_SET_UINT16_FIELD(pHdrBuf,HTC_FRAME_HDR,PayloadLen,(u16)(pP)->ActualLength); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,Flags,(sendflags)); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,EndpointID, (u8)(pP)->Endpoint); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,ControlBytes[0], (u8)(ctrl0)); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,ControlBytes[1], (u8)(ctrl1)); \ -} - -#define HTC_UNPREPARE_SEND_PKT(pP) \ + A_SET_UINT16_FIELD(pHdrBuf, HTC_FRAME_HDR, \ + PayloadLen, (u16)(pP)->ActualLength); \ + A_SET_UINT8_FIELD(pHdrBuf, HTC_FRAME_HDR, \ + Flags,(sendflags)); \ + A_SET_UINT8_FIELD(pHdrBuf, HTC_FRAME_HDR, \ + EndpointID, (u8)(pP)->Endpoint); \ + A_SET_UINT8_FIELD(pHdrBuf, HTC_FRAME_HDR, \ + ControlBytes[0], (u8)(ctrl0)); \ + A_SET_UINT8_FIELD(pHdrBuf, HTC_FRAME_HDR, \ + ControlBytes[1], (u8)(ctrl1)); \ +} while (0) + +#define HTC_UNPREPARE_SEND_PKT(pP) \ +do { \ (pP)->pBuffer += HTC_HDR_LENGTH; \ +} while (0) #ifdef __cplusplus } diff --git a/drivers/staging/ath6kl/htc2/htc_recv.c b/drivers/staging/ath6kl/htc2/htc_recv.c index 3eaaa7f..0c35605 100644 --- a/drivers/staging/ath6kl/htc2/htc_recv.c +++ b/drivers/staging/ath6kl/htc2/htc_recv.c @@ -22,32 +22,34 @@ //============================================================================== #include "htc_internal.h" -#define HTCIssueRecv(t, p) \ +#define HTCIssueRecv(t, p) \ DevRecvPacket(&(t)->Device, \ (p), \ (p)->ActualLength) -#define DO_RCV_COMPLETION(e,q) DoRecvCompletion(e,q) +#define DO_RCV_COMPLETION(e, q) DoRecvCompletion(e, q) -#define DUMP_RECV_PKT_INFO(pP) \ - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC RECV packet 0x%lX (%d bytes) (hdr:0x%X) on ep : %d \n", \ - (unsigned long)(pP), \ - (pP)->ActualLength, \ - (pP)->PktInfo.AsRx.ExpectedHdr, \ - (pP)->Endpoint)) +#define DUMP_RECV_PKT_INFO(pP) \ + AR_DEBUG_PRINTF(ATH_DEBUG_RECV, \ + (" HTC RECV packet 0x%lX (%d bytes) (hdr:0x%X) on ep : %d \n", \ + (unsigned long)(pP), \ + (pP)->ActualLength, \ + (pP)->PktInfo.AsRx.ExpectedHdr, \ + (pP)->Endpoint)) #ifdef HTC_EP_STAT_PROFILING -#define HTC_RX_STAT_PROFILE(t,ep,numLookAheads) \ -{ \ - INC_HTC_EP_STAT((ep), RxReceived, 1); \ - if ((numLookAheads) == 1) { \ - INC_HTC_EP_STAT((ep), RxLookAheads, 1); \ - } else if ((numLookAheads) > 1) { \ - INC_HTC_EP_STAT((ep), RxBundleLookAheads, 1); \ - } \ -} +#define HTC_RX_STAT_PROFILE(t, ep, numLookAheads) \ +do { \ + INC_HTC_EP_STAT((ep), RxReceived, 1); \ + if ((numLookAheads) == 1) \ + INC_HTC_EP_STAT((ep), RxLookAheads, 1); \ + else if ((numLookAheads) > 1) \ + INC_HTC_EP_STAT((ep), RxBundleLookAheads, 1); \ +} while (0) #else -#define HTC_RX_STAT_PROFILE(t,ep,lookAhead) +#define HTC_RX_STAT_PROFILE(t, ep, lookAhead) \ + do {} while (0) + #endif static void DoRecvCompletion(HTC_ENDPOINT *pEndpoint, @@ -488,13 +490,19 @@ static INLINE void DrainRecvIndicationQueue(HTC_TARGET *target, HTC_ENDPOINT *pE /* optimization for recv packets, we can indicate a "hint" that there are more * single-packets to fetch on this endpoint */ -#define SET_MORE_RX_PACKET_INDICATION_FLAG(L,N,E,P) \ - if ((N) > 0) { SetRxPacketIndicationFlags((L)[0],(E),(P)); } +#define SET_MORE_RX_PACKET_INDICATION_FLAG(L, N, E, P) \ +do { \ + if ((N) > 0) { \ + SetRxPacketIndicationFlags((L)[0], (E), (P)); \ + } \ +} while (0) /* for bundled frames, we can force the flag to indicate there are more packets */ -#define FORCE_MORE_RX_PACKET_INDICATION_FLAG(P) \ - (P)->PktInfo.AsRx.IndicationFlags |= HTC_RX_FLAGS_INDICATE_MORE_PKTS; - +#define FORCE_MORE_RX_PACKET_INDICATION_FLAG(P) \ +do { \ + (P)->PktInfo.AsRx.IndicationFlags |= HTC_RX_FLAGS_INDICATE_MORE_PKTS; \ +} while (0) + /* note: this function can be called with the RX lock held */ static INLINE void SetRxPacketIndicationFlags(u32 LookAhead, HTC_ENDPOINT *pEndpoint, diff --git a/drivers/staging/ath6kl/htc2/htc_send.c b/drivers/staging/ath6kl/htc2/htc_send.c index 4d216a2..417a553 100644 --- a/drivers/staging/ath6kl/htc2/htc_send.c +++ b/drivers/staging/ath6kl/htc2/htc_send.c @@ -30,8 +30,8 @@ typedef enum _HTC_SEND_QUEUE_RESULT { #define DO_EP_TX_COMPLETION(ep,q) DoSendCompletion(ep,q) /* call the distribute credits callback with the distribution */ -#define DO_DISTRIBUTION(t,reason,description,pList) \ -{ \ +#define DO_DISTRIBUTION(t,reason,description,pList) \ +do { \ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, \ (" calling distribute function (%s) (dfn:0x%lX, ctxt:0x%lX, dist:0x%lX) \n", \ (description), \ @@ -41,7 +41,7 @@ typedef enum _HTC_SEND_QUEUE_RESULT { (t)->DistributeCredits((t)->pCredDistContext, \ (pList), \ (reason)); \ -} +} while (0) static void DoSendCompletion(HTC_ENDPOINT *pEndpoint, HTC_PACKET_QUEUE *pQueueToIndicate) diff --git a/drivers/staging/ath6kl/include/a_debug.h b/drivers/staging/ath6kl/include/a_debug.h index 8c5b580..4f5f8e7 100644 --- a/drivers/staging/ath6kl/include/a_debug.h +++ b/drivers/staging/ath6kl/include/a_debug.h @@ -144,9 +144,9 @@ typedef struct _ATH_DEBUG_MODULE_DBG_INFO{ #ifdef ATH_DEBUG_MODULE /* for source files that will instantiate the debug variables */ -#define ATH_DEBUG_INSTANTIATE_MODULE_VAR(s,name,moddesc,initmask,count,descriptions) \ -ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s) = \ -{NULL,(name),(moddesc),0,(initmask),count,(descriptions)} +#define ATH_DEBUG_INSTANTIATE_MODULE_VAR(s, name, moddesc, initmask, count, descriptions) \ + ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s) = \ + { NULL, (name), (moddesc), 0, (initmask), count, (descriptions) } #ifdef ATH_MODULE_NAME extern ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(ATH_MODULE_NAME); @@ -155,7 +155,7 @@ extern ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(ATH_MODULE_NAME); #define ATH_DEBUG_SET_DEBUG_MASK(s,lvl) GET_ATH_MODULE_DEBUG_VAR_MASK(s) = (lvl) -#define ATH_DEBUG_DECLARE_EXTERN(s) \ +#define ATH_DEBUG_DECLARE_EXTERN(s) \ extern ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s) #define AR_DEBUG_PRINTBUF(buffer, length, desc) DebugDumpBytes(buffer,length,desc) diff --git a/drivers/staging/ath6kl/include/athbtfilter.h b/drivers/staging/ath6kl/include/athbtfilter.h index 0cd9d4d..27ee02e 100644 --- a/drivers/staging/ath6kl/include/athbtfilter.h +++ b/drivers/staging/ath6kl/include/athbtfilter.h @@ -79,46 +79,56 @@ typedef struct _ATHBT_FILTER_INSTANCE { /* API MACROS */ -#define AthBtFilterHciCommand(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ +#define AthBtFilterHciCommand(instance, packet, length) \ +do { \ + if ((instance)->FilterEnabled) { \ (instance)->pFilterCmdEvents((instance)->pContext, \ ATHBT_HCI_COMMAND, \ (unsigned char *)(packet), \ (length)); \ - } + } \ +} while (0) -#define AthBtFilterHciEvent(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ +#define AthBtFilterHciEvent(instance, packet, length) \ +do { \ + if ((instance)->FilterEnabled) { \ (instance)->pFilterCmdEvents((instance)->pContext, \ ATHBT_HCI_EVENT, \ (unsigned char *)(packet), \ (length)); \ - } + } \ +} while (0) -#define AthBtFilterHciAclDataOut(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ +#define AthBtFilterHciAclDataOut(instance, packet, length) \ +do { \ + if ((instance)->FilterEnabled) { \ (instance)->pFilterAclDataOut((instance)->pContext, \ (unsigned char *)(packet), \ (length)); \ - } + } \ +} while (0) -#define AthBtFilterHciAclDataIn(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ +#define AthBtFilterHciAclDataIn(instance, packet, length) \ +do { \ + if ((instance)->FilterEnabled) { \ (instance)->pFilterAclDataIn((instance)->pContext, \ (unsigned char *)(packet), \ (length)); \ - } + } \ +} while (0) -/* if filtering is not desired, the application can indicate the state directly using this - * macro: +/* if filtering is not desired, + * the application can indicate the state directly using this macro: */ -#define AthBtIndicateState(instance,indication,state) \ +#define AthBtIndicateState(instance, indication, state) \ +do { \ if ((instance)->FilterEnabled) { \ (instance)->pIndicateState((instance)->pContext, \ (indication), \ (state), \ 0); \ } +} while (0) #ifdef __cplusplus extern "C" { diff --git a/drivers/staging/ath6kl/include/common/a_hci.h b/drivers/staging/ath6kl/include/common/a_hci.h index bb1bff1..b0301b0 100644 --- a/drivers/staging/ath6kl/include/common/a_hci.h +++ b/drivers/staging/ath6kl/include/common/a_hci.h @@ -31,8 +31,9 @@ #define HCI_CMD_OCF_SHIFT 0 #define HCI_CMD_GET_OCF(opcode) (((opcode) >> HCI_CMD_OCF_SHIFT) & HCI_CMD_OCF_MASK) -#define HCI_FORM_OPCODE(ocf, ogf) ((ocf & HCI_CMD_OCF_MASK) << HCI_CMD_OCF_SHIFT | \ - (ogf & HCI_CMD_OGF_MASK) << HCI_CMD_OGF_SHIFT) +#define HCI_FORM_OPCODE(ocf, ogf) \ + ((ocf & HCI_CMD_OCF_MASK) << HCI_CMD_OCF_SHIFT | \ + (ogf & HCI_CMD_OGF_MASK) << HCI_CMD_OGF_SHIFT) /*======== HCI Opcode groups ===============*/ diff --git a/drivers/staging/ath6kl/include/common/dsetid.h b/drivers/staging/ath6kl/include/common/dsetid.h index badbd1c..3ca0581 100644 --- a/drivers/staging/ath6kl/include/common/dsetid.h +++ b/drivers/staging/ath6kl/include/common/dsetid.h @@ -45,7 +45,7 @@ * This macro returns the dsetid of the first of those * three DataSets. */ -#define ANALOG_CONTROL_DATA_DSETID(refclk) \ +#define ANALOG_CONTROL_DATA_DSETID(refclk) \ (DSETID_ANALOG_CONTROL_DATA_START + 3*refclk) /* diff --git a/drivers/staging/ath6kl/include/common/epping_test.h b/drivers/staging/ath6kl/include/common/epping_test.h index f8d8083..cdf41ed 100644 --- a/drivers/staging/ath6kl/include/common/epping_test.h +++ b/drivers/staging/ath6kl/include/common/epping_test.h @@ -72,15 +72,19 @@ typedef PREPACK struct { -#define IS_EPPING_PACKET(pPkt) (((pPkt)->Magic_h[0] == EPPING_PING_MAGIC_0) && \ - ((pPkt)->Magic_h[1] == EPPING_PING_MAGIC_1) && \ - ((pPkt)->Magic_h[2] == EPPING_PING_MAGIC_2) && \ - ((pPkt)->Magic_h[3] == EPPING_PING_MAGIC_3)) - -#define SET_EPPING_PACKET_MAGIC(pPkt) { (pPkt)->Magic_h[0] = EPPING_PING_MAGIC_0; \ - (pPkt)->Magic_h[1] = EPPING_PING_MAGIC_1; \ - (pPkt)->Magic_h[2] = EPPING_PING_MAGIC_2; \ - (pPkt)->Magic_h[3] = EPPING_PING_MAGIC_3;} +#define IS_EPPING_PACKET(pPkt) \ + (((pPkt)->Magic_h[0] == EPPING_PING_MAGIC_0) && \ + ((pPkt)->Magic_h[1] == EPPING_PING_MAGIC_1) && \ + ((pPkt)->Magic_h[2] == EPPING_PING_MAGIC_2) && \ + ((pPkt)->Magic_h[3] == EPPING_PING_MAGIC_3)) + +#define SET_EPPING_PACKET_MAGIC(pPkt) \ +do { \ + (pPkt)->Magic_h[0] = EPPING_PING_MAGIC_0; \ + (pPkt)->Magic_h[1] = EPPING_PING_MAGIC_1; \ + (pPkt)->Magic_h[2] = EPPING_PING_MAGIC_2; \ + (pPkt)->Magic_h[3] = EPPING_PING_MAGIC_3; \ +} while (0) #define CMD_FLAGS_DATA_CRC (1 << 0) /* DataCRC field is valid */ #define CMD_FLAGS_DELAY_ECHO (1 << 1) /* delay the echo of the packet */ diff --git a/drivers/staging/ath6kl/include/common/htc.h b/drivers/staging/ath6kl/include/common/htc.h index 189d1eb..7468487 100644 --- a/drivers/staging/ath6kl/include/common/htc.h +++ b/drivers/staging/ath6kl/include/common/htc.h @@ -30,28 +30,28 @@ #define A_OFFSETOF(type,field) (unsigned long)(&(((type *)NULL)->field)) -#define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \ +#define ASSEMBLE_UNALIGNED_UINT16(p, highbyte, lowbyte) \ (((u16)(((u8 *)(p))[(highbyte)])) << 8 | (u16)(((u8 *)(p))[(lowbyte)])) /* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a * structure using only the type and field name. * Use these macros if there is the potential for unaligned buffer accesses. */ -#define A_GET_UINT16_FIELD(p,type,field) \ +#define A_GET_UINT16_FIELD(p, type, field) \ ASSEMBLE_UNALIGNED_UINT16(p, \ A_OFFSETOF(type,field) + 1, \ A_OFFSETOF(type,field)) -#define A_SET_UINT16_FIELD(p,type,field,value) \ -{ \ - ((u8 *)(p))[A_OFFSETOF(type,field)] = (u8)(value); \ - ((u8 *)(p))[A_OFFSETOF(type,field) + 1] = (u8)((value) >> 8); \ -} +#define A_SET_UINT16_FIELD(p, type, field, value) \ +do { \ + ((u8 *)(p))[A_OFFSETOF(type,field)] = (u8)(value); \ + ((u8 *)(p))[A_OFFSETOF(type,field) + 1] = (u8)((value) >> 8); \ +} while (0) -#define A_GET_UINT8_FIELD(p,type,field) \ - ((u8 *)(p))[A_OFFSETOF(type,field)] +#define A_GET_UINT8_FIELD(p, type, field) \ + ((u8 *)(p))[A_OFFSETOF(type, field)] -#define A_SET_UINT8_FIELD(p,type,field,value) \ - ((u8 *)(p))[A_OFFSETOF(type,field)] = (value) +#define A_SET_UINT8_FIELD(p, type, field, value) \ + ((u8 *)(p))[A_OFFSETOF(type, field)] = (value) /****** DANGER DANGER *************** * diff --git a/drivers/staging/ath6kl/include/common/htc_services.h b/drivers/staging/ath6kl/include/common/htc_services.h index f2e2197..8b38d69 100644 --- a/drivers/staging/ath6kl/include/common/htc_services.h +++ b/drivers/staging/ath6kl/include/common/htc_services.h @@ -34,7 +34,7 @@ typedef enum { HTC_SERVICE_GROUP_LAST = 255 }HTC_SERVICE_GROUP_IDS; -#define MAKE_SERVICE_ID(group,index) \ +#define MAKE_SERVICE_ID(group, index) \ (int)(((int)group << 8) | (int)(index)) /* NOTE: service ID of 0x0000 is reserved and should never be used */ diff --git a/drivers/staging/ath6kl/include/common/regulatory/reg_dbschema.h b/drivers/staging/ath6kl/include/common/regulatory/reg_dbschema.h index f4c79b0..c681918 100644 --- a/drivers/staging/ath6kl/include/common/regulatory/reg_dbschema.h +++ b/drivers/staging/ath6kl/include/common/regulatory/reg_dbschema.h @@ -144,24 +144,26 @@ typedef PREPACK struct dbMasterTable_t { /* Hold ptrs to Table data structure #define BMLEN 2 /* Use 2 32-bit uint for channel bitmask */ #define BMZERO {0,0} /* BMLEN zeros */ -#define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh) \ - {((((_fa >= 0) && (_fa < 32)) ? (((u32) 1) << _fa) : 0) | \ - (((_fb >= 0) && (_fb < 32)) ? (((u32) 1) << _fb) : 0) | \ - (((_fc >= 0) && (_fc < 32)) ? (((u32) 1) << _fc) : 0) | \ - (((_fd >= 0) && (_fd < 32)) ? (((u32) 1) << _fd) : 0) | \ - (((_fe >= 0) && (_fe < 32)) ? (((u32) 1) << _fe) : 0) | \ - (((_ff >= 0) && (_ff < 32)) ? (((u32) 1) << _ff) : 0) | \ - (((_fg >= 0) && (_fg < 32)) ? (((u32) 1) << _fg) : 0) | \ - (((_fh >= 0) && (_fh < 32)) ? (((u32) 1) << _fh) : 0)), \ - ((((_fa > 31) && (_fa < 64)) ? (((u32) 1) << (_fa - 32)) : 0) | \ - (((_fb > 31) && (_fb < 64)) ? (((u32) 1) << (_fb - 32)) : 0) | \ - (((_fc > 31) && (_fc < 64)) ? (((u32) 1) << (_fc - 32)) : 0) | \ - (((_fd > 31) && (_fd < 64)) ? (((u32) 1) << (_fd - 32)) : 0) | \ - (((_fe > 31) && (_fe < 64)) ? (((u32) 1) << (_fe - 32)) : 0) | \ - (((_ff > 31) && (_ff < 64)) ? (((u32) 1) << (_ff - 32)) : 0) | \ - (((_fg > 31) && (_fg < 64)) ? (((u32) 1) << (_fg - 32)) : 0) | \ - (((_fh > 31) && (_fh < 64)) ? (((u32) 1) << (_fh - 32)) : 0))} - +#define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh) \ +{ \ + ((((_fa >= 0) && (_fa < 32)) ? (((u32) 1) << _fa) : 0) | \ + (((_fb >= 0) && (_fb < 32)) ? (((u32) 1) << _fb) : 0) | \ + (((_fc >= 0) && (_fc < 32)) ? (((u32) 1) << _fc) : 0) | \ + (((_fd >= 0) && (_fd < 32)) ? (((u32) 1) << _fd) : 0) | \ + (((_fe >= 0) && (_fe < 32)) ? (((u32) 1) << _fe) : 0) | \ + (((_ff >= 0) && (_ff < 32)) ? (((u32) 1) << _ff) : 0) | \ + (((_fg >= 0) && (_fg < 32)) ? (((u32) 1) << _fg) : 0) | \ + (((_fh >= 0) && (_fh < 32)) ? (((u32) 1) << _fh) : 0)), \ + \ + ((((_fa > 31) && (_fa < 64)) ? (((u32) 1) << (_fa - 32)) : 0) | \ + (((_fb > 31) && (_fb < 64)) ? (((u32) 1) << (_fb - 32)) : 0) | \ + (((_fc > 31) && (_fc < 64)) ? (((u32) 1) << (_fc - 32)) : 0) | \ + (((_fd > 31) && (_fd < 64)) ? (((u32) 1) << (_fd - 32)) : 0) | \ + (((_fe > 31) && (_fe < 64)) ? (((u32) 1) << (_fe - 32)) : 0) | \ + (((_ff > 31) && (_ff < 64)) ? (((u32) 1) << (_ff - 32)) : 0) | \ + (((_fg > 31) && (_fg < 64)) ? (((u32) 1) << (_fg - 32)) : 0) | \ + (((_fh > 31) && (_fh < 64)) ? (((u32) 1) << (_fh - 32)) : 0)) \ +} /* * THE following table is the mapping of regdomain pairs specified by diff --git a/drivers/staging/ath6kl/include/common/wlan_defs.h b/drivers/staging/ath6kl/include/common/wlan_defs.h index 902b5d7..5cb9ea5 100644 --- a/drivers/staging/ath6kl/include/common/wlan_defs.h +++ b/drivers/staging/ath6kl/include/common/wlan_defs.h @@ -59,19 +59,23 @@ typedef unsigned short A_RATEMASK; #endif #ifdef SUPPORT_11N -#define IS_MODE_11A(mode) (((mode) == MODE_11A) || \ - ((mode) == MODE_11NA_HT20) || \ - ((mode) == MODE_11NA_HT40)) -#define IS_MODE_11B(mode) ((mode) == MODE_11B) -#define IS_MODE_11G(mode) (((mode) == MODE_11G) || \ - ((mode) == MODE_11GONLY) || \ - ((mode) == MODE_11NG_HT20) || \ - ((mode) == MODE_11NG_HT40)) -#define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY) +#define IS_MODE_11A(mode) \ + (((mode) == MODE_11A) || \ + ((mode) == MODE_11NA_HT20) || \ + ((mode) == MODE_11NA_HT40)) +#define IS_MODE_11B(mode) \ + ((mode) == MODE_11B) +#define IS_MODE_11G(mode) \ + (((mode) == MODE_11G) || \ + ((mode) == MODE_11GONLY) || \ + ((mode) == MODE_11NG_HT20) || \ + ((mode) == MODE_11NG_HT40)) +#define IS_MODE_11GONLY(mode) \ + ((mode) == MODE_11GONLY) #else #define IS_MODE_11A(mode) ((mode) == MODE_11A) #define IS_MODE_11B(mode) ((mode) == MODE_11B) -#define IS_MODE_11G(mode) (((mode) == MODE_11G) || \ +#define IS_MODE_11G(mode) (((mode) == MODE_11G) || \ ((mode) == MODE_11GONLY)) #define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY) #endif /* SUPPORT_11N */ diff --git a/drivers/staging/ath6kl/include/common/wmi_thin.h b/drivers/staging/ath6kl/include/common/wmi_thin.h index 9c57c39..9492756 100644 --- a/drivers/staging/ath6kl/include/common/wmi_thin.h +++ b/drivers/staging/ath6kl/include/common/wmi_thin.h @@ -69,8 +69,13 @@ typedef enum{ #define TEMPLATE_FRM_LEN_NULL (32) #define TEMPLATE_FRM_LEN_QOS_NULL (32) #define TEMPLATE_FRM_LEN_PSPOLL (32) -#define TEMPLATE_FRM_LEN_SUM (TEMPLATE_FRM_LEN_PROBE_REQ + TEMPLATE_FRM_LEN_BEACON + TEMPLATE_FRM_LEN_PROBE_RESP + \ - TEMPLATE_FRM_LEN_NULL + TEMPLATE_FRM_LEN_QOS_NULL + TEMPLATE_FRM_LEN_PSPOLL) +#define TEMPLATE_FRM_LEN_SUM \ + (TEMPLATE_FRM_LEN_PROBE_REQ + \ + TEMPLATE_FRM_LEN_BEACON + \ + TEMPLATE_FRM_LEN_PROBE_RESP + \ + TEMPLATE_FRM_LEN_NULL + \ + TEMPLATE_FRM_LEN_QOS_NULL + \ + TEMPLATE_FRM_LEN_PSPOLL) /* MAC Header Build Rules */ @@ -92,9 +97,10 @@ typedef enum{ #define WMI_WRT_QOS 0x00000080 #define WMI_WRT_SEQNO 0x00000100 #define WMI_GUARD_TX 0x00000200 /* prevents TX ops that are not allowed for a current state */ -#define WMI_WRT_DEFAULT_CONFIG (WMI_WRT_VER_TYPE | WMI_WRT_DURATION | WMI_WRT_DIRECTION | \ - WMI_WRT_POWER | WMI_WRT_MORE | WMI_WRT_WEP | WMI_WRT_BSSID | \ - WMI_WRT_QOS | WMI_WRT_SEQNO | WMI_GUARD_TX) +#define WMI_WRT_DEFAULT_CONFIG \ + (WMI_WRT_VER_TYPE | WMI_WRT_DURATION | WMI_WRT_DIRECTION | \ + WMI_WRT_POWER | WMI_WRT_MORE | WMI_WRT_WEP | WMI_WRT_BSSID | \ + WMI_WRT_QOS | WMI_WRT_SEQNO | WMI_GUARD_TX) /* WMI_THIN_CONFIG_TXCOMPLETE -- Used to configure the params and content for * TX Complete messages the will come from the Target. these messages are diff --git a/drivers/staging/ath6kl/include/dl_list.h b/drivers/staging/ath6kl/include/dl_list.h index ad8a724..7cba816 100644 --- a/drivers/staging/ath6kl/include/dl_list.h +++ b/drivers/staging/ath6kl/include/dl_list.h @@ -39,18 +39,23 @@ typedef struct _DL_LIST { /* * DL_LIST_INIT , initialize doubly linked list */ -#define DL_LIST_INIT(pList)\ - {(pList)->pPrev = pList; (pList)->pNext = pList;} +#define DL_LIST_INIT(pList) \ +do { \ + (pList)->pPrev = pList; \ + (pList)->pNext = pList; \ +} while (0) /* faster macro to init list and add a single item */ -#define DL_LIST_INIT_AND_ADD(pList,pItem) \ -{ (pList)->pPrev = (pItem); \ - (pList)->pNext = (pItem); \ - (pItem)->pNext = (pList); \ - (pItem)->pPrev = (pList); \ -} +#define DL_LIST_INIT_AND_ADD(pList, pItem) \ +do { \ + (pList)->pPrev = (pItem); \ + (pList)->pNext = (pItem); \ + (pItem)->pNext = (pList); \ + (pItem)->pPrev = (pList); \ +} while (0) -#define DL_LIST_IS_EMPTY(pList) (((pList)->pPrev == (pList)) && ((pList)->pNext == (pList))) +#define DL_LIST_IS_EMPTY(pList) \ + (((pList)->pPrev == (pList)) && ((pList)->pNext == (pList))) #define DL_LIST_GET_ITEM_AT_HEAD(pList) (pList)->pNext #define DL_LIST_GET_ITEM_AT_TAIL(pList) (pList)->pPrev /* @@ -65,13 +70,13 @@ typedef struct _DL_LIST { /* safe iterate macro that allows the item to be removed from the list * the iteration continues to the next item in the list */ -#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart,pItem,st,offset) \ -{ \ -PDL_LIST pTemp; \ -pTemp = (pStart)->pNext; \ -while (pTemp != (pStart)) { \ -(pItem) = A_CONTAINING_STRUCT(pTemp,st,offset); \ -pTemp = pTemp->pNext; \ +#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart, pItem, st, offset) \ +{ \ + PDL_LIST pTemp; \ + pTemp = (pStart)->pNext; \ + while (pTemp != (pStart)) { \ + (pItem) = A_CONTAINING_STRUCT(pTemp,st,offset); \ + pTemp = pTemp->pNext; \ #define ITERATE_END }} diff --git a/drivers/staging/ath6kl/include/htc_packet.h b/drivers/staging/ath6kl/include/htc_packet.h index b971b47..4922e02 100644 --- a/drivers/staging/ath6kl/include/htc_packet.h +++ b/drivers/staging/ath6kl/include/htc_packet.h @@ -102,41 +102,44 @@ typedef struct _HTC_PACKET { -#define COMPLETE_HTC_PACKET(p,status) \ -{ \ - (p)->Status = (status); \ - (p)->Completion((p)->pContext,(p)); \ -} - -#define INIT_HTC_PACKET_INFO(p,b,len) \ -{ \ - (p)->pBufferStart = (b); \ - (p)->BufferLength = (len); \ -} +#define COMPLETE_HTC_PACKET(p, status) \ +do { \ + (p)->Status = (status); \ + (p)->Completion((p)->pContext, (p)); \ +} while (0) + +#define INIT_HTC_PACKET_INFO(p, b, len) \ +do { \ + (p)->pBufferStart = (b); \ + (p)->BufferLength = (len); \ +} while (0) /* macro to set an initial RX packet for refilling HTC */ -#define SET_HTC_PACKET_INFO_RX_REFILL(p,c,b,len,ep) \ -{ \ - (p)->pPktContext = (c); \ - (p)->pBuffer = (b); \ - (p)->pBufferStart = (b); \ - (p)->BufferLength = (len); \ - (p)->Endpoint = (ep); \ -} +#define SET_HTC_PACKET_INFO_RX_REFILL(p, c, b, len, ep) \ +do { \ + (p)->pPktContext = (c); \ + (p)->pBuffer = (b); \ + (p)->pBufferStart = (b); \ + (p)->BufferLength = (len); \ + (p)->Endpoint = (ep); \ +} while (0) /* fast macro to recycle an RX packet that will be re-queued to HTC */ -#define HTC_PACKET_RESET_RX(p) \ - { (p)->pBuffer = (p)->pBufferStart; (p)->ActualLength = 0; } +#define HTC_PACKET_RESET_RX(p) \ +do { \ + (p)->pBuffer = (p)->pBufferStart; \ + (p)->ActualLength = 0; \ +} while (0) /* macro to set packet parameters for TX */ -#define SET_HTC_PACKET_INFO_TX(p,c,b,len,ep,tag) \ -{ \ - (p)->pPktContext = (c); \ - (p)->pBuffer = (b); \ - (p)->ActualLength = (len); \ - (p)->Endpoint = (ep); \ - (p)->PktInfo.AsTx.Tag = (tag); \ -} +#define SET_HTC_PACKET_INFO_TX(p, c, b, len, ep, tag) \ +do { \ + (p)->pPktContext = (c); \ + (p)->pBuffer = (b); \ + (p)->ActualLength = (len); \ + (p)->Endpoint = (ep); \ + (p)->PktInfo.AsTx.Tag = (tag); \ +} while (0) /* HTC Packet Queueing Macros */ typedef struct _HTC_PACKET_QUEUE { @@ -145,23 +148,25 @@ typedef struct _HTC_PACKET_QUEUE { } HTC_PACKET_QUEUE; /* initialize queue */ -#define INIT_HTC_PACKET_QUEUE(pQ) \ -{ \ - DL_LIST_INIT(&(pQ)->QueueHead); \ - (pQ)->Depth = 0; \ -} +#define INIT_HTC_PACKET_QUEUE(pQ) \ +do { \ + DL_LIST_INIT(&(pQ)->QueueHead); \ + (pQ)->Depth = 0; \ +} while (0) /* enqueue HTC packet to the tail of the queue */ -#define HTC_PACKET_ENQUEUE(pQ,p) \ -{ DL_ListInsertTail(&(pQ)->QueueHead,&(p)->ListLink); \ - (pQ)->Depth++; \ -} +#define HTC_PACKET_ENQUEUE(pQ, p) \ +do { \ + DL_ListInsertTail(&(pQ)->QueueHead, &(p)->ListLink); \ + (pQ)->Depth++; \ +} while (0) /* enqueue HTC packet to the tail of the queue */ -#define HTC_PACKET_ENQUEUE_TO_HEAD(pQ,p) \ -{ DL_ListInsertHead(&(pQ)->QueueHead,&(p)->ListLink); \ - (pQ)->Depth++; \ -} +#define HTC_PACKET_ENQUEUE_TO_HEAD(pQ, p) \ +do { \ + DL_ListInsertHead(&(pQ)->QueueHead, &(p)->ListLink); \ + (pQ)->Depth++; \ +} while (0) /* test if a queue is empty */ #define HTC_QUEUE_EMPTY(pQ) ((pQ)->Depth == 0) /* get packet at head without removing it */ @@ -172,11 +177,11 @@ static INLINE HTC_PACKET *HTC_GET_PKT_AT_HEAD(HTC_PACKET_QUEUE *queue) { return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(&queue->QueueHead)),HTC_PACKET,ListLink); } /* remove a packet from a queue, where-ever it is in the queue */ -#define HTC_PACKET_REMOVE(pQ,p) \ -{ \ - DL_ListRemove(&(p)->ListLink); \ - (pQ)->Depth--; \ -} +#define HTC_PACKET_REMOVE(pQ, p) \ +do { \ + DL_ListRemove(&(p)->ListLink); \ + (pQ)->Depth--; \ +} while (0) /* dequeue an HTC packet from the head of the queue */ static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE(HTC_PACKET_QUEUE *queue) { @@ -205,22 +210,26 @@ static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE_TAIL(HTC_PACKET_QUEUE *queue) { #define HTC_GET_TAG_FROM_PKT(p) (p)->PktInfo.AsTx.Tag /* transfer the packets from one queue to the tail of another queue */ -#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest,pQSrc) \ -{ \ - DL_ListTransferItemsToTail(&(pQDest)->QueueHead,&(pQSrc)->QueueHead); \ - (pQDest)->Depth += (pQSrc)->Depth; \ - (pQSrc)->Depth = 0; \ -} +#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest, pQSrc) \ +do { \ + DL_ListTransferItemsToTail(&(pQDest)->QueueHead, \ + &(pQSrc)->QueueHead); \ + (pQDest)->Depth += (pQSrc)->Depth; \ + (pQSrc)->Depth = 0; \ +} while (0) /* fast version to init and add a single packet to a queue */ -#define INIT_HTC_PACKET_QUEUE_AND_ADD(pQ,pP) \ -{ \ - DL_LIST_INIT_AND_ADD(&(pQ)->QueueHead,&(pP)->ListLink) \ - (pQ)->Depth = 1; \ -} +#define INIT_HTC_PACKET_QUEUE_AND_ADD(pQ, pP) \ +do { \ + DL_LIST_INIT_AND_ADD(&(pQ)->QueueHead, &(pP)->ListLink); \ + (pQ)->Depth = 1; \ +} while (0) #define HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pQ, pPTemp) \ - ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead,(pPTemp), HTC_PACKET, ListLink) + ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead, \ + (pPTemp), \ + HTC_PACKET, \ + ListLink) #define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END diff --git a/drivers/staging/ath6kl/miscdrv/common_drv.c b/drivers/staging/ath6kl/miscdrv/common_drv.c index 224d6ce..7a8e60a 100644 --- a/drivers/staging/ath6kl/miscdrv/common_drv.c +++ b/drivers/staging/ath6kl/miscdrv/common_drv.c @@ -60,9 +60,9 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(misc, #endif -#define HOST_INTEREST_ITEM_ADDRESS(target, item) \ - ((((target) == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \ - (((target) == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0))) +#define HOST_INTEREST_ITEM_ADDRESS(target, item) \ + (((target) == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \ + ((target) == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0) #define AR6001_LOCAL_COUNT_ADDRESS 0x0c014080 diff --git a/drivers/staging/ath6kl/miscdrv/credit_dist.c b/drivers/staging/ath6kl/miscdrv/credit_dist.c index 2058b90..2e203aa 100644 --- a/drivers/staging/ath6kl/miscdrv/credit_dist.c +++ b/drivers/staging/ath6kl/miscdrv/credit_dist.c @@ -69,12 +69,12 @@ static INLINE void ReduceCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, } /* give an endpoint some credits from the free credit pool */ -#define GiveCredits(pCredInfo,pEpDist,credits) \ -{ \ - (pEpDist)->TxCredits += (credits); \ - (pEpDist)->TxCreditsAssigned += (credits); \ - (pCredInfo)->CurrentFreeCredits -= (credits); \ -} +#define GiveCredits(pCredInfo,pEpDist,credits) \ +do { \ + (pEpDist)->TxCredits += (credits); \ + (pEpDist)->TxCreditsAssigned += (credits); \ + (pCredInfo)->CurrentFreeCredits -= (credits); \ +} while (0) /* default credit init callback. diff --git a/drivers/staging/ath6kl/miscdrv/miscdrv.h b/drivers/staging/ath6kl/miscdrv/miscdrv.h index fcc6aae..c853f6d 100644 --- a/drivers/staging/ath6kl/miscdrv/miscdrv.h +++ b/drivers/staging/ath6kl/miscdrv/miscdrv.h @@ -25,7 +25,7 @@ #define HOST_INTEREST_ITEM_ADDRESS(target, item) \ - AR6002_HOST_INTEREST_ITEM_ADDRESS(item) + AR6002_HOST_INTEREST_ITEM_ADDRESS(item) u32 ar6kRev2Array[][128] = { {0xFFFF, 0xFFFF}, // No Patches diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 844b544..d5a3cdd 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -379,9 +379,9 @@ struct net_device *arApNetDev; static struct ar_cookie s_ar_cookie_mem[MAX_COOKIE_NUM]; -#define HOST_INTEREST_ITEM_ADDRESS(ar, item) \ +#define HOST_INTEREST_ITEM_ADDRESS(ar, item) \ (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \ - (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0)) + ((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0) static struct net_device_ops ar6000_netdev_ops = { @@ -887,12 +887,14 @@ ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar) sysfs_remove_bin_file(&(((struct device *)ar->osDevInfo.pOSDevice)->kobj), &bmi_attr); } -#define bmifn(fn) do { \ - if ((fn) < 0) { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); \ - return A_ERROR; \ - } \ - } while (0) +#define bmifn(fn) \ +do { \ + if ((fn) < 0) { \ + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, \ + ("BMI operation failed: %d\n", __LINE__)); \ + return A_ERROR; \ + } \ +} while (0) #ifdef INIT_MODE_DRV_ENABLED @@ -5132,11 +5134,12 @@ ar6000_channel_change_event(AR_SOFTC_T *ar, u16 oldChannel, oldChannel, newChannel); } -#define AR6000_PRINT_BSSID(_pBss) do { \ - A_PRINTF("%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", \ - (_pBss)[0],(_pBss)[1],(_pBss)[2],(_pBss)[3], \ - (_pBss)[4],(_pBss)[5]); \ - } while (0) +#define AR6000_PRINT_BSSID(_pBss) \ +do { \ + A_PRINTF("%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", \ + (_pBss)[0],(_pBss)[1],(_pBss)[2],(_pBss)[3], \ + (_pBss)[4],(_pBss)[5]); \ +} while (0) void ar6000_roam_tbl_event(AR_SOFTC_T *ar, WMI_TARGET_ROAM_TBL *pTbl) diff --git a/drivers/staging/ath6kl/os/linux/hci_bridge.c b/drivers/staging/ath6kl/os/linux/hci_bridge.c index 3e7bfda..3fa07fb 100644 --- a/drivers/staging/ath6kl/os/linux/hci_bridge.c +++ b/drivers/staging/ath6kl/os/linux/hci_bridge.c @@ -214,7 +214,8 @@ static void RefillRecvBuffers(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, #define HOST_INTEREST_ITEM_ADDRESS(ar, item) \ (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \ - (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0)) + ((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0) + static int ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle, HCI_TRANSPORT_PROPERTIES *pProps, void *pContext) diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h index fec2161..5e2d67c 100644 --- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h +++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h @@ -261,37 +261,43 @@ typedef enum _AR6K_BIN_FILE { #define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_USR #endif /* INIT_MODE_DRV_ENABLED */ -#define AR6K_PATCH_DOWNLOAD_ADDRESS(_param, _ver) do { \ - if ((_ver) == AR6003_REV1_VERSION) { \ - (_param) = AR6003_REV1_PATCH_DOWNLOAD_ADDRESS; \ - } else if ((_ver) == AR6003_REV2_VERSION) { \ - (_param) = AR6003_REV2_PATCH_DOWNLOAD_ADDRESS; \ - } else { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \ - A_ASSERT(0); \ - } \ +#define AR6K_PATCH_DOWNLOAD_ADDRESS(_param, _ver) \ +do { \ + if ((_ver) == AR6003_REV1_VERSION) { \ + (_param) = AR6003_REV1_PATCH_DOWNLOAD_ADDRESS; \ + } else if ((_ver) == AR6003_REV2_VERSION) { \ + (_param) = AR6003_REV2_PATCH_DOWNLOAD_ADDRESS; \ + } else { \ + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, \ + ("Unknown Version: %d\n", _ver)); \ + A_ASSERT(0); \ + } \ } while (0) -#define AR6K_DATA_DOWNLOAD_ADDRESS(_param, _ver) do { \ - if ((_ver) == AR6003_REV1_VERSION) { \ - (_param) = AR6003_REV1_DATA_DOWNLOAD_ADDRESS; \ - } else if ((_ver) == AR6003_REV2_VERSION) { \ - (_param) = AR6003_REV2_DATA_DOWNLOAD_ADDRESS; \ - } else { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \ - A_ASSERT(0); \ - } \ +#define AR6K_DATA_DOWNLOAD_ADDRESS(_param, _ver) \ +do { \ + if ((_ver) == AR6003_REV1_VERSION) { \ + (_param) = AR6003_REV1_DATA_DOWNLOAD_ADDRESS; \ + } else if ((_ver) == AR6003_REV2_VERSION) { \ + (_param) = AR6003_REV2_DATA_DOWNLOAD_ADDRESS; \ + } else { \ + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, \ + ("Unknown Version: %d\n", _ver)); \ + A_ASSERT(0); \ + } \ } while (0) -#define AR6K_APP_START_OVERRIDE_ADDRESS(_param, _ver) do { \ - if ((_ver) == AR6003_REV1_VERSION) { \ - (_param) = AR6003_REV1_APP_START_OVERRIDE; \ - } else if ((_ver) == AR6003_REV2_VERSION) { \ - (_param) = AR6003_REV2_APP_START_OVERRIDE; \ - } else { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \ - A_ASSERT(0); \ - } \ +#define AR6K_APP_START_OVERRIDE_ADDRESS(_param, _ver) \ +do { \ + if ((_ver) == AR6003_REV1_VERSION) { \ + (_param) = AR6003_REV1_APP_START_OVERRIDE; \ + } else if ((_ver) == AR6003_REV2_VERSION) { \ + (_param) = AR6003_REV2_APP_START_OVERRIDE; \ + } else { \ + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, \ + ("Unknown Version: %d\n", _ver)); \ + A_ASSERT(0); \ + } \ } while (0) /* AR6003 1.0 definitions */ @@ -650,26 +656,36 @@ static inline void *ar6k_priv(struct net_device *dev) #endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */ #endif /* ATH6K_CONFIG_CFG80211 */ -#define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) do { \ - (pHciDev)->bus = (__bus); \ - (pHciDev)->dev_type = (__type); \ - } while (0) +#define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) \ +do { \ + (pHciDev)->bus = (__bus); \ + (pHciDev)->dev_type = (__type); \ +} while (0) -#define GET_INODE_FROM_FILEP(filp) \ +#define GET_INODE_FROM_FILEP(filp) \ (filp)->f_path.dentry->d_inode -#define arAc2EndpointID(ar,ac) (ar)->arAc2EpMapping[(ac)] -#define arSetAc2EndpointIDMap(ar,ac,ep) \ -{ (ar)->arAc2EpMapping[(ac)] = (ep); \ - (ar)->arEp2AcMapping[(ep)] = (ac); } -#define arEndpoint2Ac(ar,ep) (ar)->arEp2AcMapping[(ep)] - -#define arRawIfEnabled(ar) (ar)->arRawIfInit -#define arRawStream2EndpointID(ar,raw) (ar)->arRawHtc->arRaw2EpMapping[(raw)] -#define arSetRawStream2EndpointIDMap(ar,raw,ep) \ -{ (ar)->arRawHtc->arRaw2EpMapping[(raw)] = (ep); \ - (ar)->arRawHtc->arEp2RawMapping[(ep)] = (raw); } -#define arEndpoint2RawStreamID(ar,ep) (ar)->arRawHtc->arEp2RawMapping[(ep)] +#define arAc2EndpointID(ar, ac) \ + (ar)->arAc2EpMapping[(ac)] +#define arSetAc2EndpointIDMap(ar, ac, ep) \ +do { \ + (ar)->arAc2EpMapping[(ac)] = (ep); \ + (ar)->arEp2AcMapping[(ep)] = (ac); \ +} while (0) +#define arEndpoint2Ac(ar, ep) \ + (ar)->arEp2AcMapping[(ep)] + +#define arRawIfEnabled(ar) \ + (ar)->arRawIfInit +#define arRawStream2EndpointID(ar, raw) \ + (ar)->arRawHtc->arRaw2EpMapping[(raw)] +#define arSetRawStream2EndpointIDMap(ar, raw, ep) \ +do { \ + (ar)->arRawHtc->arRaw2EpMapping[(raw)] = (ep); \ + (ar)->arRawHtc->arEp2RawMapping[(ep)] = (raw); \ +} while (0) +#define arEndpoint2RawStreamID(ar, ep) \ + (ar)->arRawHtc->arEp2RawMapping[(ep)] struct ar_giwscan_param { char *current_ev; @@ -680,18 +696,22 @@ struct ar_giwscan_param { #define AR6000_STAT_INC(ar, stat) (ar->arNetStats.stat++) -#define AR6000_SPIN_LOCK(lock, param) do { \ - if (irqs_disabled()) { \ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled:AR6000_LOCK\n")); \ - } \ - spin_lock_bh(lock); \ +#define AR6000_SPIN_LOCK(lock, param) \ +do { \ + if (irqs_disabled()) { \ + AR_DEBUG_PRINTF(ATH_DEBUG_TRC, \ + ("IRQs disabled:AR6000_LOCK\n")); \ + } \ + spin_lock_bh(lock); \ } while (0) -#define AR6000_SPIN_UNLOCK(lock, param) do { \ - if (irqs_disabled()) { \ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled: AR6000_UNLOCK\n")); \ +#define AR6000_SPIN_UNLOCK(lock, param) \ +do { \ + if (irqs_disabled()) { \ + AR_DEBUG_PRINTF(ATH_DEBUG_TRC, \ + ("IRQs disabled: AR6000_UNLOCK\n")); \ } \ - spin_unlock_bh(lock); \ + spin_unlock_bh(lock); \ } while (0) int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); diff --git a/drivers/staging/ath6kl/os/linux/include/debug_linux.h b/drivers/staging/ath6kl/os/linux/include/debug_linux.h index 58930f8..abc3a98 100644 --- a/drivers/staging/ath6kl/os/linux/include/debug_linux.h +++ b/drivers/staging/ath6kl/os/linux/include/debug_linux.h @@ -30,16 +30,21 @@ #ifdef DEBUG /* NOTE: the AR_DEBUG_PRINTF macro is defined here to handle special handling of variable arg macros * which may be compiler dependent. */ -#define AR_DEBUG_PRINTF(mask, args) do { \ - if (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (mask)) { \ - A_LOGGER(mask, ATH_MODULE_NAME, ATH_PRINTX_ARG args); \ - } \ +#define AR_DEBUG_PRINTF(mask, args) \ +do { \ + if (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (mask)) { \ + A_LOGGER(mask, ATH_MODULE_NAME, ATH_PRINTX_ARG args); \ + } \ } while (0) #else /* on non-debug builds, keep in error and warning messages in the driver, all other * message tracing will get compiled out */ -#define AR_DEBUG_PRINTF(mask, args) \ - if ((mask) & (ATH_DEBUG_ERR | ATH_DEBUG_WARN)) { A_PRINTF(ATH_PRINTX_ARG args); } +#define AR_DEBUG_PRINTF(mask, args) \ +do { \ + if ((mask) & (ATH_DEBUG_ERR | ATH_DEBUG_WARN)) { \ + A_PRINTF(ATH_PRINTX_ARG args); \ + } \ +} while (0) #endif diff --git a/drivers/staging/ath6kl/os/linux/include/osapi_linux.h b/drivers/staging/ath6kl/os/linux/include/osapi_linux.h index cafa526..f10a81c 100644 --- a/drivers/staging/ath6kl/os/linux/include/osapi_linux.h +++ b/drivers/staging/ath6kl/os/linux/include/osapi_linux.h @@ -92,18 +92,22 @@ extern int logger_write(const enum logidx idx, const char __kernel * const tag, const char __kernel * const fmt, ...); -#define A_ANDROID_PRINTF(mask, module, tags, args...) do { \ - if (enablelogcat) \ - logger_write(LOG_MAIN_IDX, android_logger_lv(module, mask), tags, args); \ - else \ - printk(KERN_ALERT args); \ +#define A_ANDROID_PRINTF(mask, module, tags, args...) \ +do { \ + if (enablelogcat) \ + logger_write(LOG_MAIN_IDX, android_logger_lv(module, mask), tags, args); \ + else \ + printk(KERN_ALERT args); \ } while (0) #ifdef DEBUG #define A_LOGGER_MODULE_NAME(x) #x -#define A_LOGGER(mask, mod, args...) \ - A_ANDROID_PRINTF(mask, &GET_ATH_MODULE_DEBUG_VAR_NAME(mod), "ar6k_" A_LOGGER_MODULE_NAME(mod), args); +#define A_LOGGER(mask, mod, args...) \ + A_ANDROID_PRINTF(mask, &GET_ATH_MODULE_DEBUG_VAR_NAME(mod), \ + "ar6k_" A_LOGGER_MODULE_NAME(mod), args) + #endif -#define A_PRINTF(args...) A_ANDROID_PRINTF(ATH_DEBUG_INFO, NULL, "ar6k_driver", args) +#define A_PRINTF(args...) \ + A_ANDROID_PRINTF(ATH_DEBUG_INFO, NULL, "ar6k_driver", args) #else #define A_LOGGER(mask, mod, args...) printk(KERN_ALERT args) #define A_PRINTF(args...) printk(KERN_ALERT args) @@ -120,7 +124,7 @@ typedef spinlock_t A_MUTEX_T; #define A_MUTEX_DELETE(mutex) /* spin locks are not kernel resources so nothing to free.. */ /* Get current time in ms adding a constant offset (in ms) */ -#define A_GET_MS(offset) \ +#define A_GET_MS(offset) \ (jiffies + ((offset) / 1000) * HZ) /* @@ -129,10 +133,11 @@ typedef spinlock_t A_MUTEX_T; #define A_MDELAY(msecs) mdelay(msecs) typedef struct timer_list A_TIMER; -#define A_INIT_TIMER(pTimer, pFunction, pArg) do { \ - init_timer(pTimer); \ - (pTimer)->function = (pFunction); \ - (pTimer)->data = (unsigned long)(pArg); \ +#define A_INIT_TIMER(pTimer, pFunction, pArg) \ +do { \ + init_timer(pTimer); \ + (pTimer)->function = (pFunction); \ + (pTimer)->data = (unsigned long)(pArg); \ } while (0) /* @@ -140,22 +145,26 @@ typedef struct timer_list A_TIMER; * Support is provided for a one-shot timer. The 'repeatFlag' is * ignored. */ -#define A_TIMEOUT_MS(pTimer, periodMSec, repeatFlag) do { \ - if (repeatFlag) { \ - printk("\n" __FILE__ ":%d: Timer Repeat requested\n",__LINE__); \ - panic("Timer Repeat"); \ - } \ - mod_timer((pTimer), jiffies + HZ * (periodMSec) / 1000); \ +#define A_TIMEOUT_MS(pTimer, periodMSec, repeatFlag) \ +do { \ + if (repeatFlag) { \ + printk("\n%s:%d: Timer Repeat requested\n", \ + __FILE__, __LINE__); \ + panic("Timer Repeat"); \ + } \ + mod_timer((pTimer), jiffies + HZ * (periodMSec) / 1000); \ } while (0) /* * Cancel the Timer. */ -#define A_UNTIMEOUT(pTimer) do { \ - del_timer((pTimer)); \ +#define A_UNTIMEOUT(pTimer) \ +do { \ + del_timer((pTimer)); \ } while (0) -#define A_DELETE_TIMER(pTimer) do { \ +#define A_DELETE_TIMER(pTimer) \ +do { \ } while (0) /* @@ -196,21 +205,26 @@ do { \ }) #endif /* wait_event_interruptible_timeout */ -#define A_WAIT_EVENT_INTERRUPTIBLE_TIMEOUT(head, condition, timeout) do { \ - wait_event_interruptible_timeout(head, condition, timeout); \ +#define A_WAIT_EVENT_INTERRUPTIBLE_TIMEOUT(head, condition, timeout) \ +do { \ + wait_event_interruptible_timeout(head, condition, timeout); \ } while (0) #define A_WAKE_UP(head) wake_up(head) #ifdef DEBUG extern unsigned int panic_on_assert; -#define A_ASSERT(expr) \ +#define A_ASSERT(expr) \ +do { \ if (!(expr)) { \ - printk(KERN_ALERT"Debug Assert Caught, File %s, Line: %d, Test:%s \n",__FILE__, __LINE__,#expr); \ - if (panic_on_assert) panic(#expr); \ - } + printk(KERN_ALERT "Debug Assert Caught, File %s, Line: %d, Test:%s\n", \ + __FILE__, __LINE__, #expr); \ + if (panic_on_assert) \ + panic(#expr); \ + } \ +} while (0) #else -#define A_ASSERT(expr) +#define A_ASSERT(expr) do {} while (0) #endif /* DEBUG */ #ifdef ANDROID_ENV @@ -373,10 +387,13 @@ static inline void *A_ALIGN_TO_CACHE_LINE(void *ptr) { #ifdef ANDROID #ifndef err #include <errno.h> -#define err(_s, args...) do { \ - fprintf(stderr, "%s: line %d ", __FILE__, __LINE__); \ - fprintf(stderr, args); fprintf(stderr, ": %d\n", errno); \ - exit(_s); } while (0) +#define err(_s, args...) \ +do { \ + fprintf(stderr, "%s: line %d ", __FILE__, __LINE__); \ + fprintf(stderr, args); \ + fprintf(stderr, ": %d\n", errno); \ + exit(_s); \ +} while (0) #endif #else #include <err.h> diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c index 19386f8..b48131e 100644 --- a/drivers/staging/ath6kl/os/linux/ioctl.c +++ b/drivers/staging/ath6kl/os/linux/ioctl.c @@ -404,14 +404,15 @@ ar6000_ioctl_set_snr_threshold(struct net_device *dev, struct ifreq *rq) static int ar6000_ioctl_set_rssi_threshold(struct net_device *dev, struct ifreq *rq) { -#define SWAP_THOLD(thold1, thold2) do { \ - USER_RSSI_THOLD tmpThold; \ - tmpThold.tag = thold1.tag; \ - tmpThold.rssi = thold1.rssi; \ - thold1.tag = thold2.tag; \ - thold1.rssi = thold2.rssi; \ - thold2.tag = tmpThold.tag; \ - thold2.rssi = tmpThold.rssi; \ +#define SWAP_THOLD(thold1, thold2) \ +do { \ + USER_RSSI_THOLD tmpThold; \ + tmpThold.tag = thold1.tag; \ + tmpThold.rssi = thold1.rssi; \ + thold1.tag = thold2.tag; \ + thold1.rssi = thold2.rssi; \ + thold2.tag = tmpThold.tag; \ + thold2.rssi = tmpThold.rssi; \ } while (0) AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); diff --git a/drivers/staging/ath6kl/os/linux/wireless_ext.c b/drivers/staging/ath6kl/os/linux/wireless_ext.c index 192f76d..4e042cf 100644 --- a/drivers/staging/ath6kl/os/linux/wireless_ext.c +++ b/drivers/staging/ath6kl/os/linux/wireless_ext.c @@ -2633,8 +2633,9 @@ ar6000_ioctl_siwcommit(struct net_device *dev, } #define W_PROTO(_x) wait_ ## _x -#define WAIT_HANDLER_IMPL(_x, type) \ -int wait_ ## _x (struct net_device *dev, struct iw_request_info *info, type wrqu, char *extra) {\ +#define WAIT_HANDLER_IMPL(_x, type) \ +int wait_ ## _x (struct net_device *dev, struct iw_request_info *info, type wrqu, char *extra)\ +{ \ int ret; \ dev_hold(dev); \ rtnl_unlock(); \ diff --git a/drivers/staging/ath6kl/wlan/include/ieee80211.h b/drivers/staging/ath6kl/wlan/include/ieee80211.h index e3bb16b..ae4770a 100644 --- a/drivers/staging/ath6kl/wlan/include/ieee80211.h +++ b/drivers/staging/ath6kl/wlan/include/ieee80211.h @@ -58,11 +58,11 @@ #define IEEE80211_IS_BROADCAST(_a) (*(_a) == 0xFF) #define WEP_HEADER (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) #define WEP_TRAILER IEEE80211_WEP_CRCLEN -#define CCMP_HEADER (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + \ - IEEE80211_WEP_EXTIVLEN) +#define CCMP_HEADER \ + (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_EXTIVLEN) #define CCMP_TRAILER IEEE80211_WEP_MICLEN -#define TKIP_HEADER (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + \ - IEEE80211_WEP_EXTIVLEN) +#define TKIP_HEADER \ + (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_EXTIVLEN) #define TKIP_TRAILER IEEE80211_WEP_CRCLEN #define TKIP_MICLEN IEEE80211_WEP_MICLEN @@ -90,7 +90,7 @@ #define IEEE80211_CIPHER_MAX (IEEE80211_CIPHER_NONE+1) -#define IEEE80211_IS_VALID_WEP_CIPHER_LEN(len) \ +#define IEEE80211_IS_VALID_WEP_CIPHER_LEN(len) \ (((len) == 5) || ((len) == 13) || ((len) == 16)) @@ -198,17 +198,17 @@ PREPACK struct ieee80211_qosframe { #define WMM_PARAM_LOGCWMAX_M 0xf0 /* Mask for CwMax field (in log) */ #define WMM_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ -#define WMM_AC_TO_TID(_ac) ( \ - ((_ac) == WMM_AC_VO) ? 6 : \ - ((_ac) == WMM_AC_VI) ? 5 : \ - ((_ac) == WMM_AC_BK) ? 1 : \ - 0) - -#define TID_TO_WMM_AC(_tid) ( \ - ((_tid) < 1) ? WMM_AC_BE : \ - ((_tid) < 3) ? WMM_AC_BK : \ - ((_tid) < 6) ? WMM_AC_VI : \ - WMM_AC_VO) +#define WMM_AC_TO_TID(_ac) \ + (((_ac) == WMM_AC_VO) ? 6 : \ + ((_ac) == WMM_AC_VI) ? 5 : \ + ((_ac) == WMM_AC_BK) ? 1 : \ + 0) + +#define TID_TO_WMM_AC(_tid) \ + (((_tid) < 1) ? WMM_AC_BE : \ + ((_tid) < 3) ? WMM_AC_BK : \ + ((_tid) < 6) ? WMM_AC_VI : \ + WMM_AC_VO) /* * Management information element payloads. */ diff --git a/drivers/staging/ath6kl/wlan/include/ieee80211_node.h b/drivers/staging/ath6kl/wlan/include/ieee80211_node.h index 4ebff64..8aa9fd7 100644 --- a/drivers/staging/ath6kl/wlan/include/ieee80211_node.h +++ b/drivers/staging/ath6kl/wlan/include/ieee80211_node.h @@ -27,14 +27,18 @@ * Node locking definitions. */ #define IEEE80211_NODE_LOCK_INIT(_nt) A_MUTEX_INIT(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_LOCK_DESTROY(_nt) if (A_IS_MUTEX_VALID(&(_nt)->nt_nodelock)) { \ - A_MUTEX_DELETE(&(_nt)->nt_nodelock); } +#define IEEE80211_NODE_LOCK_DESTROY(_nt) \ +do { \ + if (A_IS_MUTEX_VALID(&(_nt)->nt_nodelock)) { \ + A_MUTEX_DELETE(&(_nt)->nt_nodelock); \ + } \ +} while (0) #define IEEE80211_NODE_LOCK(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock) #define IEEE80211_NODE_UNLOCK(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock) #define IEEE80211_NODE_LOCK_BH(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock) #define IEEE80211_NODE_UNLOCK_BH(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_LOCK_ASSERT(_nt) +#define IEEE80211_NODE_LOCK_ASSERT(_nt) do {} while (0) /* * Node reference counting definitions. @@ -54,9 +58,8 @@ #define IEEE80211_NODE_HASHSIZE 32 /* simple hash is enough for variation of macaddr */ -#define IEEE80211_NODE_HASH(addr) \ - (((const u8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \ - IEEE80211_NODE_HASHSIZE) +#define IEEE80211_NODE_HASH(addr) \ + (((const u8 *)(addr))[IEEE80211_ADDR_LEN - 1] % IEEE80211_NODE_HASHSIZE) /* * Table of ieee80211_node instances. Each ieee80211com diff --git a/drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c b/drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c index 528aeec..010e0ca 100644 --- a/drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c +++ b/drivers/staging/ath6kl/wlan/src/wlan_recv_beacon.c @@ -31,19 +31,21 @@ #include <ieee80211.h> #include <wlan_api.h> -#define IEEE80211_VERIFY_LENGTH(_len, _minlen) do { \ - if ((_len) < (_minlen)) { \ - return A_EINVAL; \ - } \ +#define IEEE80211_VERIFY_LENGTH(_len, _minlen) \ +do { \ + if ((_len) < (_minlen)) { \ + return A_EINVAL; \ + } \ } while (0) -#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen) do { \ - if ((__elem) == NULL) { \ - return A_EINVAL; \ - } \ - if ((__elem)[1] > (__maxlen)) { \ - return A_EINVAL; \ - } \ +#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen) \ +do { \ + if ((__elem) == NULL) { \ + return A_EINVAL; \ + } \ + if ((__elem)[1] > (__maxlen)) { \ + return A_EINVAL; \ + } \ } while (0) diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c index 3fded6c..31ab3e7 100644 --- a/drivers/staging/ath6kl/wmi/wmi.c +++ b/drivers/staging/ath6kl/wmi/wmi.c @@ -1239,7 +1239,7 @@ wmi_ready_event_rx(struct wmi_t *wmip, u8 *datap, int len) return 0; } -#define LE_READ_4(p) \ +#define LE_READ_4(p) \ ((u32) \ ((((u8 *)(p))[0] ) | (((u8 *)(p))[1] << 8) | \ (((u8 *)(p))[2] << 16) | (((u8 *)(p))[3] << 24))) -- 1.7.4.rc3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel