Skip to contentSkip to conversation

hidp: Ensure the session is marked as terminating to enable other functions to abort early.

PATCH New Karl Relton 1 participant 1 message Feb 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hidp: Ensure the session is marked as terminating to enable other functions to abort early.

From: Karl Relton <[email protected]>

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.

---
 net/bluetooth/hidp/core.c |    1 +
 1 file changed, 1 insertion(+)
net/bluetooth/hidp/core.c +1 -0
index b2bcbe2..ba9badc 100644
@@ -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);
 
Signature · 1 line
1.7.9.5