Skip to contentSkip to conversation

input: replace spin_lock_bh with spin_lock_irqsave in ml_ff_playback

PATCH New Arjan van de Ven 1 participant 1 message Nov 24, 2008 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: replace spin_lock_bh with spin_lock_irqsave in ml_ff_playback

Quoted 2 lines

From 829678fc4684defcef2139182e88a304acdfa0ad Mon Sep 17 00:00:00 2001

From: Arjan van de Ven <[email protected]>
Date: Sun, 23 Nov 2008 16:57:36 -0800
Subject: [PATCH] input: replace spin_lock_bh with spin_lock_irqsave in ml_ff_playback

ml_ff_playback() uses spin_(un)lock_bh. However this function is called with interrupts disabled from erase_effect() in drivers/input/ff-core.c:196.

This is not permitted, and will result in a WARN_ON in the bottom half handling code. This patch changes this function to just use spin_lock_irqsave() instead, solving the problem and simplifying the locking logic.

This was reported as entry #106559 in kerneloops.org

Reported-by kerneloops.org
---
 drivers/input/ff-memless.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/input/ff-memless.c +3 -2
index 6790e97..bc4e40f 100644
@@ -397,8 +397,9 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
 {
 	struct ml_device *ml = dev->ff->private;
 	struct ml_effect_state *state = &ml->states[effect_id];
+	unsigned long flags;
 
-	spin_lock_bh(&ml->timer_lock);
+	spin_lock_irqsave(&ml->timer_lock, flags);
 
 	if (value > 0) {
 		debug("initiated play");
@@ -424,7 +425,7 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
 		ml_play_effects(ml);
 	}
 
-	spin_unlock_bh(&ml->timer_lock);
+	spin_unlock_irqrestore(&ml->timer_lock, flags);
 
 	return 0;
 }
Signature · 7 lines
1.6.0.3


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org