From 19a7dd28f5fa7834285597278564da240b15f941 Mon Sep 17 00:00:00 2001 From: Leo Chang Date: Fri, 13 Nov 2015 13:35:15 -0800 Subject: [PATCH] qcacld-3.0: qcacld-2.0: replace semaphore to completion qcacld-2.0 to qcacld-3.0 propagation HTC RX event wait semaphore waiting event infinte. Infinte waiting will hang device and cannot getting out from system hang. To collect FW RAM dump and make correct panic, semaphore should be replaced with time limitted compeletion Change-Id: Idabfc7916676c9e986e953b50108653a5b394278 CRs-fixed: 924387 --- core/htc/htc_internal.h | 2 +- core/htc/htc_recv.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/htc/htc_internal.h b/core/htc/htc_internal.h index 2e48b790d4..b7a526ec64 100644 --- a/core/htc/htc_internal.h +++ b/core/htc/htc_internal.h @@ -162,7 +162,7 @@ typedef struct _HTC_TARGET { HTC_PACKET_QUEUE ControlBufferTXFreeList; A_UINT8 CtrlResponseBuffer[HTC_MAX_CONTROL_MESSAGE_LENGTH]; int CtrlResponseLength; - cdf_semaphore_t CtrlResponseValid; + cdf_event_t ctrl_response_valid; A_BOOL CtrlResponseProcessing; int TotalTransmitCredits; HTC_SERVICE_TX_CREDIT_ALLOCATION diff --git a/core/htc/htc_recv.c b/core/htc/htc_recv.c index 38f13768f1..ad0644ce69 100644 --- a/core/htc/htc_recv.c +++ b/core/htc/htc_recv.c @@ -31,6 +31,9 @@ #include /* cdf_nbuf_t */ #include "epping_main.h" +/* HTC Control message receive timeout msec */ +#define HTC_CONTROL_RX_TIMEOUT 3000 + #ifdef DEBUG void debug_dump_bytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription) { @@ -433,9 +436,7 @@ CDF_STATUS htc_rx_completion_handler(void *Context, cdf_nbuf_t netbuf, target->CtrlResponseProcessing = true; UNLOCK_HTC_RX(target); - cdf_semaphore_release(target->osdev, - &target-> - CtrlResponseValid); + cdf_event_set(&target->ctrl_response_valid); break; case HTC_MSG_SEND_SUSPEND_COMPLETE: wow_nack = 0; @@ -599,9 +600,8 @@ void htc_flush_rx_hold_queue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint) void htc_recv_init(HTC_TARGET *target) { - /* Initialize CtrlResponseValid to block */ - cdf_semaphore_init(&target->CtrlResponseValid); - cdf_semaphore_acquire(target->osdev, &target->CtrlResponseValid); + /* Initialize ctrl_response_valid to block */ + cdf_event_init(&target->ctrl_response_valid); } /* polling routine to wait for a control packet to be received */ @@ -612,7 +612,10 @@ A_STATUS htc_wait_recv_ctrl_message(HTC_TARGET *target) AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCWaitCtrlMessageRecv\n")); /* Wait for BMI request/response transaction to complete */ - while (cdf_semaphore_acquire(target->osdev, &target->CtrlResponseValid)) { + if (cdf_wait_single_event(&target->ctrl_response_valid, + cdf_system_msecs_to_ticks(HTC_CONTROL_RX_TIMEOUT))) { + CDF_BUG(0); + return A_ERROR; } LOCK_HTC_RX(target);