Commit 509c9d97 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: ath6kl: Remove A_SUCCESS macro

Remove obfuscating A_SUCCESS(foo) macro.
Just test for !foo instead.

Reformat a few macros that used A_SUCCESS for better readability.
Add do { foo } while (0) surrounds to those macros too.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarVipin Mehta <vipin.mehta@atheros.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1f4c34bd
...@@ -985,7 +985,7 @@ BMIFastDownload(HIF_DEVICE *device, A_UINT32 address, A_UCHAR *buffer, A_UINT32 ...@@ -985,7 +985,7 @@ BMIFastDownload(HIF_DEVICE *device, A_UINT32 address, A_UCHAR *buffer, A_UINT32
status = BMILZData(device, (A_UINT8 *)&lastWord, 4); status = BMILZData(device, (A_UINT8 *)&lastWord, 4);
} }
if (A_SUCCESS(status)) { if (!status) {
// //
// Close compressed stream and open a new (fake) one. This serves mainly to flush Target caches. // Close compressed stream and open a new (fake) one. This serves mainly to flush Target caches.
// //
......
...@@ -1120,7 +1120,7 @@ static int hifDeviceResume(struct device *dev) ...@@ -1120,7 +1120,7 @@ static int hifDeviceResume(struct device *dev)
} }
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n")); AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n"));
return A_SUCCESS(status) ? 0 : status; return status;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
...@@ -1167,7 +1167,7 @@ int hifWaitForPendingRecv(HIF_DEVICE *device) ...@@ -1167,7 +1167,7 @@ int hifWaitForPendingRecv(HIF_DEVICE *device)
status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS, status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&host_int_status, sizeof(host_int_status), (A_UINT8 *)&host_int_status, sizeof(host_int_status),
HIF_RD_SYNC_BYTE_INC, NULL); HIF_RD_SYNC_BYTE_INC, NULL);
host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)) : 0; host_int_status = !status ? (host_int_status & (1 << 0)) : 0;
if (host_int_status) { if (host_int_status) {
schedule(); /* schedule for next dsrHandler */ schedule(); /* schedule for next dsrHandler */
} }
......
...@@ -516,7 +516,7 @@ int DevWaitForPendingRecv(AR6K_DEVICE *pDev,A_UINT32 TimeoutInMs,A_BOOL *pbIsRec ...@@ -516,7 +516,7 @@ int DevWaitForPendingRecv(AR6K_DEVICE *pDev,A_UINT32 TimeoutInMs,A_BOOL *pbIsRec
break; break;
} }
host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)):0; host_int_status = !status ? (host_int_status & (1 << 0)):0;
if(!host_int_status) if(!host_int_status)
{ {
status = A_OK; status = A_OK;
...@@ -832,7 +832,7 @@ int DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer) ...@@ -832,7 +832,7 @@ int DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer)
/* we can try to use a virtual DMA scatter mechanism using legacy HIFReadWrite() */ /* we can try to use a virtual DMA scatter mechanism using legacy HIFReadWrite() */
status = DevSetupVirtualScatterSupport(pDev); status = DevSetupVirtualScatterSupport(pDev);
if (A_SUCCESS(status)) { if (!status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("AR6K: virtual scatter transfers enabled (max scatter items:%d: maxlen:%d) \n", ("AR6K: virtual scatter transfers enabled (max scatter items:%d: maxlen:%d) \n",
DEV_GET_MAX_MSG_PER_BUNDLE(pDev), DEV_GET_MAX_BUNDLE_LENGTH(pDev))); DEV_GET_MAX_MSG_PER_BUNDLE(pDev), DEV_GET_MAX_BUNDLE_LENGTH(pDev)));
...@@ -844,7 +844,7 @@ int DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer) ...@@ -844,7 +844,7 @@ int DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer)
DEV_GET_MAX_MSG_PER_BUNDLE(pDev), DEV_GET_MAX_BUNDLE_LENGTH(pDev))); DEV_GET_MAX_MSG_PER_BUNDLE(pDev), DEV_GET_MAX_BUNDLE_LENGTH(pDev)));
} }
if (A_SUCCESS(status)) { if (!status) {
/* for the recv path, the maximum number of bytes per recv bundle is just limited /* for the recv path, the maximum number of bytes per recv bundle is just limited
* by the maximum transfer size at the HIF layer */ * by the maximum transfer size at the HIF layer */
pDev->MaxRecvBundleSize = pDev->HifScatterInfo.MaxTransferSizePerScatterReq; pDev->MaxRecvBundleSize = pDev->HifScatterInfo.MaxTransferSizePerScatterReq;
......
...@@ -275,12 +275,16 @@ static INLINE int DevRecvPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 ...@@ -275,12 +275,16 @@ static INLINE int DevRecvPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32
int DevCopyScatterListToFromDMABuffer(HIF_SCATTER_REQ *pReq, A_BOOL FromDMA); int DevCopyScatterListToFromDMABuffer(HIF_SCATTER_REQ *pReq, A_BOOL FromDMA);
/* copy any READ data back into scatter list */ /* copy any READ data back into scatter list */
#define DEV_FINISH_SCATTER_OPERATION(pR) \ #define DEV_FINISH_SCATTER_OPERATION(pR) \
if (A_SUCCESS((pR)->CompletionStatus) && \ do { \
!((pR)->Request & HIF_WRITE) && \ if (!((pR)->CompletionStatus) && \
((pR)->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) { \ !((pR)->Request & HIF_WRITE) && \
(pR)->CompletionStatus = DevCopyScatterListToFromDMABuffer((pR),FROM_DMA_BUFFER); \ ((pR)->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) { \
} (pR)->CompletionStatus = \
DevCopyScatterListToFromDMABuffer((pR), \
FROM_DMA_BUFFER); \
} \
} while (0)
/* copy any WRITE data to bounce buffer */ /* copy any WRITE data to bounce buffer */
static INLINE int DEV_PREPARE_SCATTER_OPERATION(HIF_SCATTER_REQ *pReq) { static INLINE int DEV_PREPARE_SCATTER_OPERATION(HIF_SCATTER_REQ *pReq) {
......
...@@ -372,7 +372,7 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket) ...@@ -372,7 +372,7 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
* go get the next message */ * go get the next message */
status = pDev->MessagePendingCallback(pDev->HTCContext, &lookAhead, 1, NULL, &fetched); status = pDev->MessagePendingCallback(pDev->HTCContext, &lookAhead, 1, NULL, &fetched);
if (A_SUCCESS(status) && !fetched) { if (!status && !fetched) {
/* HTC layer could not pull out messages due to lack of resources, stop IRQ processing */ /* HTC layer could not pull out messages due to lack of resources, stop IRQ processing */
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("MessagePendingCallback did not pull any messages, force-ack \n")); AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("MessagePendingCallback did not pull any messages, force-ack \n"));
DevAsyncIrqProcessComplete(pDev); DevAsyncIrqProcessComplete(pDev);
...@@ -725,7 +725,7 @@ int DevDsrHandler(void *context) ...@@ -725,7 +725,7 @@ int DevDsrHandler(void *context)
} }
if (A_SUCCESS(status) && !asyncProc) { if (!status && !asyncProc) {
/* Ack the interrupt only if : /* Ack the interrupt only if :
* 1. we did not get any errors in processing interrupts * 1. we did not get any errors in processing interrupts
* 2. there are no outstanding async processing requests */ * 2. there are no outstanding async processing requests */
......
...@@ -589,7 +589,7 @@ int DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCredits ...@@ -589,7 +589,7 @@ int DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCredits
} }
if (pIOPacket != NULL) { if (pIOPacket != NULL) {
if (A_SUCCESS(status)) { if (!status) {
/* sync mode processing */ /* sync mode processing */
*pCredits = ProcessCreditCounterReadBuffer(pIOPacket->pBuffer, AR6K_REG_IO_BUFFER_SIZE); *pCredits = ProcessCreditCounterReadBuffer(pIOPacket->pBuffer, AR6K_REG_IO_BUFFER_SIZE);
} }
...@@ -614,7 +614,7 @@ int DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize) ...@@ -614,7 +614,7 @@ int DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize)
HIF_RD_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */ HIF_RD_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */
NULL); NULL);
if (A_SUCCESS(status)) { if (!status) {
if (buffer[0] == 0) { if (buffer[0] == 0) {
*pCreditSize = 256; *pCreditSize = 256;
} else { } else {
...@@ -708,7 +708,7 @@ int DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int Signal, int AckTimeoutMS) ...@@ -708,7 +708,7 @@ int DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int Signal, int AckTimeoutMS)
} while (FALSE); } while (FALSE);
if (A_SUCCESS(status)) { if (!status) {
/* now read back the register to see if the bit cleared */ /* now read back the register to see if the bit cleared */
while (AckTimeoutMS) { while (AckTimeoutMS) {
status = HIFReadWrite(pDev->HIFDevice, status = HIFReadWrite(pDev->HIFDevice,
......
...@@ -82,11 +82,16 @@ typedef struct { ...@@ -82,11 +82,16 @@ typedef struct {
#define LOCK_HCI_TX(t) A_MUTEX_LOCK(&(t)->HCITxLock); #define LOCK_HCI_TX(t) A_MUTEX_LOCK(&(t)->HCITxLock);
#define UNLOCK_HCI_TX(t) A_MUTEX_UNLOCK(&(t)->HCITxLock); #define UNLOCK_HCI_TX(t) A_MUTEX_UNLOCK(&(t)->HCITxLock);
#define DO_HCI_RECV_INDICATION(p,pt) \ #define DO_HCI_RECV_INDICATION(p, pt) \
{ AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d \n", \ do { \
(unsigned long)(pt),(pt)->Status, A_SUCCESS((pt)->Status) ? (pt)->ActualLength : 0, HCI_GET_PACKET_TYPE(pt))); \ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, \
(p)->HCIConfig.pHCIPktRecv((p)->HCIConfig.pContext, (pt)); \ ("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d \n", \
} (unsigned long)(pt), \
(pt)->Status, \
!(pt)->Status ? (pt)->ActualLength : 0, \
HCI_GET_PACKET_TYPE(pt))); \
(p)->HCIConfig.pHCIPktRecv((p)->HCIConfig.pContext, (pt)); \
} while (0)
#define DO_HCI_SEND_INDICATION(p,pt) \ #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", \ { AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: Indicate Send on packet:0x%lX status:%d type:%d \n", \
...@@ -175,7 +180,7 @@ static int InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt) ...@@ -175,7 +180,7 @@ static int InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
} while (FALSE); } while (FALSE);
if (A_SUCCESS(status)) { if (!status) {
pProt->CreditsAvailable = pProt->CreditsMax; pProt->CreditsAvailable = pProt->CreditsMax;
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("HCI : InitTxCreditState - credits avail: %d, size: %d \n", AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("HCI : InitTxCreditState - credits avail: %d, size: %d \n",
pProt->CreditsAvailable, pProt->CreditSize)); pProt->CreditsAvailable, pProt->CreditSize));
...@@ -768,7 +773,7 @@ static int HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_BOOL S ...@@ -768,7 +773,7 @@ static int HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_BOOL S
if (Synchronous) { if (Synchronous) {
A_ASSERT(pPacket != NULL); A_ASSERT(pPacket != NULL);
if (A_SUCCESS(status) && (!synchSendComplete)) { if (!status && (!synchSendComplete)) {
status = A_EBUSY; status = A_EBUSY;
A_ASSERT(FALSE); A_ASSERT(FALSE);
LOCK_HCI_TX(pProt); LOCK_HCI_TX(pProt);
...@@ -865,7 +870,7 @@ int GMboxProtocolInstall(AR6K_DEVICE *pDev) ...@@ -865,7 +870,7 @@ int GMboxProtocolInstall(AR6K_DEVICE *pDev)
} while (FALSE); } while (FALSE);
if (A_SUCCESS(status)) { if (!status) {
LOCK_AR6K(pDev); LOCK_AR6K(pDev);
DEV_GMBOX_SET_PROTOCOL(pDev, DEV_GMBOX_SET_PROTOCOL(pDev,
HCIUartMessagePending, HCIUartMessagePending,
......
...@@ -410,7 +410,7 @@ static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target, ...@@ -410,7 +410,7 @@ static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target,
"BAD lookaheads from lookahead report"); "BAD lookaheads from lookahead report");
#endif #endif
} }
if (A_SUCCESS(nextStatus) && !fetched) { if (!nextStatus && !fetched) {
/* we could not fetch any more packets due to resources */ /* we could not fetch any more packets due to resources */
DevAsyncIrqProcessComplete(&target->Device); DevAsyncIrqProcessComplete(&target->Device);
} }
...@@ -923,14 +923,14 @@ static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq) ...@@ -923,14 +923,14 @@ static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
* break out of this loop */ * break out of this loop */
numLookAheads = 0; numLookAheads = 0;
if (A_SUCCESS(pScatterReq->CompletionStatus)) { if (!pScatterReq->CompletionStatus) {
/* process header for each of the recv packets */ /* process header for each of the recv packets */
status = HTCProcessRecvHeader(target,pPacket,lookAheads,&numLookAheads); status = HTCProcessRecvHeader(target,pPacket,lookAheads,&numLookAheads);
} else { } else {
status = A_ERROR; status = A_ERROR;
} }
if (A_SUCCESS(status)) { if (!status) {
#ifdef HTC_EP_STAT_PROFILING #ifdef HTC_EP_STAT_PROFILING
LOCK_HTC_RX(target); LOCK_HTC_RX(target);
HTC_RX_STAT_PROFILE(target,pEndpoint,numLookAheads); HTC_RX_STAT_PROFILE(target,pEndpoint,numLookAheads);
...@@ -1085,7 +1085,7 @@ static int HTCIssueRecvPacketBundle(HTC_TARGET *target, ...@@ -1085,7 +1085,7 @@ static int HTCIssueRecvPacketBundle(HTC_TARGET *target,
status = DevSubmitScatterRequest(&target->Device, pScatterReq, DEV_SCATTER_READ, asyncMode); status = DevSubmitScatterRequest(&target->Device, pScatterReq, DEV_SCATTER_READ, asyncMode);
if (A_SUCCESS(status)) { if (!status) {
*pNumPacketsFetched = i; *pNumPacketsFetched = i;
} }
...@@ -1261,7 +1261,7 @@ int HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], int Nu ...@@ -1261,7 +1261,7 @@ int HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], int Nu
} }
if (A_SUCCESS(status)) { if (!status) {
CheckRecvWaterMark(pEndpoint); CheckRecvWaterMark(pEndpoint);
} }
......
...@@ -73,8 +73,7 @@ ...@@ -73,8 +73,7 @@
#define A_PHY_ERROR 27 /* RX PHY error */ #define A_PHY_ERROR 27 /* RX PHY error */
#define A_CONSUMED 28 /* Object was consumed */ #define A_CONSUMED 28 /* Object was consumed */
#define A_SUCCESS(x) (x == A_OK) #define A_FAILED(x) (!!x)
#define A_FAILED(x) (!A_SUCCESS(x))
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
......
...@@ -288,7 +288,7 @@ static int AR3KExitMinBoot(AR3K_CONFIG_INFO *pConfig) ...@@ -288,7 +288,7 @@ static int AR3KExitMinBoot(AR3K_CONFIG_INFO *pConfig)
&pEvent, &pEvent,
&pBufferToFree); &pBufferToFree);
if (A_SUCCESS(status)) { if (!status) {
if (pEvent[EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET] != 0) { if (pEvent[EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET] != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("AR3K Config: MinBoot exit command event status failed: %d \n", ("AR3K Config: MinBoot exit command event status failed: %d \n",
......
...@@ -1674,8 +1674,8 @@ ar6000_avail_ev(void *context, void *hif_handle) ...@@ -1674,8 +1674,8 @@ ar6000_avail_ev(void *context, void *hif_handle)
if (ar_netif) { if (ar_netif) {
HIF_DEVICE_OS_DEVICE_INFO osDevInfo; HIF_DEVICE_OS_DEVICE_INFO osDevInfo;
A_MEMZERO(&osDevInfo, sizeof(osDevInfo)); A_MEMZERO(&osDevInfo, sizeof(osDevInfo));
if ( A_SUCCESS( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, if (!HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE,
&osDevInfo, sizeof(osDevInfo))) ) { &osDevInfo, sizeof(osDevInfo))) {
SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); SET_NETDEV_DEV(dev, osDevInfo.pOSDevice);
} }
} }
...@@ -3115,7 +3115,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -3115,7 +3115,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)
if (ac == HCI_TRANSPORT_STREAM_NUM) { if (ac == HCI_TRANSPORT_STREAM_NUM) {
/* pass this to HCI */ /* pass this to HCI */
#ifndef EXPORT_HCI_BRIDGE_INTERFACE #ifndef EXPORT_HCI_BRIDGE_INTERFACE
if (A_SUCCESS(hci_test_send(ar,skb))) { if (!hci_test_send(ar,skb)) {
return 0; return 0;
} }
#endif #endif
...@@ -3428,7 +3428,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) ...@@ -3428,7 +3428,7 @@ ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue)
/* add this to the list, use faster non-lock API */ /* add this to the list, use faster non-lock API */
__skb_queue_tail(&skb_queue,pktSkb); __skb_queue_tail(&skb_queue,pktSkb);
if (A_SUCCESS(status)) { if (!status) {
A_ASSERT(pPacket->ActualLength == A_NETBUF_LEN(pktSkb)); A_ASSERT(pPacket->ActualLength == A_NETBUF_LEN(pktSkb));
} }
...@@ -3597,7 +3597,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket) ...@@ -3597,7 +3597,7 @@ ar6000_rx(void *Context, HTC_PACKET *pPacket)
* and adaptive power throughput state */ * and adaptive power throughput state */
AR6000_SPIN_LOCK(&ar->arLock, 0); AR6000_SPIN_LOCK(&ar->arLock, 0);
if (A_SUCCESS(status)) { if (!status) {
AR6000_STAT_INC(ar, rx_packets); AR6000_STAT_INC(ar, rx_packets);
ar->arNetStats.rx_bytes += pPacket->ActualLength; ar->arNetStats.rx_bytes += pPacket->ActualLength;
#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL
......
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