Commit 3f46d81a authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Greg Kroah-Hartman

misc: ti-st: add handling of the signal case

if(!wait_for_completion_interruptible_timeout(...))
only handles the timeout case - this patch adds handling the
signal case the same as timeout.

Only the timeout case was being handled, the signal case
(-ERESTARTSYS) was treated just like the case of successful
completion, which is most likely not reasonable.

read_local_version() is called from download_firmware() where
it checks for !=0 return, so the error handling logic should be
preserved correctly.

download_firmware() is called from st_kim_start() which is
checking for !=0 return, so the error handling logic should be
preserved correctly
Signed-off-by: default avatarNicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 625505b5
...@@ -219,6 +219,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) ...@@ -219,6 +219,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
{ {
unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0; unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0;
const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 }; const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 };
long timeout;
pr_debug("%s", __func__); pr_debug("%s", __func__);
...@@ -228,10 +229,11 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) ...@@ -228,10 +229,11 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
return -EIO; return -EIO;
} }
if (!wait_for_completion_interruptible_timeout( timeout = wait_for_completion_interruptible_timeout(
&kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) { &kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME));
pr_err(" waiting for ver info- timed out "); if (timeout <= 0) {
return -ETIMEDOUT; pr_err(" waiting for ver info- timed out or received signal");
return timeout ? -ERESTARTSYS : -ETIMEDOUT;
} }
reinit_completion(&kim_gdata->kim_rcvd); reinit_completion(&kim_gdata->kim_rcvd);
/* the positions 12 & 13 in the response buffer provide with the /* the positions 12 & 13 in the response buffer provide with the
...@@ -395,13 +397,14 @@ static long download_firmware(struct kim_data_s *kim_gdata) ...@@ -395,13 +397,14 @@ static long download_firmware(struct kim_data_s *kim_gdata)
break; break;
case ACTION_WAIT_EVENT: /* wait */ case ACTION_WAIT_EVENT: /* wait */
pr_debug("W"); pr_debug("W");
if (!wait_for_completion_interruptible_timeout( err = wait_for_completion_interruptible_timeout(
&kim_gdata->kim_rcvd, &kim_gdata->kim_rcvd,
msecs_to_jiffies(CMD_RESP_TIME))) { msecs_to_jiffies(CMD_RESP_TIME));
pr_err("response timeout during fw download "); if (err <= 0) {
pr_err("response timeout/signaled during fw download ");
/* timed out */ /* timed out */
release_firmware(kim_gdata->fw_entry); release_firmware(kim_gdata->fw_entry);
return -ETIMEDOUT; return err ? -ERESTARTSYS : -ETIMEDOUT;
} }
reinit_completion(&kim_gdata->kim_rcvd); reinit_completion(&kim_gdata->kim_rcvd);
break; break;
......
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