aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-20 01:27:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-20 01:27:06 -0400
commita952baa034ae7c2e4a66932005cbc7ebbccfe28d (patch)
treeff5abe0c77f5b129946300677d9b57b00d926a1e /drivers/input/input.c
parent5bab188a316718a26346cdb25c4cc6b319f8f907 (diff)
parent97eb3f24352ec6632c2127b35d8087d2a809a9b9 (diff)
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: (64 commits) Input: tsc2005 - remove 'disable' sysfs attribute Input: tsc2005 - add open/close Input: tsc2005 - handle read errors from SPI layer Input: tsc2005 - do not rearm timer in hardirq handler Input: tsc2005 - don't use work for 'pen up' handling Input: tsc2005 - do not use 0 in place of NULL Input: tsc2005 - use true/false for boolean variables Input: tsc2005 - hide selftest attribute if we can't reset Input: tsc2005 - rework driver initialization code Input: tsc2005 - set up bus type in input device Input: tsc2005 - set up parent device Input: tsc2005 - clear driver data after unbinding Input: tsc2005 - add module description Input: tsc2005 - remove driver banner message Input: tsc2005 - remove incorrect module alias Input: tsc2005 - convert to using dev_pm_ops Input: tsc2005 - use spi_get/set_drvdata() Input: introduce tsc2005 driver Input: xen-kbdfront - move to drivers/input/misc Input: xen-kbdfront - add grant reference for shared page ...
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c55
1 files changed, 7 insertions, 48 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 11905b6a3023..d6e8bd8a851c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -791,22 +791,9 @@ int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke)
791 int retval; 791 int retval;
792 792
793 spin_lock_irqsave(&dev->event_lock, flags); 793 spin_lock_irqsave(&dev->event_lock, flags);
794 794 retval = dev->getkeycode(dev, ke);
795 if (dev->getkeycode) {
796 /*
797 * Support for legacy drivers, that don't implement the new
798 * ioctls
799 */
800 u32 scancode = ke->index;
801
802 memcpy(ke->scancode, &scancode, sizeof(scancode));
803 ke->len = sizeof(scancode);
804 retval = dev->getkeycode(dev, scancode, &ke->keycode);
805 } else {
806 retval = dev->getkeycode_new(dev, ke);
807 }
808
809 spin_unlock_irqrestore(&dev->event_lock, flags); 795 spin_unlock_irqrestore(&dev->event_lock, flags);
796
810 return retval; 797 return retval;
811} 798}
812EXPORT_SYMBOL(input_get_keycode); 799EXPORT_SYMBOL(input_get_keycode);
@@ -831,35 +818,7 @@ int input_set_keycode(struct input_dev *dev,
831 818
832 spin_lock_irqsave(&dev->event_lock, flags); 819 spin_lock_irqsave(&dev->event_lock, flags);
833 820
834 if (dev->setkeycode) { 821 retval = dev->setkeycode(dev, ke, &old_keycode);
835 /*
836 * Support for legacy drivers, that don't implement the new
837 * ioctls
838 */
839 unsigned int scancode;
840
841 retval = input_scancode_to_scalar(ke, &scancode);
842 if (retval)
843 goto out;
844
845 /*
846 * We need to know the old scancode, in order to generate a
847 * keyup effect, if the set operation happens successfully
848 */
849 if (!dev->getkeycode) {
850 retval = -EINVAL;
851 goto out;
852 }
853
854 retval = dev->getkeycode(dev, scancode, &old_keycode);
855 if (retval)
856 goto out;
857
858 retval = dev->setkeycode(dev, scancode, ke->keycode);
859 } else {
860 retval = dev->setkeycode_new(dev, ke, &old_keycode);
861 }
862
863 if (retval) 822 if (retval)
864 goto out; 823 goto out;
865 824
@@ -1846,11 +1805,11 @@ int input_register_device(struct input_dev *dev)
1846 dev->rep[REP_PERIOD] = 33; 1805 dev->rep[REP_PERIOD] = 33;
1847 } 1806 }
1848 1807
1849 if (!dev->getkeycode && !dev->getkeycode_new) 1808 if (!dev->getkeycode)
1850 dev->getkeycode_new = input_default_getkeycode; 1809 dev->getkeycode = input_default_getkeycode;
1851 1810
1852 if (!dev->setkeycode && !dev->setkeycode_new) 1811 if (!dev->setkeycode)
1853 dev->setkeycode_new = input_default_setkeycode; 1812 dev->setkeycode = input_default_setkeycode;
1854 1813
1855 dev_set_name(&dev->dev, "input%ld", 1814 dev_set_name(&dev->dev, "input%ld",
1856 (unsigned long) atomic_inc_return(&input_no) - 1); 1815 (unsigned long) atomic_inc_return(&input_no) - 1);