From: Jes Sorensen Date: Fri, 9 May 2014 13:03:10 +0000 (+0200) Subject: staging: rtl8723au: pass the cmd parm buffer directly to the cmd handler X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=c347dc6207f81dfbb95f426c783cb95899f710ab;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git staging: rtl8723au: pass the cmd parm buffer directly to the cmd handler commit 0348dc74f6689825c16db40fbe0ce6ad2da5bab9 ensured that the parm buffer passed to the cmd handlers is not being over-written. Hence there is no need to make a copy of the parm buffer just to pass it into the cmd handler. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index 5b3ac6901147..d139a32a405a 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -175,18 +175,6 @@ int rtw_init_cmd_priv23a(struct cmd_priv *pcmdpriv) { int res = _SUCCESS; - pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, - GFP_KERNEL); - - if (pcmdpriv->cmd_allocated_buf == NULL) { - res = _FAIL; - goto exit; - } - - pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - - ((unsigned long)(pcmdpriv->cmd_allocated_buf) & - (CMDBUFF_ALIGN_SZ - 1)); - pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL); if (!pcmdpriv->rsp_allocated_buf) { @@ -248,10 +236,8 @@ void rtw_free_cmd_priv23a(struct cmd_priv *pcmdpriv) RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("rtw_free_cmd_priv23a\n")); - if (pcmdpriv) { - kfree(pcmdpriv->cmd_allocated_buf); + if (pcmdpriv) kfree(pcmdpriv->rsp_allocated_buf); - } } static int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) @@ -341,10 +327,8 @@ static void rtw_cmd_work(struct work_struct *work) void (*pcmd_callback)(struct rtw_adapter *dev, struct cmd_obj *pcmd); struct cmd_priv *pcmdpriv; struct cmd_obj *pcmd = container_of(work, struct cmd_obj, work); - u8 *pcmdbuf; pcmdpriv = &pcmd->padapter->cmdpriv; - pcmdbuf = pcmdpriv->cmd_buf; if (rtw_cmd_filter(pcmdpriv, pcmd) == _FAIL) { pcmd->res = H2C_DROPPED; @@ -355,13 +339,11 @@ static void rtw_cmd_work(struct work_struct *work) pcmd->cmdsz = ALIGN(pcmd->cmdsz, 4); - memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); - if (pcmd->cmdcode < (sizeof(wlancmds)/sizeof(struct cmd_hdl))) { cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; if (cmd_hdl) - pcmd->res = cmd_hdl(pcmd->padapter, pcmdbuf); + pcmd->res = cmd_hdl(pcmd->padapter, pcmd->parmbuf); else pcmd->res = H2C_DROPPED; } else diff --git a/drivers/staging/rtl8723au/include/rtw_cmd.h b/drivers/staging/rtl8723au/include/rtw_cmd.h index 3ecb971c6e39..3e0698022184 100644 --- a/drivers/staging/rtl8723au/include/rtw_cmd.h +++ b/drivers/staging/rtl8723au/include/rtw_cmd.h @@ -44,8 +44,6 @@ struct cmd_obj { struct cmd_priv { struct workqueue_struct *wq; - u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */ - u8 *cmd_allocated_buf; u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */ u8 *rsp_allocated_buf; u32 cmd_issued_cnt;