aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/ff-core.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-07 08:01:26 +0200
committerIngo Molnar <mingo@elte.hu>2008-07-07 08:01:26 +0200
commit032f82786f9be4635acaa5f77feca175a4ac5fe1 (patch)
tree11ce43c1086d3dec43c92b0a2cc740240b338fb7 /drivers/input/ff-core.c
parent46ac22bab42cc868b9c1d0e915ddbc8e8065a44d (diff)
parentb7279469d66b55119784b8b9529c99c1955fe747 (diff)
Merge commit 'v2.6.26-rc9' into sched/devel
Diffstat (limited to 'drivers/input/ff-core.c')
-rw-r--r--drivers/input/ff-core.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c
index eebc72465fc..72c63e5dd63 100644
--- a/drivers/input/ff-core.c
+++ b/drivers/input/ff-core.c
@@ -28,6 +28,7 @@
#include <linux/input.h>
#include <linux/module.h>
#include <linux/mutex.h>
+#include <linux/sched.h>
/*
* Check that the effect_id is a valid effect and whether the user
@@ -166,8 +167,10 @@ int input_ff_upload(struct input_dev *dev, struct ff_effect *effect,
if (ret)
goto out;
+ spin_lock_irq(&dev->event_lock);
ff->effects[id] = *effect;
ff->effect_owners[id] = file;
+ spin_unlock_irq(&dev->event_lock);
out:
mutex_unlock(&ff->mutex);
@@ -189,16 +192,22 @@ static int erase_effect(struct input_dev *dev, int effect_id,
if (error)
return error;
+ spin_lock_irq(&dev->event_lock);
ff->playback(dev, effect_id, 0);
+ ff->effect_owners[effect_id] = NULL;
+ spin_unlock_irq(&dev->event_lock);
if (ff->erase) {
error = ff->erase(dev, effect_id);
- if (error)
+ if (error) {
+ spin_lock_irq(&dev->event_lock);
+ ff->effect_owners[effect_id] = file;
+ spin_unlock_irq(&dev->event_lock);
+
return error;
+ }
}
- ff->effect_owners[effect_id] = NULL;
-
return 0;
}
@@ -263,8 +272,6 @@ int input_ff_event(struct input_dev *dev, unsigned int type,
if (type != EV_FF)
return 0;
- mutex_lock(&ff->mutex);
-
switch (code) {
case FF_GAIN:
if (!test_bit(FF_GAIN, dev->ffbit) || value > 0xffff)
@@ -286,7 +293,6 @@ int input_ff_event(struct input_dev *dev, unsigned int type,
break;
}
- mutex_unlock(&ff->mutex);
return 0;
}
EXPORT_SYMBOL_GPL(input_ff_event);