summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lew <clew@codeaurora.org>2016-02-22 11:04:26 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-25 16:02:24 -0700
commit029eebcb5e040f9b4163b452acb9beaef1a5cfd7 (patch)
tree145ab584c38ab47b902bcc10bc5a4bbb9737d5d7
parent9dfa33b76beeaac05db08757ee62debaf4afc2c1 (diff)
diag: Close MD session when switching to USB Mode
Cannot switch from memory device logging to USB Mode after the first switch because the first MD state is stored. This fix resets the MD state by closing the session when switching to USB Mode from MD mode. Change-Id: I9addf0c7d8f1c058485349e196c1dcaa54b92f3a CRs-Fixed: 972027 Signed-off-by: Chris Lew <clew@codeaurora.org>
-rw-r--r--drivers/char/diag/diagchar_core.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/char/diag/diagchar_core.c b/drivers/char/diag/diagchar_core.c
index 27065a140fbf..d38a0f3fdaa2 100644
--- a/drivers/char/diag/diagchar_core.c
+++ b/drivers/char/diag/diagchar_core.c
@@ -1340,6 +1340,7 @@ static int diag_md_session_check(int curr_mode, int req_mode,
uint8_t *change_mode)
{
int err = 0;
+ struct diag_md_session_t *session_info = NULL;
if (!param || !change_mode)
return -EIO;
@@ -1404,8 +1405,10 @@ static int diag_md_session_check(int curr_mode, int req_mode,
"another instance running\n");
*change_mode = 0;
return -EINVAL;
- } else
- return 0;
+ }
+ session_info = diag_md_session_get_pid(current->tgid);
+ diag_md_session_close(session_info);
+ return 0;
}
if (param->mode_param == DIAG_MD_NORMAL) {