diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-11-03 10:42:02 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-11-03 10:42:02 -0400 |
commit | a4bc6926d05b60bf70aab2db2c6715e15118cbdc (patch) | |
tree | 8b75de49e968ff6870a66ffaddfc1e5c18964530 /drivers/hid/hid-apple.c | |
parent | 99b9f758bbc904f22faffcf4d83205f4a5e7bc0c (diff) | |
download | op-kernel-dev-a4bc6926d05b60bf70aab2db2c6715e15118cbdc.zip op-kernel-dev-a4bc6926d05b60bf70aab2db2c6715e15118cbdc.tar.gz |
HID: make translation table selection more clear
Reshuffle the code a little bit so that the translation table selection
is more obvious and there is only one place performing the actual
translation using the selected table.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-apple.c')
-rw-r--r-- | drivers/hid/hid-apple.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 6c52203..8aa7175 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -167,7 +167,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, struct hid_usage *usage, __s32 value) { struct apple_sc *asc = hid_get_drvdata(hid); - const struct apple_key_translation *trans; + const struct apple_key_translation *trans, *table; if (usage->code == KEY_FN) { asc->fn_on = !!value; @@ -178,14 +178,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, if (fnmode) { int do_translate; - if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && - hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) { - trans = apple_find_translation(macbookair_fn_keys, usage->code); - } else if (hid->product < 0x21d || hid->product >= 0x300) { - trans = apple_find_translation(powerbook_fn_keys, usage->code); - } else { - trans = apple_find_translation(apple_fn_keys, usage->code); - } + if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && + hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) + table = macbookair_fn_keys; + else if (hid->product < 0x21d || hid->product >= 0x300) + table = powerbook_fn_keys; + else + table = apple_fn_keys; + + trans = apple_find_translation (table, usage->code); if (trans) { if (test_bit(usage->code, asc->pressed_fn)) |