diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-02-01 00:06:39 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-02-01 00:16:59 -0500 |
commit | aebd636bd60e2dda0ebc907dd5f7f4a45174411c (patch) | |
tree | ce5ae0c890149296e70545fccbb11c4799c4e39c /drivers/input/input.c | |
parent | f06e6a52ca3dbe927f58653b1e90cbb53f5ceb55 (diff) |
Input: switch completely over to the new versions of get/setkeycode
All users of old style get/setkeycode methids have been converted so
it is time to retire them.
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
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 7985114beac7..ee2959bd322c 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -806,22 +806,9 @@ int input_get_keycode(struct input_dev *dev, struct input_keymap_entry *ke) | |||
806 | int retval; | 806 | int retval; |
807 | 807 | ||
808 | spin_lock_irqsave(&dev->event_lock, flags); | 808 | spin_lock_irqsave(&dev->event_lock, flags); |
809 | 809 | retval = dev->getkeycode(dev, ke); | |
810 | if (dev->getkeycode) { | ||
811 | /* | ||
812 | * Support for legacy drivers, that don't implement the new | ||
813 | * ioctls | ||
814 | */ | ||
815 | u32 scancode = ke->index; | ||
816 | |||
817 | memcpy(ke->scancode, &scancode, sizeof(scancode)); | ||
818 | ke->len = sizeof(scancode); | ||
819 | retval = dev->getkeycode(dev, scancode, &ke->keycode); | ||
820 | } else { | ||
821 | retval = dev->getkeycode_new(dev, ke); | ||
822 | } | ||
823 | |||
824 | spin_unlock_irqrestore(&dev->event_lock, flags); | 810 | spin_unlock_irqrestore(&dev->event_lock, flags); |
811 | |||
825 | return retval; | 812 | return retval; |
826 | } | 813 | } |
827 | EXPORT_SYMBOL(input_get_keycode); | 814 | EXPORT_SYMBOL(input_get_keycode); |
@@ -846,35 +833,7 @@ int input_set_keycode(struct input_dev *dev, | |||
846 | 833 | ||
847 | spin_lock_irqsave(&dev->event_lock, flags); | 834 | spin_lock_irqsave(&dev->event_lock, flags); |
848 | 835 | ||
849 | if (dev->setkeycode) { | 836 | retval = dev->setkeycode(dev, ke, &old_keycode); |
850 | /* | ||
851 | * Support for legacy drivers, that don't implement the new | ||
852 | * ioctls | ||
853 | */ | ||
854 | unsigned int scancode; | ||
855 | |||
856 | retval = input_scancode_to_scalar(ke, &scancode); | ||
857 | if (retval) | ||
858 | goto out; | ||
859 | |||
860 | /* | ||
861 | * We need to know the old scancode, in order to generate a | ||
862 | * keyup effect, if the set operation happens successfully | ||
863 | */ | ||
864 | if (!dev->getkeycode) { | ||
865 | retval = -EINVAL; | ||
866 | goto out; | ||
867 | } | ||
868 | |||
869 | retval = dev->getkeycode(dev, scancode, &old_keycode); | ||
870 | if (retval) | ||
871 | goto out; | ||
872 | |||
873 | retval = dev->setkeycode(dev, scancode, ke->keycode); | ||
874 | } else { | ||
875 | retval = dev->setkeycode_new(dev, ke, &old_keycode); | ||
876 | } | ||
877 | |||
878 | if (retval) | 837 | if (retval) |
879 | goto out; | 838 | goto out; |
880 | 839 | ||
@@ -1861,11 +1820,11 @@ int input_register_device(struct input_dev *dev) | |||
1861 | dev->rep[REP_PERIOD] = 33; | 1820 | dev->rep[REP_PERIOD] = 33; |
1862 | } | 1821 | } |
1863 | 1822 | ||
1864 | if (!dev->getkeycode && !dev->getkeycode_new) | 1823 | if (!dev->getkeycode) |
1865 | dev->getkeycode_new = input_default_getkeycode; | 1824 | dev->getkeycode = input_default_getkeycode; |
1866 | 1825 | ||
1867 | if (!dev->setkeycode && !dev->setkeycode_new) | 1826 | if (!dev->setkeycode) |
1868 | dev->setkeycode_new = input_default_setkeycode; | 1827 | dev->setkeycode = input_default_setkeycode; |
1869 | 1828 | ||
1870 | dev_set_name(&dev->dev, "input%ld", | 1829 | dev_set_name(&dev->dev, "input%ld", |
1871 | (unsigned long) atomic_inc_return(&input_no) - 1); | 1830 | (unsigned long) atomic_inc_return(&input_no) - 1); |