public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Artem Savkov <artem.savkov@gmail.com>
To: ibm-acpi-devel@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org, ibm-acpi@hmh.eng.br,
	matthew.garrett@nebula.com, linux-kernel@vger.kernel.org,
	Artem Savkov <artem.savkov@gmail.com>
Subject: [PATCH] thinkpad_acpi: moved hotkey_thread_mutex lock after set_freezable()
Date: Sun, 24 Feb 2013 13:22:02 +0400	[thread overview]
Message-ID: <1361697722-4575-1-git-send-email-artem.savkov@gmail.com> (raw)

set_freezable() checks freezing during which no locks should be held.
hotkey_thread_mutex lock should be moved closer to where it is actually needed.

Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
---
 drivers/platform/x86/thinkpad_acpi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 22d8936..ffed96cd 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2463,13 +2463,13 @@ static int hotkey_kthread(void *data)
 	unsigned int poll_freq;
 	bool was_frozen;
 
-	mutex_lock(&hotkey_thread_mutex);
-
 	if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
 		goto exit;
 
 	set_freezable();
 
+	mutex_lock(&hotkey_thread_mutex);
+
 	so = 0;
 	si = 1;
 	t = 0;
@@ -2523,8 +2523,8 @@ static int hotkey_kthread(void *data)
 		si ^= 1;
 	}
 
-exit:
 	mutex_unlock(&hotkey_thread_mutex);
+exit:
 	return 0;
 }
 
-- 
1.8.1.4


             reply	other threads:[~2013-02-24  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24  9:22 Artem Savkov [this message]
2013-02-25 23:54 ` [PATCH] thinkpad_acpi: moved hotkey_thread_mutex lock after set_freezable() Andrew Morton
2013-02-26  5:47   ` Artem Savkov

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=1361697722-4575-1-git-send-email-artem.savkov@gmail.com \
    --to=artem.savkov@gmail.com \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ibm-acpi@hmh.eng.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=platform-driver-x86@vger.kernel.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