Commit 58b93995 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: scancode in get/set_keycodes should be unsigned

The HID layer has some scan codes of the form 0xffbc0000 for logitech
devices which do not work if scancode is typed as signed int, so we need
to switch to unsigned it instead. While at it keycode being signed does
not make much sense either.
Acked-by: default avatarMárton Németh <nm127@freemail.hu>
Acked-by: default avatarMatthew Garrett <mjg@redhat.com>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent ec62e1c8
...@@ -68,22 +68,25 @@ static const struct { ...@@ -68,22 +68,25 @@ static const struct {
#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
&max, EV_KEY, (c)) &max, EV_KEY, (c))
static inline int match_scancode(int code, int scancode) static inline int match_scancode(unsigned int code, unsigned int scancode)
{ {
if (scancode == 0) if (scancode == 0)
return 1; return 1;
return ((code & (HID_USAGE_PAGE | HID_USAGE)) == scancode);
return (code & (HID_USAGE_PAGE | HID_USAGE)) == scancode;
} }
static inline int match_keycode(int code, int keycode) static inline int match_keycode(unsigned int code, unsigned int keycode)
{ {
if (keycode == 0) if (keycode == 0)
return 1; return 1;
return (code == keycode);
return code == keycode;
} }
static struct hid_usage *hidinput_find_key(struct hid_device *hid, static struct hid_usage *hidinput_find_key(struct hid_device *hid,
int scancode, int keycode) unsigned int scancode,
unsigned int keycode)
{ {
int i, j, k; int i, j, k;
struct hid_report *report; struct hid_report *report;
...@@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid, ...@@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
return NULL; return NULL;
} }
static int hidinput_getkeycode(struct input_dev *dev, int scancode, static int hidinput_getkeycode(struct input_dev *dev,
int *keycode) unsigned int scancode, unsigned int *keycode)
{ {
struct hid_device *hid = input_get_drvdata(dev); struct hid_device *hid = input_get_drvdata(dev);
struct hid_usage *usage; struct hid_usage *usage;
...@@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode, ...@@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
return -EINVAL; return -EINVAL;
} }
static int hidinput_setkeycode(struct input_dev *dev, int scancode, static int hidinput_setkeycode(struct input_dev *dev,
int keycode) unsigned int scancode, unsigned int keycode)
{ {
struct hid_device *hid = input_get_drvdata(dev); struct hid_device *hid = input_get_drvdata(dev);
struct hid_usage *usage; struct hid_usage *usage;
int old_keycode; int old_keycode;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
usage = hidinput_find_key(hid, scancode, 0); usage = hidinput_find_key(hid, scancode, 0);
if (usage) { if (usage) {
old_keycode = usage->code; old_keycode = usage->code;
......
...@@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, ...@@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
struct input_absinfo abs; struct input_absinfo abs;
struct ff_effect effect; struct ff_effect effect;
int __user *ip = (int __user *)p; int __user *ip = (int __user *)p;
int i, t, u, v; unsigned int i, t, u, v;
int error; int error;
switch (cmd) { switch (cmd) {
......
...@@ -582,7 +582,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode) ...@@ -582,7 +582,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode)
} }
static int input_default_getkeycode(struct input_dev *dev, static int input_default_getkeycode(struct input_dev *dev,
int scancode, int *keycode) unsigned int scancode,
unsigned int *keycode)
{ {
if (!dev->keycodesize) if (!dev->keycodesize)
return -EINVAL; return -EINVAL;
...@@ -596,7 +597,8 @@ static int input_default_getkeycode(struct input_dev *dev, ...@@ -596,7 +597,8 @@ static int input_default_getkeycode(struct input_dev *dev,
} }
static int input_default_setkeycode(struct input_dev *dev, static int input_default_setkeycode(struct input_dev *dev,
int scancode, int keycode) unsigned int scancode,
unsigned int keycode)
{ {
int old_keycode; int old_keycode;
int i; int i;
...@@ -654,11 +656,9 @@ static int input_default_setkeycode(struct input_dev *dev, ...@@ -654,11 +656,9 @@ static int input_default_setkeycode(struct input_dev *dev,
* This function should be called by anyone interested in retrieving current * This function should be called by anyone interested in retrieving current
* keymap. Presently keyboard and evdev handlers use it. * keymap. Presently keyboard and evdev handlers use it.
*/ */
int input_get_keycode(struct input_dev *dev, int scancode, int *keycode) int input_get_keycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode)
{ {
if (scancode < 0)
return -EINVAL;
return dev->getkeycode(dev, scancode, keycode); return dev->getkeycode(dev, scancode, keycode);
} }
EXPORT_SYMBOL(input_get_keycode); EXPORT_SYMBOL(input_get_keycode);
...@@ -672,16 +672,14 @@ EXPORT_SYMBOL(input_get_keycode); ...@@ -672,16 +672,14 @@ EXPORT_SYMBOL(input_get_keycode);
* This function should be called by anyone needing to update current * This function should be called by anyone needing to update current
* keymap. Presently keyboard and evdev handlers use it. * keymap. Presently keyboard and evdev handlers use it.
*/ */
int input_set_keycode(struct input_dev *dev, int scancode, int keycode) int input_set_keycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode)
{ {
unsigned long flags; unsigned long flags;
int old_keycode; int old_keycode;
int retval; int retval;
if (scancode < 0) if (keycode > KEY_MAX)
return -EINVAL;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL; return -EINVAL;
spin_lock_irqsave(&dev->event_lock, flags); spin_lock_irqsave(&dev->event_lock, flags);
......
...@@ -474,10 +474,11 @@ static void ati_remote2_complete_key(struct urb *urb) ...@@ -474,10 +474,11 @@ static void ati_remote2_complete_key(struct urb *urb)
} }
static int ati_remote2_getkeycode(struct input_dev *idev, static int ati_remote2_getkeycode(struct input_dev *idev,
int scancode, int *keycode) unsigned int scancode, unsigned int *keycode)
{ {
struct ati_remote2 *ar2 = input_get_drvdata(idev); struct ati_remote2 *ar2 = input_get_drvdata(idev);
int index, mode; unsigned int mode;
int index;
mode = scancode >> 8; mode = scancode >> 8;
if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
...@@ -491,10 +492,12 @@ static int ati_remote2_getkeycode(struct input_dev *idev, ...@@ -491,10 +492,12 @@ static int ati_remote2_getkeycode(struct input_dev *idev,
return 0; return 0;
} }
static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode) static int ati_remote2_setkeycode(struct input_dev *idev,
unsigned int scancode, unsigned int keycode)
{ {
struct ati_remote2 *ar2 = input_get_drvdata(idev); struct ati_remote2 *ar2 = input_get_drvdata(idev);
int index, mode, old_keycode; unsigned int mode, old_keycode;
int index;
mode = scancode >> 8; mode = scancode >> 8;
if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
...@@ -504,9 +507,6 @@ static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keyc ...@@ -504,9 +507,6 @@ static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keyc
if (index < 0) if (index < 0)
return -EINVAL; return -EINVAL;
if (keycode < KEY_RESERVED || keycode > KEY_MAX)
return -EINVAL;
old_keycode = ar2->keycode[mode][index]; old_keycode = ar2->keycode[mode][index];
ar2->keycode[mode][index] = keycode; ar2->keycode[mode][index] = keycode;
__set_bit(keycode, idev->keybit); __set_bit(keycode, idev->keybit);
......
...@@ -385,26 +385,24 @@ wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode) ...@@ -385,26 +385,24 @@ wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode)
} }
static int static int
wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode) wbcir_getkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode)
{ {
struct wbcir_data *data = input_get_drvdata(dev); struct wbcir_data *data = input_get_drvdata(dev);
*keycode = (int)wbcir_do_getkeycode(data, (u32)scancode); *keycode = wbcir_do_getkeycode(data, scancode);
return 0; return 0;
} }
static int static int
wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode) wbcir_setkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode)
{ {
struct wbcir_data *data = input_get_drvdata(dev); struct wbcir_data *data = input_get_drvdata(dev);
struct wbcir_keyentry *keyentry; struct wbcir_keyentry *keyentry;
struct wbcir_keyentry *new_keyentry; struct wbcir_keyentry *new_keyentry;
unsigned long flags; unsigned long flags;
unsigned int old_keycode = KEY_RESERVED; unsigned int old_keycode = KEY_RESERVED;
u32 scancode = (u32)sscancode;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL); new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
if (!new_keyentry) if (!new_keyentry)
......
...@@ -64,7 +64,8 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev, ...@@ -64,7 +64,8 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
EXPORT_SYMBOL(sparse_keymap_entry_from_keycode); EXPORT_SYMBOL(sparse_keymap_entry_from_keycode);
static int sparse_keymap_getkeycode(struct input_dev *dev, static int sparse_keymap_getkeycode(struct input_dev *dev,
int scancode, int *keycode) unsigned int scancode,
unsigned int *keycode)
{ {
const struct key_entry *key = const struct key_entry *key =
sparse_keymap_entry_from_scancode(dev, scancode); sparse_keymap_entry_from_scancode(dev, scancode);
...@@ -78,7 +79,8 @@ static int sparse_keymap_getkeycode(struct input_dev *dev, ...@@ -78,7 +79,8 @@ static int sparse_keymap_getkeycode(struct input_dev *dev,
} }
static int sparse_keymap_setkeycode(struct input_dev *dev, static int sparse_keymap_setkeycode(struct input_dev *dev,
int scancode, int keycode) unsigned int scancode,
unsigned int keycode)
{ {
struct key_entry *key; struct key_entry *key;
int old_keycode; int old_keycode;
......
...@@ -123,7 +123,7 @@ static int ir_copy_table(struct ir_scancode_table *destin, ...@@ -123,7 +123,7 @@ static int ir_copy_table(struct ir_scancode_table *destin,
* If the key is not found, returns -EINVAL, otherwise, returns 0. * If the key is not found, returns -EINVAL, otherwise, returns 0.
*/ */
static int ir_getkeycode(struct input_dev *dev, static int ir_getkeycode(struct input_dev *dev,
int scancode, int *keycode) unsigned int scancode, unsigned int *keycode)
{ {
int elem; int elem;
struct ir_input_dev *ir_dev = input_get_drvdata(dev); struct ir_input_dev *ir_dev = input_get_drvdata(dev);
...@@ -291,7 +291,7 @@ static int ir_insert_key(struct ir_scancode_table *rc_tab, ...@@ -291,7 +291,7 @@ static int ir_insert_key(struct ir_scancode_table *rc_tab,
* If the key is not found, returns -EINVAL, otherwise, returns 0. * If the key is not found, returns -EINVAL, otherwise, returns 0.
*/ */
static int ir_setkeycode(struct input_dev *dev, static int ir_setkeycode(struct input_dev *dev,
int scancode, int keycode) unsigned int scancode, unsigned int keycode)
{ {
int rc = 0; int rc = 0;
struct ir_input_dev *ir_dev = input_get_drvdata(dev); struct ir_input_dev *ir_dev = input_get_drvdata(dev);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <linux/usb/input.h> #include <linux/usb/input.h>
static int dvb_usb_getkeycode(struct input_dev *dev, static int dvb_usb_getkeycode(struct input_dev *dev,
int scancode, int *keycode) unsigned int scancode, unsigned int *keycode)
{ {
struct dvb_usb_device *d = input_get_drvdata(dev); struct dvb_usb_device *d = input_get_drvdata(dev);
...@@ -39,7 +39,7 @@ static int dvb_usb_getkeycode(struct input_dev *dev, ...@@ -39,7 +39,7 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
} }
static int dvb_usb_setkeycode(struct input_dev *dev, static int dvb_usb_setkeycode(struct input_dev *dev,
int scancode, int keycode) unsigned int scancode, unsigned int keycode)
{ {
struct dvb_usb_device *d = input_get_drvdata(dev); struct dvb_usb_device *d = input_get_drvdata(dev);
......
...@@ -142,7 +142,7 @@ static struct key_entry *dell_wmi_keymap = dell_legacy_wmi_keymap; ...@@ -142,7 +142,7 @@ static struct key_entry *dell_wmi_keymap = dell_legacy_wmi_keymap;
static struct input_dev *dell_wmi_input_dev; static struct input_dev *dell_wmi_input_dev;
static struct key_entry *dell_wmi_get_entry_by_scancode(int code) static struct key_entry *dell_wmi_get_entry_by_scancode(unsigned int code)
{ {
struct key_entry *key; struct key_entry *key;
...@@ -153,7 +153,7 @@ static struct key_entry *dell_wmi_get_entry_by_scancode(int code) ...@@ -153,7 +153,7 @@ static struct key_entry *dell_wmi_get_entry_by_scancode(int code)
return NULL; return NULL;
} }
static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) static struct key_entry *dell_wmi_get_entry_by_keycode(unsigned int keycode)
{ {
struct key_entry *key; struct key_entry *key;
...@@ -164,8 +164,8 @@ static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) ...@@ -164,8 +164,8 @@ static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode)
return NULL; return NULL;
} }
static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, static int dell_wmi_getkeycode(struct input_dev *dev,
int *keycode) unsigned int scancode, unsigned int *keycode)
{ {
struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode); struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode);
...@@ -177,13 +177,11 @@ static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, ...@@ -177,13 +177,11 @@ static int dell_wmi_getkeycode(struct input_dev *dev, int scancode,
return -EINVAL; return -EINVAL;
} }
static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) static int dell_wmi_setkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode)
{ {
struct key_entry *key; struct key_entry *key;
int old_keycode; unsigned int old_keycode;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
key = dell_wmi_get_entry_by_scancode(scancode); key = dell_wmi_get_entry_by_scancode(scancode);
if (key && key->type == KE_KEY) { if (key && key->type == KE_KEY) {
......
...@@ -278,7 +278,7 @@ static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als); ...@@ -278,7 +278,7 @@ static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als);
static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL);
static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL);
static struct key_entry *hp_wmi_get_entry_by_scancode(int code) static struct key_entry *hp_wmi_get_entry_by_scancode(unsigned int code)
{ {
struct key_entry *key; struct key_entry *key;
...@@ -289,7 +289,7 @@ static struct key_entry *hp_wmi_get_entry_by_scancode(int code) ...@@ -289,7 +289,7 @@ static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
return NULL; return NULL;
} }
static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) static struct key_entry *hp_wmi_get_entry_by_keycode(unsigned int keycode)
{ {
struct key_entry *key; struct key_entry *key;
...@@ -300,7 +300,8 @@ static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) ...@@ -300,7 +300,8 @@ static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
return NULL; return NULL;
} }
static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) static int hp_wmi_getkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode)
{ {
struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode); struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
...@@ -312,13 +313,11 @@ static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) ...@@ -312,13 +313,11 @@ static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
return -EINVAL; return -EINVAL;
} }
static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) static int hp_wmi_setkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode)
{ {
struct key_entry *key; struct key_entry *key;
int old_keycode; unsigned int old_keycode;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
key = hp_wmi_get_entry_by_scancode(scancode); key = hp_wmi_get_entry_by_scancode(scancode);
if (key && key->type == KE_KEY) { if (key && key->type == KE_KEY) {
......
...@@ -200,7 +200,7 @@ static struct acpi_driver acpi_pcc_driver = { ...@@ -200,7 +200,7 @@ static struct acpi_driver acpi_pcc_driver = {
}; };
#define KEYMAP_SIZE 11 #define KEYMAP_SIZE 11
static const int initial_keymap[KEYMAP_SIZE] = { static const unsigned int initial_keymap[KEYMAP_SIZE] = {
/* 0 */ KEY_RESERVED, /* 0 */ KEY_RESERVED,
/* 1 */ KEY_BRIGHTNESSDOWN, /* 1 */ KEY_BRIGHTNESSDOWN,
/* 2 */ KEY_BRIGHTNESSUP, /* 2 */ KEY_BRIGHTNESSUP,
...@@ -222,7 +222,7 @@ struct pcc_acpi { ...@@ -222,7 +222,7 @@ struct pcc_acpi {
struct acpi_device *device; struct acpi_device *device;
struct input_dev *input_dev; struct input_dev *input_dev;
struct backlight_device *backlight; struct backlight_device *backlight;
int keymap[KEYMAP_SIZE]; unsigned int keymap[KEYMAP_SIZE];
}; };
struct pcc_keyinput { struct pcc_keyinput {
...@@ -445,7 +445,8 @@ static struct attribute_group pcc_attr_group = { ...@@ -445,7 +445,8 @@ static struct attribute_group pcc_attr_group = {
/* hotkey input device driver */ /* hotkey input device driver */
static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) static int pcc_getkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode)
{ {
struct pcc_acpi *pcc = input_get_drvdata(dev); struct pcc_acpi *pcc = input_get_drvdata(dev);
...@@ -457,7 +458,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) ...@@ -457,7 +458,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
return 0; return 0;
} }
static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) static int keymap_get_by_keycode(struct pcc_acpi *pcc, unsigned int keycode)
{ {
int i; int i;
...@@ -469,7 +470,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) ...@@ -469,7 +470,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode)
return 0; return 0;
} }
static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) static int pcc_setkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode)
{ {
struct pcc_acpi *pcc = input_get_drvdata(dev); struct pcc_acpi *pcc = input_get_drvdata(dev);
int oldkeycode; int oldkeycode;
...@@ -477,9 +479,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) ...@@ -477,9 +479,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode)
if (scancode >= ARRAY_SIZE(pcc->keymap)) if (scancode >= ARRAY_SIZE(pcc->keymap))
return -EINVAL; return -EINVAL;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
oldkeycode = pcc->keymap[scancode]; oldkeycode = pcc->keymap[scancode];
pcc->keymap[scancode] = keycode; pcc->keymap[scancode] = keycode;
......
...@@ -46,7 +46,7 @@ static struct tps_key_entry topstar_keymap[] = { ...@@ -46,7 +46,7 @@ static struct tps_key_entry topstar_keymap[] = {
{ } { }
}; };
static struct tps_key_entry *tps_get_key_by_scancode(int code) static struct tps_key_entry *tps_get_key_by_scancode(unsigned int code)
{ {
struct tps_key_entry *key; struct tps_key_entry *key;
...@@ -57,7 +57,7 @@ static struct tps_key_entry *tps_get_key_by_scancode(int code) ...@@ -57,7 +57,7 @@ static struct tps_key_entry *tps_get_key_by_scancode(int code)
return NULL; return NULL;
} }
static struct tps_key_entry *tps_get_key_by_keycode(int code) static struct tps_key_entry *tps_get_key_by_keycode(unsigned int code)
{ {
struct tps_key_entry *key; struct tps_key_entry *key;
...@@ -126,7 +126,8 @@ static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state) ...@@ -126,7 +126,8 @@ static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state)
return 0; return 0;
} }
static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) static int topstar_getkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode)
{ {
struct tps_key_entry *key = tps_get_key_by_scancode(scancode); struct tps_key_entry *key = tps_get_key_by_scancode(scancode);
...@@ -137,14 +138,12 @@ static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) ...@@ -137,14 +138,12 @@ static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode)
return 0; return 0;
} }
static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode) static int topstar_setkeycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode)
{ {
struct tps_key_entry *key; struct tps_key_entry *key;
int old_keycode; int old_keycode;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
key = tps_get_key_by_scancode(scancode); key = tps_get_key_by_scancode(scancode);
if (!key) if (!key)
......
...@@ -745,7 +745,7 @@ static struct backlight_ops toshiba_backlight_data = { ...@@ -745,7 +745,7 @@ static struct backlight_ops toshiba_backlight_data = {
.update_status = set_lcd_status, .update_status = set_lcd_status,
}; };
static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) static struct key_entry *toshiba_acpi_get_entry_by_scancode(unsigned int code)
{ {
struct key_entry *key; struct key_entry *key;
...@@ -756,7 +756,7 @@ static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) ...@@ -756,7 +756,7 @@ static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
return NULL; return NULL;
} }
static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) static struct key_entry *toshiba_acpi_get_entry_by_keycode(unsigned int code)
{ {
struct key_entry *key; struct key_entry *key;
...@@ -767,8 +767,8 @@ static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) ...@@ -767,8 +767,8 @@ static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
return NULL; return NULL;
} }
static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, static int toshiba_acpi_getkeycode(struct input_dev *dev,
int *keycode) unsigned int scancode, unsigned int *keycode)
{ {
struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode); struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode);
...@@ -780,14 +780,11 @@ static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, ...@@ -780,14 +780,11 @@ static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
return -EINVAL; return -EINVAL;
} }
static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode, static int toshiba_acpi_setkeycode(struct input_dev *dev,
int keycode) unsigned int scancode, unsigned int keycode)
{ {
struct key_entry *key; struct key_entry *key;
int old_keycode; unsigned int old_keycode;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
key = toshiba_acpi_get_entry_by_scancode(scancode); key = toshiba_acpi_get_entry_by_scancode(scancode);
if (key && key->type == KE_KEY) { if (key && key->type == KE_KEY) {
......
...@@ -58,10 +58,10 @@ struct input_absinfo { ...@@ -58,10 +58,10 @@ struct input_absinfo {
#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
#define EVIOCSREP _IOW('E', 0x03, int[2]) /* set repeat settings */ #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
#define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
#define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
...@@ -1142,8 +1142,10 @@ struct input_dev { ...@@ -1142,8 +1142,10 @@ struct input_dev {
unsigned int keycodemax; unsigned int keycodemax;
unsigned int keycodesize; unsigned int keycodesize;
void *keycode; void *keycode;
int (*setkeycode)(struct input_dev *dev, int scancode, int keycode); int (*setkeycode)(struct input_dev *dev,
int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode); unsigned int scancode, unsigned int keycode);
int (*getkeycode)(struct input_dev *dev,
unsigned int scancode, unsigned int *keycode);
struct ff_device *ff; struct ff_device *ff;
...@@ -1415,8 +1417,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min ...@@ -1415,8 +1417,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
} }
int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); int input_get_keycode(struct input_dev *dev,
int input_set_keycode(struct input_dev *dev, int scancode, int keycode); unsigned int scancode, unsigned int *keycode);
int input_set_keycode(struct input_dev *dev,
unsigned int scancode, unsigned int keycode);
extern struct class input_class; extern struct class input_class;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment