Linux bluetooth development
 help / color / mirror / Atom feed
From: Karl Relton <karllinuxtest.relton@ntlworld.com>
To: linux-bluetooth@vger.kernel.org
Cc: dh.herrmann@gmail.com, Marcel Holtmann <marcel@holtmann.org>,
	Gustavo Padovan <gustavo@padovan.org>,
	Johan Hedberg <johan.hedberg@gmail.com>
Subject: [PATCH] hidp: Ensure the session is marked as terminating to enable other functions to abort early.
Date: Fri, 22 Feb 2013 17:51:23 +0000	[thread overview]
Message-ID: <1361555483.13060.2.camel@dellpc> (raw)

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

                 reply	other threads:[~2013-02-22 17:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361555483.13060.2.camel@dellpc \
    --to=karllinuxtest.relton@ntlworld.com \
    --cc=dh.herrmann@gmail.com \
    --cc=gustavo@padovan.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox