staging: rtl8723au: pass the cmd parm buffer directly to the cmd handler
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 9 May 2014 13:03:10 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:11:56 +0000 (13:11 -0700)
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 <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_cmd.c
drivers/staging/rtl8723au/include/rtw_cmd.h

index 5b3ac69011470a872f02819f429ac4887c72b518..d139a32a405a2602c8cd67559cdc168bd8a47026 100644 (file)
@@ -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
index 3ecb971c6e3995d0b694ddf58e7178f72b15b12f..3e06980221844f70698cd2c5a5888d8bcbfb02b0 100644 (file)
@@ -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;