Commit 46233f77 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Kalle Valo

orinoco: Annotate ezusb_init()

ezusb_init() is always invoked in preemptible context during device
probe. Only orinoco_up() -> orinoco_reinit_firmware() may invoke the
function from atomic context but this is never used for the USB
interface.

Use ezusb_req_ctx_wait_compl() for the ezusb_write_ltv() and
ezusb_docmd_wait() invocations from within ezusb_init().
Preserve the generic versions which have still other user via the
callback.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201113212252.2243570-5-bigeasy@linutronix.de
parent 29b2fe3f
...@@ -994,8 +994,9 @@ static int ezusb_access_ltv(struct ezusb_priv *upriv, ...@@ -994,8 +994,9 @@ static int ezusb_access_ltv(struct ezusb_priv *upriv,
return retval; return retval;
} }
static int ezusb_write_ltv(struct hermes *hw, int bap, u16 rid, static int __ezusb_write_ltv(struct hermes *hw, int bap, u16 rid,
u16 length, const void *data) u16 length, const void *data,
ezusb_ctx_wait ezusb_ctx_wait_func)
{ {
struct ezusb_priv *upriv = hw->priv; struct ezusb_priv *upriv = hw->priv;
u16 frame_type; u16 frame_type;
...@@ -1021,7 +1022,14 @@ static int ezusb_write_ltv(struct hermes *hw, int bap, u16 rid, ...@@ -1021,7 +1022,14 @@ static int ezusb_write_ltv(struct hermes *hw, int bap, u16 rid,
frame_type = EZUSB_FRAME_CONTROL; frame_type = EZUSB_FRAME_CONTROL;
return ezusb_access_ltv(upriv, ctx, length, data, frame_type, return ezusb_access_ltv(upriv, ctx, length, data, frame_type,
NULL, 0, NULL, ezusb_req_ctx_wait); NULL, 0, NULL, ezusb_ctx_wait_func);
}
static int ezusb_write_ltv(struct hermes *hw, int bap, u16 rid,
u16 length, const void *data)
{
return __ezusb_write_ltv(hw, bap, rid, length, data,
ezusb_req_ctx_wait);
} }
static int ezusb_read_ltv(struct hermes *hw, int bap, u16 rid, static int ezusb_read_ltv(struct hermes *hw, int bap, u16 rid,
...@@ -1065,8 +1073,9 @@ static int ezusb_doicmd_wait(struct hermes *hw, u16 cmd, u16 parm0, u16 parm1, ...@@ -1065,8 +1073,9 @@ static int ezusb_doicmd_wait(struct hermes *hw, u16 cmd, u16 parm0, u16 parm1,
ezusb_req_ctx_wait); ezusb_req_ctx_wait);
} }
static int ezusb_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0, static int __ezusb_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0,
struct hermes_response *resp) struct hermes_response *resp,
ezusb_ctx_wait ezusb_ctx_wait_func)
{ {
struct ezusb_priv *upriv = hw->priv; struct ezusb_priv *upriv = hw->priv;
struct request_context *ctx; struct request_context *ctx;
...@@ -1084,7 +1093,13 @@ static int ezusb_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0, ...@@ -1084,7 +1093,13 @@ static int ezusb_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0,
return ezusb_access_ltv(upriv, ctx, sizeof(data), &data, return ezusb_access_ltv(upriv, ctx, sizeof(data), &data,
EZUSB_FRAME_CONTROL, NULL, 0, NULL, EZUSB_FRAME_CONTROL, NULL, 0, NULL,
ezusb_req_ctx_wait); ezusb_ctx_wait_func);
}
static int ezusb_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0,
struct hermes_response *resp)
{
return __ezusb_docmd_wait(hw, cmd, parm0, resp, ezusb_req_ctx_wait);
} }
static int ezusb_bap_pread(struct hermes *hw, int bap, static int ezusb_bap_pread(struct hermes *hw, int bap,
...@@ -1416,14 +1431,16 @@ static int ezusb_init(struct hermes *hw) ...@@ -1416,14 +1431,16 @@ static int ezusb_init(struct hermes *hw)
usb_kill_urb(upriv->read_urb); usb_kill_urb(upriv->read_urb);
ezusb_submit_in_urb(upriv); ezusb_submit_in_urb(upriv);
retval = ezusb_write_ltv(hw, 0, EZUSB_RID_INIT1, retval = __ezusb_write_ltv(hw, 0, EZUSB_RID_INIT1,
HERMES_BYTES_TO_RECLEN(2), "\x10\x00"); HERMES_BYTES_TO_RECLEN(2), "\x10\x00",
ezusb_req_ctx_wait_compl);
if (retval < 0) { if (retval < 0) {
printk(KERN_ERR PFX "EZUSB_RID_INIT1 error %d\n", retval); printk(KERN_ERR PFX "EZUSB_RID_INIT1 error %d\n", retval);
return retval; return retval;
} }
retval = ezusb_docmd_wait(hw, HERMES_CMD_INIT, 0, NULL); retval = __ezusb_docmd_wait(hw, HERMES_CMD_INIT, 0, NULL,
ezusb_req_ctx_wait_compl);
if (retval < 0) { if (retval < 0) {
printk(KERN_ERR PFX "HERMES_CMD_INIT error %d\n", retval); printk(KERN_ERR PFX "HERMES_CMD_INIT error %d\n", retval);
return retval; return retval;
......
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