public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denis Turischev <denis@compulab.co.il>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Wim Van Sebroeck <wim@iguana.be>, Andrey Panin <pazke@centrinvest.ru>
Subject: "scheduling while atomic" bug in SBC-FITPC2 watchdog
Date: Thu, 22 Apr 2010 19:54:20 +0300	[thread overview]
Message-ID: <4BD07F3C.8080404@compulab.co.il> (raw)
In-Reply-To: <4BD07E3B.3030504@compulab.co.il>

sbc_fitpc2_wdt: fixed "scheduling while atomic" bug.

speenlock need to be replaced by mutex because of sleep functions
inside wdt_send_data.

Signed-off-by: Denis Turischev <denis@compulab.co.il>
---
 drivers/watchdog/sbc_fitpc2_wdt.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c
index 226f0f2..23da5cb 100644
--- a/drivers/watchdog/sbc_fitpc2_wdt.c
+++ b/drivers/watchdog/sbc_fitpc2_wdt.c
@@ -30,7 +30,7 @@
 static int nowayout = WATCHDOG_NOWAYOUT;
 static unsigned int margin = 60;	/* (secs) Default is 1 minute */
 static unsigned long wdt_status;
-static DEFINE_SPINLOCK(wdt_lock);
+static DEFINE_MUTEX(wdt_lock);

 #define WDT_IN_USE		0
 #define WDT_OK_TO_CLOSE		1
@@ -53,18 +53,18 @@ static void wdt_send_data(unsigned char command, unsigned char data)

 static void wdt_enable(void)
 {
-	spin_lock(&wdt_lock);
+	mutex_lock(&wdt_lock);
 	wdt_send_data(IFACE_ON_COMMAND, 1);
 	wdt_send_data(REBOOT_COMMAND, margin);
-	spin_unlock(&wdt_lock);
+	mutex_unlock(&wdt_lock);
 }

 static void wdt_disable(void)
 {
-	spin_lock(&wdt_lock);
+	mutex_lock(&wdt_lock);
 	wdt_send_data(IFACE_ON_COMMAND, 0);
 	wdt_send_data(REBOOT_COMMAND, 0);
-	spin_unlock(&wdt_lock);
+	mutex_unlock(&wdt_lock);
 }

 static int fitpc2_wdt_open(struct inode *inode, struct file *file)

      reply	other threads:[~2010-04-22 16:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20 15:53 [PATCH] add SBC-FITPC2 watchdog driver Mike Rapoport
2009-07-20 16:43 ` Joe Perches
2009-07-21  4:34 ` [PATCH 0/3] drivers/watchdog: Use pr_<level> Joe Perches
2009-07-21  4:35   ` [PATCH 1/3] include/linux: kernel.h dynamic_debug.h device.h - Use section fmts Joe Perches
2009-07-21  4:35   ` [PATCH 2/3] drivers/watchdog: Convert printk(KERN_<level> to pr_<level>( Joe Perches
2009-07-21  4:35   ` [PATCH 3/3] drivers/watchdog: use pr_fmt Joe Perches
2009-11-05 11:32 ` SBC-FITPC2 watchdog driver fix Denis Turischev
2009-11-05 11:51   ` Wim Van Sebroeck
2010-01-21 14:10   ` Denis Turischev
2010-04-22 16:50     ` I/O operations order fix for SBC-FITPC2 watchdog Denis Turischev
2010-04-22 16:54       ` Denis Turischev [this message]

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=4BD07F3C.8080404@compulab.co.il \
    --to=denis@compulab.co.il \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pazke@centrinvest.ru \
    --cc=wim@iguana.be \
    /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