Commit 53055d6a authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman

staging: wlan-ng: Remove function hfa384x_docmd_wait()

As hfa384x_docmd is only called by hfa384x_docmd_wait, and
hfa384x_docmd_wait always passes 4 constant arguments (DOWAIT,
NULL, NULL, NULL) to hfa384x_docmd, these constant parameters may be
removed from hfa384x_docmd and their values used directly instead.
Remove check for one of these constant parameters of hfa384x_docmd as
it is no longer necessary.
Remove hfa384x_docmd_wait as it does nothing except call hfa384x_docmd.
Modify call sites of hfa384x_docmd_wait to call hfa384x_docmd instead.
Change type of hfa384x_docmd to inline to match type of former
hfa384x_docmd_wait.
Issue found with Coccinelle.
Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190712062807.9361-8-nishkadg.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aef29ca4
...@@ -226,11 +226,9 @@ usbctlx_get_rridresult(const struct hfa384x_usb_rridresp *rridresp, ...@@ -226,11 +226,9 @@ usbctlx_get_rridresult(const struct hfa384x_usb_rridresp *rridresp,
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Low level req/resp CTLX formatters and submitters */ /* Low level req/resp CTLX formatters and submitters */
static int static inline int
hfa384x_docmd(struct hfa384x *hw, hfa384x_docmd(struct hfa384x *hw,
enum cmd_mode mode, struct hfa384x_metacmd *cmd);
struct hfa384x_metacmd *cmd,
ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
static int static int
hfa384x_dorrid(struct hfa384x *hw, hfa384x_dorrid(struct hfa384x *hw,
...@@ -820,12 +818,6 @@ static void hfa384x_cb_status(struct hfa384x *hw, ...@@ -820,12 +818,6 @@ static void hfa384x_cb_status(struct hfa384x *hw,
} }
} }
static inline int hfa384x_docmd_wait(struct hfa384x *hw,
struct hfa384x_metacmd *cmd)
{
return hfa384x_docmd(hw, DOWAIT, cmd, NULL, NULL, NULL);
}
static inline int static inline int
hfa384x_dormem_wait(struct hfa384x *hw, hfa384x_dormem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len) u16 page, u16 offset, void *data, unsigned int len)
...@@ -873,7 +865,7 @@ int hfa384x_cmd_initialize(struct hfa384x *hw) ...@@ -873,7 +865,7 @@ int hfa384x_cmd_initialize(struct hfa384x *hw)
cmd.parm1 = 0; cmd.parm1 = 0;
cmd.parm2 = 0; cmd.parm2 = 0;
result = hfa384x_docmd_wait(hw, &cmd); result = hfa384x_docmd(hw, &cmd);
pr_debug("cmdresp.init: status=0x%04x, resp0=0x%04x, resp1=0x%04x, resp2=0x%04x\n", pr_debug("cmdresp.init: status=0x%04x, resp0=0x%04x, resp1=0x%04x, resp2=0x%04x\n",
cmd.result.status, cmd.result.status,
...@@ -919,7 +911,7 @@ int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport) ...@@ -919,7 +911,7 @@ int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport)
cmd.parm1 = 0; cmd.parm1 = 0;
cmd.parm2 = 0; cmd.parm2 = 0;
return hfa384x_docmd_wait(hw, &cmd); return hfa384x_docmd(hw, &cmd);
} }
/*---------------------------------------------------------------- /*----------------------------------------------------------------
...@@ -953,7 +945,7 @@ int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport) ...@@ -953,7 +945,7 @@ int hfa384x_cmd_enable(struct hfa384x *hw, u16 macport)
cmd.parm1 = 0; cmd.parm1 = 0;
cmd.parm2 = 0; cmd.parm2 = 0;
return hfa384x_docmd_wait(hw, &cmd); return hfa384x_docmd(hw, &cmd);
} }
/*---------------------------------------------------------------- /*----------------------------------------------------------------
...@@ -996,7 +988,7 @@ int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable) ...@@ -996,7 +988,7 @@ int hfa384x_cmd_monitor(struct hfa384x *hw, u16 enable)
cmd.parm1 = 0; cmd.parm1 = 0;
cmd.parm2 = 0; cmd.parm2 = 0;
return hfa384x_docmd_wait(hw, &cmd); return hfa384x_docmd(hw, &cmd);
} }
/*---------------------------------------------------------------- /*----------------------------------------------------------------
...@@ -1053,7 +1045,7 @@ int hfa384x_cmd_download(struct hfa384x *hw, u16 mode, u16 lowaddr, ...@@ -1053,7 +1045,7 @@ int hfa384x_cmd_download(struct hfa384x *hw, u16 mode, u16 lowaddr,
cmd.parm1 = highaddr; cmd.parm1 = highaddr;
cmd.parm2 = codelen; cmd.parm2 = codelen;
return hfa384x_docmd_wait(hw, &cmd); return hfa384x_docmd(hw, &cmd);
} }
/*---------------------------------------------------------------- /*----------------------------------------------------------------
...@@ -1213,13 +1205,8 @@ static int hfa384x_usbctlx_complete_sync(struct hfa384x *hw, ...@@ -1213,13 +1205,8 @@ static int hfa384x_usbctlx_complete_sync(struct hfa384x *hw,
* *
* Arguments: * Arguments:
* hw device structure * hw device structure
* mode DOWAIT or DOASYNC
* cmd cmd structure. Includes all arguments and result * cmd cmd structure. Includes all arguments and result
* data points. All in host order. in host order * data points. All in host order. in host order
* cmdcb command-specific callback
* usercb user callback for async calls, NULL for DOWAIT calls
* usercb_data user supplied data pointer for async calls, NULL
* for DOWAIT calls
* *
* Returns: * Returns:
* 0 success * 0 success
...@@ -1235,11 +1222,9 @@ static int hfa384x_usbctlx_complete_sync(struct hfa384x *hw, ...@@ -1235,11 +1222,9 @@ static int hfa384x_usbctlx_complete_sync(struct hfa384x *hw,
* process * process
*---------------------------------------------------------------- *----------------------------------------------------------------
*/ */
static int static inline int
hfa384x_docmd(struct hfa384x *hw, hfa384x_docmd(struct hfa384x *hw,
enum cmd_mode mode, struct hfa384x_metacmd *cmd)
struct hfa384x_metacmd *cmd,
ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
{ {
int result; int result;
struct hfa384x_usbctlx *ctlx; struct hfa384x_usbctlx *ctlx;
...@@ -1262,15 +1247,15 @@ hfa384x_docmd(struct hfa384x *hw, ...@@ -1262,15 +1247,15 @@ hfa384x_docmd(struct hfa384x *hw,
pr_debug("cmdreq: cmd=0x%04x parm0=0x%04x parm1=0x%04x parm2=0x%04x\n", pr_debug("cmdreq: cmd=0x%04x parm0=0x%04x parm1=0x%04x parm2=0x%04x\n",
cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2); cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2);
ctlx->reapable = mode; ctlx->reapable = DOWAIT;
ctlx->cmdcb = cmdcb; ctlx->cmdcb = NULL;
ctlx->usercb = usercb; ctlx->usercb = NULL;
ctlx->usercb_data = usercb_data; ctlx->usercb_data = NULL;
result = hfa384x_usbctlx_submit(hw, ctlx); result = hfa384x_usbctlx_submit(hw, ctlx);
if (result != 0) { if (result != 0) {
kfree(ctlx); kfree(ctlx);
} else if (mode == DOWAIT) { } else {
struct usbctlx_cmd_completor cmd_completor; struct usbctlx_cmd_completor cmd_completor;
struct usbctlx_completor *completor; struct usbctlx_completor *completor;
......
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