aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorNicholas Mc Guire <der.herr@hofr.at>2015-01-20 00:27:45 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-25 12:18:00 -0500
commit3f46d81ae1cf8f20f25c39ae1ab3f1b064698361 (patch)
treeba5612fecded10c5aad55c738fd1d307493fd849 /drivers/misc
parent625505b509b38b3a389cb3f4fd6520a46763bf45 (diff)
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: Nicholas Mc Guire <der.herr@hofr.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/ti-st/st_kim.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 7109d28518d3..8fb116f8a152 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -219,6 +219,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
219{ 219{
220 unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0; 220 unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0;
221 const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 }; 221 const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 };
222 long timeout;
222 223
223 pr_debug("%s", __func__); 224 pr_debug("%s", __func__);
224 225
@@ -228,10 +229,11 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
228 return -EIO; 229 return -EIO;
229 } 230 }
230 231
231 if (!wait_for_completion_interruptible_timeout( 232 timeout = wait_for_completion_interruptible_timeout(
232 &kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) { 233 &kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME));
233 pr_err(" waiting for ver info- timed out "); 234 if (timeout <= 0) {
234 return -ETIMEDOUT; 235 pr_err(" waiting for ver info- timed out or received signal");
236 return timeout ? -ERESTARTSYS : -ETIMEDOUT;
235 } 237 }
236 reinit_completion(&kim_gdata->kim_rcvd); 238 reinit_completion(&kim_gdata->kim_rcvd);
237 /* the positions 12 & 13 in the response buffer provide with the 239 /* 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 break; 397 break;
396 case ACTION_WAIT_EVENT: /* wait */ 398 case ACTION_WAIT_EVENT: /* wait */
397 pr_debug("W"); 399 pr_debug("W");
398 if (!wait_for_completion_interruptible_timeout( 400 err = wait_for_completion_interruptible_timeout(
399 &kim_gdata->kim_rcvd, 401 &kim_gdata->kim_rcvd,
400 msecs_to_jiffies(CMD_RESP_TIME))) { 402 msecs_to_jiffies(CMD_RESP_TIME));
401 pr_err("response timeout during fw download "); 403 if (err <= 0) {
404 pr_err("response timeout/signaled during fw download ");
402 /* timed out */ 405 /* timed out */
403 release_firmware(kim_gdata->fw_entry); 406 release_firmware(kim_gdata->fw_entry);
404 return -ETIMEDOUT; 407 return err ? -ERESTARTSYS : -ETIMEDOUT;
405 } 408 }
406 reinit_completion(&kim_gdata->kim_rcvd); 409 reinit_completion(&kim_gdata->kim_rcvd);
407 break; 410 break;