INT32 hifsdiod_start(void) { int iRet = -1; init_waitqueue_head(&gHifsdiodEvent); #if 0 osal_event_init(&gHifsdiodEvent); gConIdQueryThread.pThreadData = (VOID *)NULL; gConIdQueryThread.pThreadFunc = (VOID *)hif_sdio_proc; osal_memcpy(gConIdQueryThread.threadName, gConIdQueryName , osal_strlen(gConIdQueryName)); iRet = osal_thread_create(&gConIdQueryThread); if (iRet < 0) { HIF_SDIO_ERR_FUNC("osal_thread_create fail...\n"); goto ERR_EXIT1; } #else gConIdQueryThread = kthread_create(hif_sdio_proc, NULL, gConIdQueryName); if (NULL == gConIdQueryThread) { HIF_SDIO_ERR_FUNC("osal_thread_create fail...\n"); goto ERR_EXIT1; } #endif #if 0 /* Start STPd thread*/ iRet = osal_thread_run(&gConIdQueryThread); if(iRet < 0) { HIF_SDIO_ERR_FUNC("osal_thread_run FAILS\n"); goto ERR_EXIT1; } #else if (gConIdQueryThread) { wake_up_process(gConIdQueryThread); } else { goto ERR_EXIT1; } #endif iRet = 0; HIF_SDIO_INFO_FUNC("succeed\n"); return iRet; ERR_EXIT1: HIF_SDIO_ERR_FUNC("failed\n"); return iRet; }
MTKSTP_BTM_T *stp_btm_init(void) { INT32 i = 0x0; INT32 ret =-1; osal_unsleepable_lock_init(&stp_btm->wq_spinlock); osal_event_init(&stp_btm->STPd_event); stp_btm->wmt_notify = wmt_lib_btm_cb; RB_INIT(&stp_btm->rFreeOpQ, STP_BTM_OP_BUF_SIZE); RB_INIT(&stp_btm->rActiveOpQ, STP_BTM_OP_BUF_SIZE); /* Put all to free Q */ for (i = 0; i < STP_BTM_OP_BUF_SIZE; i++) { osal_signal_init(&(stp_btm->arQue[i].signal)); _stp_btm_put_op(stp_btm, &stp_btm->rFreeOpQ, &(stp_btm->arQue[i])); } /*Generate PSM thread, to servie STP-CORE for packet retrying and core dump receiving*/ stp_btm->BTMd.pThreadData = (VOID *)stp_btm; stp_btm->BTMd.pThreadFunc = (VOID *)_stp_btm_proc; osal_memcpy(stp_btm->BTMd.threadName, BTM_THREAD_NAME , osal_strlen(BTM_THREAD_NAME)); ret = osal_thread_create(&stp_btm->BTMd); if (ret < 0) { STP_BTM_ERR_FUNC("osal_thread_create fail...\n"); goto ERR_EXIT1; } /* Start STPd thread*/ ret = osal_thread_run(&stp_btm->BTMd); if(ret < 0) { STP_BTM_ERR_FUNC("osal_thread_run FAILS\n"); goto ERR_EXIT1; } return stp_btm; ERR_EXIT1: return NULL; }