Commit 28c03f82 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman

staging: wlan-ng: Replace function hfa384x_dormem()

Remove parameters mode, cmdcb, usercb, and usercb_data from
hfa384x_dormem as these parameters are only assigned the same constant
values (DOWAIT, NULL, NULL, NULL respectively).
Modify hfa384x_dormem to use these constants directly. Remove check for
value of mode (as it will always be DOWAIT).
Remove function hfa384x_dormem_wait as it does nothing except call
hfa384x_dormem with these extra arguments.
Modify call sites of hfa384x_dormem_wait to call hfa384x_dormem instead.
Issue found with Coccinelle.
Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190712062807.9361-9-nishkadg.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 53055d6a
...@@ -248,12 +248,10 @@ hfa384x_dowrid(struct hfa384x *hw, ...@@ -248,12 +248,10 @@ hfa384x_dowrid(struct hfa384x *hw,
static int static int
hfa384x_dormem(struct hfa384x *hw, hfa384x_dormem(struct hfa384x *hw,
enum cmd_mode mode,
u16 page, u16 page,
u16 offset, u16 offset,
void *data, void *data,
unsigned int len, unsigned int len);
ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
static int static int
hfa384x_dowmem(struct hfa384x *hw, hfa384x_dowmem(struct hfa384x *hw,
...@@ -818,14 +816,6 @@ static void hfa384x_cb_status(struct hfa384x *hw, ...@@ -818,14 +816,6 @@ static void hfa384x_cb_status(struct hfa384x *hw,
} }
} }
static inline int
hfa384x_dormem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len)
{
return hfa384x_dormem(hw, DOWAIT,
page, offset, data, len, NULL, NULL, NULL);
}
static inline int static inline int
hfa384x_dowmem_wait(struct hfa384x *hw, hfa384x_dowmem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len) u16 page, u16 offset, void *data, unsigned int len)
...@@ -1454,14 +1444,10 @@ hfa384x_dowrid(struct hfa384x *hw, ...@@ -1454,14 +1444,10 @@ hfa384x_dowrid(struct hfa384x *hw,
* *
* Arguments: * Arguments:
* hw device structure * hw device structure
* mode DOWAIT or DOASYNC
* page MAC address space page (CMD format) * page MAC address space page (CMD format)
* offset MAC address space offset * offset MAC address space offset
* data Ptr to data buffer to receive read * data Ptr to data buffer to receive read
* len Length of the data to read (max == 2048) * len Length of the data to read (max == 2048)
* cmdcb command callback for async calls, NULL for DOWAIT calls
* usercb user callback for async calls, NULL for DOWAIT calls
* usercb_data user supplied data pointer for async calls
* *
* Returns: * Returns:
* 0 success * 0 success
...@@ -1473,18 +1459,15 @@ hfa384x_dowrid(struct hfa384x *hw, ...@@ -1473,18 +1459,15 @@ hfa384x_dowrid(struct hfa384x *hw,
* Side effects: * Side effects:
* *
* Call context: * Call context:
* interrupt (DOASYNC) * process (DOWAIT)
* process (DOWAIT or DOASYNC)
*---------------------------------------------------------------- *----------------------------------------------------------------
*/ */
static int static int
hfa384x_dormem(struct hfa384x *hw, hfa384x_dormem(struct hfa384x *hw,
enum cmd_mode mode,
u16 page, u16 page,
u16 offset, u16 offset,
void *data, void *data,
unsigned int len, unsigned int len)
ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
{ {
int result; int result;
struct hfa384x_usbctlx *ctlx; struct hfa384x_usbctlx *ctlx;
...@@ -1512,15 +1495,15 @@ hfa384x_dormem(struct hfa384x *hw, ...@@ -1512,15 +1495,15 @@ hfa384x_dormem(struct hfa384x *hw,
pr_debug("pktsize=%zd\n", ROUNDUP64(sizeof(ctlx->outbuf.rmemreq))); pr_debug("pktsize=%zd\n", ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)));
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_rmem_completor completor; struct usbctlx_rmem_completor completor;
result = result =
...@@ -2252,8 +2235,8 @@ int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len) ...@@ -2252,8 +2235,8 @@ int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len)
curroffset = HFA384x_ADDR_CMD_MKOFF(pdaloc[i].cardaddr); curroffset = HFA384x_ADDR_CMD_MKOFF(pdaloc[i].cardaddr);
/* units of bytes */ /* units of bytes */
result = hfa384x_dormem_wait(hw, currpage, curroffset, buf, result = hfa384x_dormem(hw, currpage, curroffset, buf,
len); len);
if (result) { if (result) {
netdev_warn(hw->wlandev->netdev, netdev_warn(hw->wlandev->netdev,
......
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