summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-05-16 13:49:18 +0400
committerJiri Kosina <jkosina@suse.cz>2008-10-15 01:50:49 +0400
commit022e8c4d08b3b06361594b60412db0242035c4b4 (patch)
tree9a8c57a3054737fb142054d146bad99723cd3cfa /drivers/hid/hid-input.c
parent990436a7c9d0e5d395b83d79cfa32f89b8144e5b (diff)
downloadlinux-022e8c4d08b3b06361594b60412db0242035c4b4.tar.xz
HID: move usage input mapping to hid.h
This mapping are currently used on 2 placces and will be needed by more quirk drivers, so move them to hid.h to allow them to use it. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 9fa7239ab310..be2c7a8ad254 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -76,13 +76,15 @@ static const struct {
__s32 y;
} hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
-#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; max = ABS_MAX; } while (0)
-#define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; max = REL_MAX; } while (0)
-#define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; max = KEY_MAX; } while (0)
-#define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; max = LED_MAX; } while (0)
+#define map_abs(c) hid_map_usage(hidinput, usage, &bit, &max, EV_ABS, (c))
+#define map_rel(c) hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c))
+#define map_key(c) hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c))
+#define map_led(c) hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c))
-#define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0)
-#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0)
+#define map_abs_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
+ &max, EV_ABS, (c))
+#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
+ &max, EV_KEY, (c))
#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
@@ -386,7 +388,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
}
/* handle input mappings for quirky devices */
- ret = hidinput_mapping_quirks(usage, input, &bit, &max);
+ ret = hidinput_mapping_quirks(usage, hidinput, &bit, &max);
if (ret)
goto mapped;