Commit c347dc62 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: pass the cmd parm buffer directly to the cmd handler

commit 0348dc74 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: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ea0c927d
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment