diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-30 15:58:09 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-30 15:58:09 (GMT) |
commit | e1441b9a41c33aa9236008a7cfe49a8e723fb397 (patch) | |
tree | 87053114a75777dfdc6a81de97ae43fc55991ad8 /drivers | |
parent | 70c85057e0bde35eb56352a293ecb5d1641a0334 (diff) | |
parent | 656acd2bbc4ce7f224de499ee255698701396c48 (diff) | |
download | linux-e1441b9a41c33aa9236008a7cfe49a8e723fb397.tar.xz |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: fix locking in force-feedback core
Input: add KEY_MEDIA_REPEAT definition
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/ff-core.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/input/ff-core.c b/drivers/input/ff-core.c index eebc724..4c01464 100644 --- a/drivers/input/ff-core.c +++ b/drivers/input/ff-core.c @@ -166,8 +166,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 +191,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 +271,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 +292,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); |