aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-11-03 10:42:02 -0400
committerJiri Kosina <jkosina@suse.cz>2010-11-03 10:42:02 -0400
commita4bc6926d05b60bf70aab2db2c6715e15118cbdc (patch)
tree8b75de49e968ff6870a66ffaddfc1e5c18964530 /drivers/hid
parent99b9f758bbc904f22faffcf4d83205f4a5e7bc0c (diff)
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')
-rw-r--r--drivers/hid/hid-apple.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 6c52203cdbdf..8aa71750a23c 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,
167 struct hid_usage *usage, __s32 value) 167 struct hid_usage *usage, __s32 value)
168{ 168{
169 struct apple_sc *asc = hid_get_drvdata(hid); 169 struct apple_sc *asc = hid_get_drvdata(hid);
170 const struct apple_key_translation *trans; 170 const struct apple_key_translation *trans, *table;
171 171
172 if (usage->code == KEY_FN) { 172 if (usage->code == KEY_FN) {
173 asc->fn_on = !!value; 173 asc->fn_on = !!value;
@@ -178,14 +178,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
178 if (fnmode) { 178 if (fnmode) {
179 int do_translate; 179 int do_translate;
180 180
181 if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && 181 if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
182 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) { 182 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
183 trans = apple_find_translation(macbookair_fn_keys, usage->code); 183 table = macbookair_fn_keys;
184 } else if (hid->product < 0x21d || hid->product >= 0x300) { 184 else if (hid->product < 0x21d || hid->product >= 0x300)
185 trans = apple_find_translation(powerbook_fn_keys, usage->code); 185 table = powerbook_fn_keys;
186 } else { 186 else
187 trans = apple_find_translation(apple_fn_keys, usage->code); 187 table = apple_fn_keys;
188 } 188
189 trans = apple_find_translation (table, usage->code);
189 190
190 if (trans) { 191 if (trans) {
191 if (test_bit(usage->code, asc->pressed_fn)) 192 if (test_bit(usage->code, asc->pressed_fn))