linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hidp: Ensure the session is marked as terminating to enable other functions to abort early.
@ 2013-02-22 17:51 Karl Relton
  0 siblings, 0 replies; only message in thread
From: Karl Relton @ 2013-02-22 17:51 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: dh.herrmann, Marcel Holtmann, Gustavo Padovan, Johan Hedberg

From: Karl Relton <karllinuxtest.relton@ntlworld.com>

Ensure the session is marked as terminating no matter how hidp_session
drops out of its main loop.

This enables other functions (such as hidp_get_raw_report) to
abort early once a session is in its closing
stages - important since the cleanup of a session will remove
input/hid devices which (via the power_supply code) will typically
trigger a call to hidp_get_raw_report for an ill-fated attempt to
get the battery status. Without this change hidp_get_raw_report
can end up stalling the cleanup process for its 5 second timeout.

Signed-off-by: Karl Relton <karllinuxtest.relton@ntlworld.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
---
 net/bluetooth/hidp/core.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index b2bcbe2..ba9badc 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -722,6 +722,7 @@ static int hidp_session(void *arg)
 		set_current_state(TASK_INTERRUPTIBLE);
 	}
 	set_current_state(TASK_RUNNING);
+	atomic_inc(&session->terminate);
 	remove_wait_queue(sk_sleep(intr_sk), &intr_wait);
 	remove_wait_queue(sk_sleep(ctrl_sk), &ctrl_wait);
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-22 17:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22 17:51 [PATCH] hidp: Ensure the session is marked as terminating to enable other functions to abort early Karl Relton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).