* [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait()
@ 2019-07-12 6:27 Nishka Dasgupta
2019-07-12 6:27 ` [PATCH 02/10] staging: wlan-ng: Remove function hfa384x_dowrid_wait() Nishka Dasgupta
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:27 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove function hfa384x_dorrid_wait as it is only called once and it
does nothing except call hfa384x_dorrid.
Move contents of hfa384x_dorrid_wait to its only call site to maintain
functionality.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index ab734534093b..4befc615d8e2 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -834,14 +834,6 @@ hfa384x_docmd_async(struct hfa384x *hw,
return hfa384x_docmd(hw, DOASYNC, cmd, cmdcb, usercb, usercb_data);
}
-static inline int
-hfa384x_dorrid_wait(struct hfa384x *hw, u16 rid, void *riddata,
- unsigned int riddatalen)
-{
- return hfa384x_dorrid(hw, DOWAIT,
- rid, riddata, riddatalen, NULL, NULL, NULL);
-}
-
static inline int
hfa384x_dorrid_async(struct hfa384x *hw,
u16 rid, void *riddata, unsigned int riddatalen,
@@ -2061,7 +2053,7 @@ int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr,
*/
int hfa384x_drvr_getconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len)
{
- return hfa384x_dorrid_wait(hw, rid, buf, len);
+ return hfa384x_dorrid(hw, DOWAIT, rid, buf, len, NULL, NULL, NULL);
}
/*----------------------------------------------------------------
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 02/10] staging: wlan-ng: Remove function hfa384x_dowrid_wait()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
@ 2019-07-12 6:27 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 03/10] staging: wlan-ng: Remove function hfa384x_dowrid_async() Nishka Dasgupta
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:27 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove inline function hfa384x_dowrid_wait as it is only called once (in
hfa384x_drvr_setconfig) and its contents are only a single line (a call
to hfa384x_dowrid).
Replace the call to hfa384x_dowrid_wait with its contents i.e the call
to hfa384x_dowrid.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 4befc615d8e2..dc6abc654165 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -845,14 +845,6 @@ hfa384x_dorrid_async(struct hfa384x *hw,
cmdcb, usercb, usercb_data);
}
-static inline int
-hfa384x_dowrid_wait(struct hfa384x *hw, u16 rid, void *riddata,
- unsigned int riddatalen)
-{
- return hfa384x_dowrid(hw, DOWAIT,
- rid, riddata, riddatalen, NULL, NULL, NULL);
-}
-
static inline int
hfa384x_dowrid_async(struct hfa384x *hw,
u16 rid, void *riddata, unsigned int riddatalen,
@@ -2414,7 +2406,7 @@ int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len)
*/
int hfa384x_drvr_setconfig(struct hfa384x *hw, u16 rid, void *buf, u16 len)
{
- return hfa384x_dowrid_wait(hw, rid, buf, len);
+ return hfa384x_dowrid(hw, DOWAIT, rid, buf, len, NULL, NULL, NULL);
}
/*----------------------------------------------------------------
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 03/10] staging: wlan-ng: Remove function hfa384x_dowrid_async()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
2019-07-12 6:27 ` [PATCH 02/10] staging: wlan-ng: Remove function hfa384x_dowrid_wait() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 04/10] staging: wlan-ng: Remove unused function hfa384x_dorrid_async() Nishka Dasgupta
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove function hfa384x_dowrid_async as it does nothing except call
hfa384x_dowrid, and itself is called only once.
Move the contents of hfa384x_dowrid_async (i.e the call to
hfa384x_dowrid) to its call site.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index dc6abc654165..732ffb6aab0b 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -845,17 +845,6 @@ hfa384x_dorrid_async(struct hfa384x *hw,
cmdcb, usercb, usercb_data);
}
-static inline int
-hfa384x_dowrid_async(struct hfa384x *hw,
- u16 rid, void *riddata, unsigned int riddatalen,
- ctlx_cmdcb_t cmdcb,
- ctlx_usercb_t usercb, void *usercb_data)
-{
- return hfa384x_dowrid(hw, DOASYNC,
- rid, riddata, riddatalen,
- cmdcb, usercb, usercb_data);
-}
-
static inline int
hfa384x_dormem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len)
@@ -2078,8 +2067,8 @@ hfa384x_drvr_setconfig_async(struct hfa384x *hw,
void *buf,
u16 len, ctlx_usercb_t usercb, void *usercb_data)
{
- return hfa384x_dowrid_async(hw, rid, buf, len,
- hfa384x_cb_status, usercb, usercb_data);
+ return hfa384x_dowrid(hw, DOASYNC, rid, buf, len, hfa384x_cb_status,
+ usercb, usercb_data);
}
/*----------------------------------------------------------------
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 04/10] staging: wlan-ng: Remove unused function hfa384x_dorrid_async()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
2019-07-12 6:27 ` [PATCH 02/10] staging: wlan-ng: Remove function hfa384x_dowrid_wait() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 03/10] staging: wlan-ng: Remove function hfa384x_dowrid_async() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 05/10] staging: wlan-ng: Remove unused function hfa384x_dormem_async() Nishka Dasgupta
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove unused function hfa384x_dorrid_async.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 732ffb6aab0b..c1a315bf5a81 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -834,17 +834,6 @@ hfa384x_docmd_async(struct hfa384x *hw,
return hfa384x_docmd(hw, DOASYNC, cmd, cmdcb, usercb, usercb_data);
}
-static inline int
-hfa384x_dorrid_async(struct hfa384x *hw,
- u16 rid, void *riddata, unsigned int riddatalen,
- ctlx_cmdcb_t cmdcb,
- ctlx_usercb_t usercb, void *usercb_data)
-{
- return hfa384x_dorrid(hw, DOASYNC,
- rid, riddata, riddatalen,
- cmdcb, usercb, usercb_data);
-}
-
static inline int
hfa384x_dormem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len)
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 05/10] staging: wlan-ng: Remove unused function hfa384x_dormem_async()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
` (2 preceding siblings ...)
2019-07-12 6:28 ` [PATCH 04/10] staging: wlan-ng: Remove unused function hfa384x_dorrid_async() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 06/10] staging: wlan-ng: Remove function hfa384x_dowmem_async() Nishka Dasgupta
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove unused function hfa384x_dormem_async.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index c1a315bf5a81..95dae0b271fc 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -842,17 +842,6 @@ hfa384x_dormem_wait(struct hfa384x *hw,
page, offset, data, len, NULL, NULL, NULL);
}
-static inline int
-hfa384x_dormem_async(struct hfa384x *hw,
- u16 page, u16 offset, void *data, unsigned int len,
- ctlx_cmdcb_t cmdcb,
- ctlx_usercb_t usercb, void *usercb_data)
-{
- return hfa384x_dormem(hw, DOASYNC,
- page, offset, data, len,
- cmdcb, usercb, usercb_data);
-}
-
static inline int
hfa384x_dowmem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len)
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 06/10] staging: wlan-ng: Remove function hfa384x_dowmem_async()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
` (3 preceding siblings ...)
2019-07-12 6:28 ` [PATCH 05/10] staging: wlan-ng: Remove unused function hfa384x_dormem_async() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 07/10] staging: wlan-ng: Remove unused function hfa384x_docmd_async() Nishka Dasgupta
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove unused function hfa384x_dowmem_async.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 95dae0b271fc..20ac2dbd8a00 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -850,20 +850,6 @@ hfa384x_dowmem_wait(struct hfa384x *hw,
page, offset, data, len, NULL, NULL, NULL);
}
-static inline int
-hfa384x_dowmem_async(struct hfa384x *hw,
- u16 page,
- u16 offset,
- void *data,
- unsigned int len,
- ctlx_cmdcb_t cmdcb,
- ctlx_usercb_t usercb, void *usercb_data)
-{
- return hfa384x_dowmem(hw, DOASYNC,
- page, offset, data, len,
- cmdcb, usercb, usercb_data);
-}
-
/*----------------------------------------------------------------
* hfa384x_cmd_initialize
*
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 07/10] staging: wlan-ng: Remove unused function hfa384x_docmd_async()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
` (4 preceding siblings ...)
2019-07-12 6:28 ` [PATCH 06/10] staging: wlan-ng: Remove function hfa384x_dowmem_async() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 08/10] staging: wlan-ng: Remove function hfa384x_docmd_wait() Nishka Dasgupta
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove unused function hfa384x_docmd_async.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 20ac2dbd8a00..ce1a9ee995a0 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -826,14 +826,6 @@ static inline int hfa384x_docmd_wait(struct hfa384x *hw,
return hfa384x_docmd(hw, DOWAIT, cmd, NULL, NULL, NULL);
}
-static inline int
-hfa384x_docmd_async(struct hfa384x *hw,
- struct hfa384x_metacmd *cmd,
- ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
-{
- return hfa384x_docmd(hw, DOASYNC, cmd, cmdcb, usercb, usercb_data);
-}
-
static inline int
hfa384x_dormem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len)
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 08/10] staging: wlan-ng: Remove function hfa384x_docmd_wait()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
` (5 preceding siblings ...)
2019-07-12 6:28 ` [PATCH 07/10] staging: wlan-ng: Remove unused function hfa384x_docmd_async() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 09/10] staging: wlan-ng: Replace function hfa384x_dormem() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 10/10] staging: wlan-ng: Replace function hfa384x_dowmem() Nishka Dasgupta
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
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: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 43 +++++++++------------------
1 file changed, 14 insertions(+), 29 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index ce1a9ee995a0..c469b89948e6 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -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 @@ static int hfa384x_usbctlx_complete_sync(struct hfa384x *hw,
*
* 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 @@ static int hfa384x_usbctlx_complete_sync(struct hfa384x *hw,
* 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;
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 09/10] staging: wlan-ng: Replace function hfa384x_dormem()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
` (6 preceding siblings ...)
2019-07-12 6:28 ` [PATCH 08/10] staging: wlan-ng: Remove function hfa384x_docmd_wait() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 10/10] staging: wlan-ng: Replace function hfa384x_dowmem() Nishka Dasgupta
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
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: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 37 ++++++++-------------------
1 file changed, 10 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index c469b89948e6..9be06a33268c 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -248,12 +248,10 @@ hfa384x_dowrid(struct hfa384x *hw,
static int
hfa384x_dormem(struct hfa384x *hw,
- enum cmd_mode mode,
u16 page,
u16 offset,
void *data,
- unsigned int len,
- ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
+ unsigned int len);
static int
hfa384x_dowmem(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
hfa384x_dowmem_wait(struct hfa384x *hw,
u16 page, u16 offset, void *data, unsigned int len)
@@ -1454,14 +1444,10 @@ hfa384x_dowrid(struct hfa384x *hw,
*
* Arguments:
* hw device structure
- * mode DOWAIT or DOASYNC
* page MAC address space page (CMD format)
* offset MAC address space offset
* data Ptr to data buffer to receive read
* 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:
* 0 success
@@ -1473,18 +1459,15 @@ hfa384x_dowrid(struct hfa384x *hw,
* Side effects:
*
* Call context:
- * interrupt (DOASYNC)
- * process (DOWAIT or DOASYNC)
+ * process (DOWAIT)
*----------------------------------------------------------------
*/
static int
hfa384x_dormem(struct hfa384x *hw,
- enum cmd_mode mode,
u16 page,
u16 offset,
void *data,
- unsigned int len,
- ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
+ unsigned int len)
{
int result;
struct hfa384x_usbctlx *ctlx;
@@ -1512,15 +1495,15 @@ hfa384x_dormem(struct hfa384x *hw,
pr_debug("pktsize=%zd\n", ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)));
- 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_rmem_completor completor;
result =
@@ -2252,8 +2235,8 @@ int hfa384x_drvr_readpda(struct hfa384x *hw, void *buf, unsigned int len)
curroffset = HFA384x_ADDR_CMD_MKOFF(pdaloc[i].cardaddr);
/* units of bytes */
- result = hfa384x_dormem_wait(hw, currpage, curroffset, buf,
- len);
+ result = hfa384x_dormem(hw, currpage, curroffset, buf,
+ len);
if (result) {
netdev_warn(hw->wlandev->netdev,
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 10/10] staging: wlan-ng: Replace function hfa384x_dowmem()
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
` (7 preceding siblings ...)
2019-07-12 6:28 ` [PATCH 09/10] staging: wlan-ng: Replace function hfa384x_dormem() Nishka Dasgupta
@ 2019-07-12 6:28 ` Nishka Dasgupta
8 siblings, 0 replies; 10+ messages in thread
From: Nishka Dasgupta @ 2019-07-12 6:28 UTC (permalink / raw)
To: gregkh, devel; +Cc: Nishka Dasgupta
Remove parameters mode, cmdcb, usercb, and usercb_data from
hfa384x_dowmem as these parameters are only assigned the same constant
values (DOWAIT, NULL, NULL, NULL respectively).
Modify hfa384x_dowmem to use these constants directly. Remove check for
value of mode (as it will always be DOWAIT).
Remove function hfa384x_dowmem_wait as it does nothing except call
hfa384x_dowmem with these extra arguments.
Modify call sites of hfa384x_dowmem_wait to call hfa384x_dowmem instead.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 51 +++++++++------------------
1 file changed, 17 insertions(+), 34 deletions(-)
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 9be06a33268c..28d372a0663a 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -255,12 +255,10 @@ hfa384x_dormem(struct hfa384x *hw,
static int
hfa384x_dowmem(struct hfa384x *hw,
- enum cmd_mode mode,
u16 page,
u16 offset,
void *data,
- unsigned int len,
- ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
+ unsigned int len);
static int hfa384x_isgood_pdrcode(u16 pdrcode);
@@ -816,14 +814,6 @@ static void hfa384x_cb_status(struct hfa384x *hw,
}
}
-static inline int
-hfa384x_dowmem_wait(struct hfa384x *hw,
- u16 page, u16 offset, void *data, unsigned int len)
-{
- return hfa384x_dowmem(hw, DOWAIT,
- page, offset, data, len, NULL, NULL, NULL);
-}
-
/*----------------------------------------------------------------
* hfa384x_cmd_initialize
*
@@ -1529,14 +1519,10 @@ hfa384x_dormem(struct hfa384x *hw,
*
* Arguments:
* hw device structure
- * mode DOWAIT or DOASYNC
* page MAC address space page (CMD format)
* offset MAC address space offset
* data Ptr to data buffer containing write data
* 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:
* 0 success
@@ -1549,17 +1535,15 @@ hfa384x_dormem(struct hfa384x *hw,
*
* Call context:
* interrupt (DOWAIT)
- * process (DOWAIT or DOASYNC)
+ * process (DOWAIT)
*----------------------------------------------------------------
*/
static int
hfa384x_dowmem(struct hfa384x *hw,
- enum cmd_mode mode,
u16 page,
u16 offset,
void *data,
- unsigned int len,
- ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
+ unsigned int len)
{
int result;
struct hfa384x_usbctlx *ctlx;
@@ -1586,15 +1570,15 @@ hfa384x_dowmem(struct hfa384x *hw,
sizeof(ctlx->outbuf.wmemreq.offset) +
sizeof(ctlx->outbuf.wmemreq.page) + len;
- 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 completor;
struct hfa384x_cmdresult wmemresult;
@@ -1901,10 +1885,10 @@ int hfa384x_drvr_flashdl_write(struct hfa384x *hw, u32 daddr,
writelen = writelen > HFA384x_USB_RWMEM_MAXLEN ?
HFA384x_USB_RWMEM_MAXLEN : writelen;
- result = hfa384x_dowmem_wait(hw,
- writepage,
- writeoffset,
- writebuf, writelen);
+ result = hfa384x_dowmem(hw,
+ writepage,
+ writeoffset,
+ writebuf, writelen);
}
/* set the download 'write flash' mode */
@@ -2158,12 +2142,11 @@ int hfa384x_drvr_ramdl_write(struct hfa384x *hw, u32 daddr, void *buf, u32 len)
currlen = HFA384x_USB_RWMEM_MAXLEN;
/* Do blocking ctlx */
- result = hfa384x_dowmem_wait(hw,
- currpage,
- curroffset,
- data +
- (i * HFA384x_USB_RWMEM_MAXLEN),
- currlen);
+ result = hfa384x_dowmem(hw,
+ currpage,
+ curroffset,
+ data + (i * HFA384x_USB_RWMEM_MAXLEN),
+ currlen);
if (result)
break;
--
2.19.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-07-12 6:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 6:27 [PATCH 01/10] staging: wlan-ng: Remove function hfa384x_dorrid_wait() Nishka Dasgupta
2019-07-12 6:27 ` [PATCH 02/10] staging: wlan-ng: Remove function hfa384x_dowrid_wait() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 03/10] staging: wlan-ng: Remove function hfa384x_dowrid_async() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 04/10] staging: wlan-ng: Remove unused function hfa384x_dorrid_async() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 05/10] staging: wlan-ng: Remove unused function hfa384x_dormem_async() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 06/10] staging: wlan-ng: Remove function hfa384x_dowmem_async() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 07/10] staging: wlan-ng: Remove unused function hfa384x_docmd_async() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 08/10] staging: wlan-ng: Remove function hfa384x_docmd_wait() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 09/10] staging: wlan-ng: Replace function hfa384x_dormem() Nishka Dasgupta
2019-07-12 6:28 ` [PATCH 10/10] staging: wlan-ng: Replace function hfa384x_dowmem() Nishka Dasgupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).