misc: ti-st: Send timeout error if ST registration fails
Shobek Sam Attupurath [Tue, 20 Aug 2013 15:17:33 +0000 (20:17 +0530)]
Send timeout error in case of ST registration failure so that
that ST retries.

Bug 1347583

Change-Id: Ie64d17203aa03e7efa126d243c01e9017008a7f3
Signed-off-by: Shobek Sam Attupurath <sattupurath@nvidia.com>
Reviewed-on: http://git-master/r/263940
(cherry picked from commit a3cbaaba6faef8abb2b45b5362f70f1ec9dc3136)
Reviewed-on: http://git-master/r/304677
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>

drivers/misc/ti-st/st_core.c

index 8d706bb..16ed016 100644 (file)
@@ -766,8 +766,13 @@ static void st_tty_close(struct tty_struct *tty)
         */
        spin_lock_irqsave(&st_gdata->lock, flags);
        for (i = ST_BT; i < ST_MAX_CHANNELS; i++) {
-               if (st_gdata->is_registered[i] == true)
+               if (st_gdata->is_registered[i] == true) {
                        pr_err("%d not un-registered", i);
+
+                       if (!test_bit(ST_REG_PENDING, &st_gdata->st_state)) {
+                               st_reg_complete(st_gdata, -ETIMEDOUT);
+                       }
+               }
                st_gdata->list[i] = NULL;
                st_gdata->is_registered[i] = false;
        }