Skip to content

Commit 2f81a02

Browse files
Pavan Savoygregkh
authored andcommitted
drivers:misc: ti-st: reinit completion before send
download firmware behaves differently at different times, when logs are enabled and the system is loaded, the wait_for_completion is able to wait for every send, However during other times the wait does not happen. So, for reliability reinitializing the completion before every send, makes sure the wait happens for every send. Signed-off-by: Pavan Savoy <pavan_savoy@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 78bb969 commit 2f81a02

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎drivers/misc/ti-st/st_kim.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
299299

300300
switch (((struct bts_action *)ptr)->type) {
301301
case ACTION_SEND_COMMAND: /* action send */
302+
pr_debug("S");
302303
action_ptr = &(((struct bts_action *)ptr)->data[0]);
303304
if (unlikely
304305
(((struct hci_command *)action_ptr)->opcode ==
@@ -336,6 +337,10 @@ static long download_firmware(struct kim_data_s *kim_gdata)
336337
release_firmware(kim_gdata->fw_entry);
337338
return -ETIMEDOUT;
338339
}
340+
/* reinit completion before sending for the
341+
* relevant wait
342+
*/
343+
INIT_COMPLETION(kim_gdata->kim_rcvd);
339344

340345
/*
341346
* Free space found in uart buffer, call st_int_write
@@ -362,6 +367,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
362367
}
363368
break;
364369
case ACTION_WAIT_EVENT: /* wait */
370+
pr_debug("W");
365371
if (!wait_for_completion_timeout
366372
(&kim_gdata->kim_rcvd,
367373
msecs_to_jiffies(CMD_RESP_TIME))) {

0 commit comments

Comments
 (0)