diff options
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 55 |
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 | } |
812 | EXPORT_SYMBOL(input_get_keycode); | 799 | EXPORT_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); |