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

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.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aef29ca4
Loading
Loading
Loading
Loading
+14 −29
Original line number Diff line number Diff line
@@ -226,11 +226,9 @@ usbctlx_get_rridresult(const struct hfa384x_usb_rridresp *rridresp,

/*---------------------------------------------------*/
/* Low level req/resp CTLX formatters and submitters */
static int
static inline int
hfa384x_docmd(struct hfa384x *hw,
	      enum cmd_mode mode,
	      struct hfa384x_metacmd *cmd,
	      ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
	      struct hfa384x_metacmd *cmd);

static int
hfa384x_dorrid(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
hfa384x_dormem_wait(struct hfa384x *hw,
		    u16 page, u16 offset, void *data, unsigned int len)
@@ -873,7 +865,7 @@ int hfa384x_cmd_initialize(struct hfa384x *hw)
	cmd.parm1 = 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",
		 cmd.result.status,
@@ -919,7 +911,7 @@ int hfa384x_cmd_disable(struct hfa384x *hw, u16 macport)
	cmd.parm1 = 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)
	cmd.parm1 = 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)
	cmd.parm1 = 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,
	cmd.parm1 = highaddr;
	cmd.parm2 = codelen;

	return hfa384x_docmd_wait(hw, &cmd);
	return hfa384x_docmd(hw, &cmd);
}

/*----------------------------------------------------------------
@@ -1213,13 +1205,8 @@ cleanup:
 *
 * Arguments:
 *	hw		device structure
 *	mode		DOWAIT or DOASYNC
 *       cmd             cmd structure.  Includes all arguments and result
 *                       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:
 *	0		success
@@ -1235,11 +1222,9 @@ cleanup:
 *	process
 *----------------------------------------------------------------
 */
static int
static inline int
hfa384x_docmd(struct hfa384x *hw,
	      enum cmd_mode mode,
	      struct hfa384x_metacmd *cmd,
	      ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
	      struct hfa384x_metacmd *cmd)
{
	int result;
	struct hfa384x_usbctlx *ctlx;
@@ -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",
		 cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2);

	ctlx->reapable = mode;
	ctlx->cmdcb = cmdcb;
	ctlx->usercb = usercb;
	ctlx->usercb_data = usercb_data;
	ctlx->reapable = DOWAIT;
	ctlx->cmdcb = NULL;
	ctlx->usercb = NULL;
	ctlx->usercb_data = NULL;

	result = hfa384x_usbctlx_submit(hw, ctlx);
	if (result != 0) {
		kfree(ctlx);
	} else if (mode == DOWAIT) {
	} else {
		struct usbctlx_cmd_completor cmd_completor;
		struct usbctlx_completor *completor;