[RAMEN9610-14499][common][9610] wlbt: fix completion and use completion_done API
authorYoungsoo <youngss.kim@samsung.com>
Thu, 18 Apr 2019 04:50:23 +0000 (13:50 +0900)
committerhskang <hs1218.kang@samsung.com>
Mon, 22 Apr 2019 04:35:21 +0000 (13:35 +0900)
When we get rapid requests for SABLE generation, to serialise while processing current request,
we ignore requests other than "fw_panic" in wlbtd and send a msg "ignoring" back to kernel.
We must complete in this case as well.

We must complete one completion upon message from wlbtdi, which has
waiter(s). completion_done() API does the check without modifying
the completion in anyway and returns false if there are waiters and
true otherwise

SCSC-Bug-Id: ssb-51156
previous patch :
-Change-Id: Ieabcd8377a3040bdcfe51e4310eb55d84c693446
-Signed-off-by: Purnendu Kapadia <p.kapadia@samsung.com>

Change-Id: Id6ff01e96b2e1e3de7f940c9e2ef1a75211ae5dd
Signed-off-by: Youngsoo <youngss.kim@samsung.com>
drivers/misc/samsung/scsc/scsc_wlbtd.c

index 75e50e896ce6ac811e1d6c32272ffdc3eaf3c642..1c7fdcfb67b87ebcf9927ec2ca6a22b3b55e50f2 100755 (executable)
@@ -40,8 +40,7 @@ static int msg_from_wlbtd_cb(struct sk_buff *skb, struct genl_info *info)
                        SCSC_TAG_ERR(WLBTD, "ATTR_INT: %u\n", status);
        }
 
-       if (!completion_done(&event_done))
-               complete(&event_done);
+       complete(&event_done);
 
        return 0;
 }
@@ -86,14 +85,24 @@ static int msg_from_wlbtd_sable_cb(struct sk_buff *skb, struct genl_info *info)
         *    ---> complete the completion with waiter(s)
         */
 
-       if (!completion_done(&fw_panic_done)) {
-               SCSC_TAG_INFO(WLBTD, "completing fw_panic_done\n");
-               complete(&fw_panic_done);
-       }
-
-       if (!completion_done(&event_done)) {
-               SCSC_TAG_INFO(WLBTD, "completing event_done\n");
-               complete(&event_done);
+       if ((strstr(data, "scsc_log_fw_panic") != NULL) ||
+                       (strstr(data, "not found.") != NULL) ||
+                       (strstr(data, "failed"))) {
+               if (!completion_done(&fw_panic_done)) {
+                       SCSC_TAG_INFO(WLBTD, "completing fw_panic_done\n");
+                       complete(&fw_panic_done);
+                       return 0;
+               }
+       }
+
+       if ((strstr(data, ".sbl") != NULL) ||
+                       (strstr(data, "ignoring") != NULL) ||
+                       (strstr(data, "not found.") != NULL) ||
+                       (strstr(data, "failed"))) {
+               if (!completion_done(&event_done)) {
+                       SCSC_TAG_INFO(WLBTD, "completing event_done\n");
+                       complete(&event_done);
+               }
        }
 
        return 0;