aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ti-st/st_kim.c
diff options
context:
space:
mode:
authorPavan Savoy <pavan_savoy@ti.com>2011-02-04 03:23:11 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-04 15:41:20 -0500
commit704426649dd4324b34cefea322f4333e5280f852 (patch)
tree5f3b511437974e542e07bfc4a4e2558086be25c8 /drivers/misc/ti-st/st_kim.c
parentec60d0ad20ff8796dc41b30a9dce485478ccd263 (diff)
drivers:misc: ti-st: fix error codes
set-right the error codes that the shared transport driver returns. Instead of magic numbers like -1, return relevant codes such as ETIMEDOUT or EIO, EAGAIN when wait times out or uart write bytes don't match expected value or when registration fails and needs to be attempted again. Signed-off-by: Pavan Savoy <pavan_savoy@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/misc/ti-st/st_kim.c')
-rw-r--r--drivers/misc/ti-st/st_kim.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index a7fda8141758..ccc46a7b0abb 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -201,13 +201,13 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
201 INIT_COMPLETION(kim_gdata->kim_rcvd); 201 INIT_COMPLETION(kim_gdata->kim_rcvd);
202 if (4 != st_int_write(kim_gdata->core_data, read_ver_cmd, 4)) { 202 if (4 != st_int_write(kim_gdata->core_data, read_ver_cmd, 4)) {
203 pr_err("kim: couldn't write 4 bytes"); 203 pr_err("kim: couldn't write 4 bytes");
204 return -1; 204 return -EIO;
205 } 205 }
206 206
207 if (!wait_for_completion_timeout 207 if (!wait_for_completion_timeout
208 (&kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) { 208 (&kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) {
209 pr_err(" waiting for ver info- timed out "); 209 pr_err(" waiting for ver info- timed out ");
210 return -1; 210 return -ETIMEDOUT;
211 } 211 }
212 212
213 version = 213 version =
@@ -257,7 +257,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
257 (kim_gdata->fw_entry->size == 0))) { 257 (kim_gdata->fw_entry->size == 0))) {
258 pr_err(" request_firmware failed(errno %ld) for %s", err, 258 pr_err(" request_firmware failed(errno %ld) for %s", err,
259 bts_scr_name); 259 bts_scr_name);
260 return -1; 260 return -EINVAL;
261 } 261 }
262 ptr = (void *)kim_gdata->fw_entry->data; 262 ptr = (void *)kim_gdata->fw_entry->data;
263 len = kim_gdata->fw_entry->size; 263 len = kim_gdata->fw_entry->size;
@@ -292,7 +292,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
292 ((struct bts_action *)ptr)->size); 292 ((struct bts_action *)ptr)->size);
293 if (unlikely(err < 0)) { 293 if (unlikely(err < 0)) {
294 release_firmware(kim_gdata->fw_entry); 294 release_firmware(kim_gdata->fw_entry);
295 return -1; 295 return err;
296 } 296 }
297 if (!wait_for_completion_timeout 297 if (!wait_for_completion_timeout
298 (&kim_gdata->kim_rcvd, 298 (&kim_gdata->kim_rcvd,
@@ -301,7 +301,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
301 (" response timeout during fw download "); 301 (" response timeout during fw download ");
302 /* timed out */ 302 /* timed out */
303 release_firmware(kim_gdata->fw_entry); 303 release_firmware(kim_gdata->fw_entry);
304 return -1; 304 return -ETIMEDOUT;
305 } 305 }
306 break; 306 break;
307 case ACTION_DELAY: /* sleep */ 307 case ACTION_DELAY: /* sleep */
@@ -436,7 +436,7 @@ long st_kim_start(void *kim_data)
436 pr_info("ldisc_install = 0"); 436 pr_info("ldisc_install = 0");
437 sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, 437 sysfs_notify(&kim_gdata->kim_pdev->dev.kobj,
438 NULL, "install"); 438 NULL, "install");
439 err = -1; 439 err = -ETIMEDOUT;
440 continue; 440 continue;
441 } else { 441 } else {
442 /* ldisc installed now */ 442 /* ldisc installed now */
@@ -482,7 +482,7 @@ long st_kim_stop(void *kim_data)
482 msecs_to_jiffies(LDISC_TIME)); 482 msecs_to_jiffies(LDISC_TIME));
483 if (!err) { /* timeout */ 483 if (!err) { /* timeout */
484 pr_err(" timed out waiting for ldisc to be un-installed"); 484 pr_err(" timed out waiting for ldisc to be un-installed");
485 return -1; 485 return -ETIMEDOUT;
486 } 486 }
487 487
488 /* By default configure BT nShutdown to LOW state */ 488 /* By default configure BT nShutdown to LOW state */
@@ -642,7 +642,7 @@ static int kim_probe(struct platform_device *pdev)
642 status = st_core_init(&kim_gdata->core_data); 642 status = st_core_init(&kim_gdata->core_data);
643 if (status != 0) { 643 if (status != 0) {
644 pr_err(" ST core init failed"); 644 pr_err(" ST core init failed");
645 return -1; 645 return -EIO;
646 } 646 }
647 /* refer to itself */ 647 /* refer to itself */
648 kim_gdata->core_data->kim_data = kim_gdata; 648 kim_gdata->core_data->kim_data = kim_gdata;
@@ -704,7 +704,7 @@ static int kim_probe(struct platform_device *pdev)
704 if (IS_ERR(kim_debugfs_dir)) { 704 if (IS_ERR(kim_debugfs_dir)) {
705 pr_err(" debugfs entries creation failed "); 705 pr_err(" debugfs entries creation failed ");
706 kim_debugfs_dir = NULL; 706 kim_debugfs_dir = NULL;
707 return -1; 707 return -EIO;
708 } 708 }
709 709
710 debugfs_create_file("version", S_IRUGO, kim_debugfs_dir, 710 debugfs_create_file("version", S_IRUGO, kim_debugfs_dir,