qcacmn: Separate qdf event complete and exit APIs

QDF already has event complete API. Define a separate new
API for exit in QDF and re-use qdf_event_set for event
completion.

Change-Id: If332425ee71b0a4759e0550a33add35e61680309
CRs-Fixed: 1101614
This commit is contained in:
Rajeev Kumar
2016-12-14 17:42:56 -08:00
committed by qcabuildsw
parent 4ae759f7b6
commit e91c6cf5c9
3 changed files with 12 additions and 32 deletions

View File

@@ -58,13 +58,12 @@ QDF_STATUS qdf_event_destroy(qdf_event_t *event);
QDF_STATUS qdf_wait_single_event(qdf_event_t *event, QDF_STATUS qdf_wait_single_event(qdf_event_t *event,
uint32_t timeout); uint32_t timeout);
/** /**
* qdf_event_complete_and_exit() - complete event and exit * qdf_exit_thread() - exit thread execution
* @event: Pointer to an event to complete and exit * @status: QDF status
* @reason_code: Reason code for exit
* *
* Return: QDF status * Return: QDF status
*/ */
QDF_STATUS qdf_event_complete_and_exit(qdf_event_t *event, long reason_code); QDF_STATUS qdf_exit_thread(QDF_STATUS status);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -268,34 +268,13 @@ QDF_STATUS qdf_wait_single_event(qdf_event_t *event, uint32_t timeout)
} }
EXPORT_SYMBOL(qdf_wait_single_event); EXPORT_SYMBOL(qdf_wait_single_event);
QDF_STATUS qdf_event_complete_and_exit(qdf_event_t *event, long reason_code) QDF_STATUS qdf_exit_thread(QDF_STATUS status)
{ {
if (in_interrupt()) { if (status == QDF_STATUS_SUCCESS)
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, do_exit(0);
"%s cannot be called from interrupt context!!!", else
__func__); do_exit(SIGKILL);
QDF_ASSERT(0);
return QDF_STATUS_E_FAULT;
}
/* check for null pointer */
if (NULL == event) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"NULL event passed into %s", __func__);
QDF_ASSERT(0);
return QDF_STATUS_E_FAULT;
}
/* check if cookie is same as that of initialized event */
if (LINUX_EVENT_COOKIE != event->cookie) {
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
"Uninitialized event passed into %s", __func__);
QDF_ASSERT(0);
return QDF_STATUS_E_INVAL;
}
complete_and_exit(&event->complete, reason_code);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
EXPORT_SYMBOL(qdf_event_complete_and_exit); EXPORT_SYMBOL(qdf_exit_thread);

View File

@@ -411,7 +411,9 @@ int scheduler_thread(void *arg)
/* If we get here the MC thread must exit */ /* If we get here the MC thread must exit */
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR,
"%s: Scheduler thread exiting!!!!", __func__); "%s: Scheduler thread exiting!!!!", __func__);
qdf_event_complete_and_exit(&sch_ctx->sch_shutdown, 0); qdf_event_set(&sch_ctx->sch_shutdown);
qdf_exit_thread(QDF_STATUS_SUCCESS);
return 0; return 0;
} }