void rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
{
init_completion(&pcmdpriv->cmd_queue_comp);
- init_completion(&pcmdpriv->terminate_cmdthread_comp);
_rtw_init_queue(&pcmdpriv->cmd_queue);
}
bAllow = true;
if ((!padapter->hw_init_completed && !bAllow) ||
- !pcmdpriv->cmdthd_running) /* com_thread not running */
+ !padapter->cmdThread) /* com_thread not running */
return _FAIL;
return _SUCCESS;
}
allow_signal(SIGTERM);
- pcmdpriv->cmdthd_running = true;
-
- while (1) {
+ do {
if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
break;
if (signal_pending(current))
flush_signals(current);
- }
- pcmdpriv->cmdthd_running = false;
+ } while (!kthread_should_stop());
/* free all cmd_obj resources */
while ((pcmd = rtw_dequeue_cmd(&pcmdpriv->cmd_queue)))
rtw_free_cmd_obj(pcmd);
- complete(&pcmdpriv->terminate_cmdthread_comp);
-
- complete_and_exit(NULL, 0);
+ padapter->cmdThread = NULL;
+ return 0;
}
/*
struct cmd_priv {
struct completion cmd_queue_comp;
- struct completion terminate_cmdthread_comp;
struct __queue cmd_queue;
- u8 cmdthd_running;
};
#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def;
loadparam(padapter, pnetdev);
+ padapter->cmdThread = NULL;
return pnetdev;
}
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+%s\n", __func__));
- padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter,
- "RTW_CMD_THREAD");
- if (IS_ERR(padapter->cmdThread))
+ padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "RTW_CMD_THREAD");
+ if (IS_ERR(padapter->cmdThread)) {
err = PTR_ERR(padapter->cmdThread);
+ padapter->cmdThread = NULL;
+ }
return err;
}
{
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+%s\n", __func__));
- /* Below is to terminate rtw_cmd_thread & event_thread... */
+ if (!padapter->cmdThread)
+ return;
+
complete(&padapter->cmdpriv.cmd_queue_comp);
- if (padapter->cmdThread)
- wait_for_completion_interruptible(&padapter->cmdpriv.terminate_cmdthread_comp);
+ kthread_stop(padapter->cmdThread);
}
static u8 rtw_init_default_value(struct adapter *padapter)