diff options
author | David Härdeman <david@hardeman.nu> | 2010-04-02 14:58:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:56:53 -0400 |
commit | b3074c0a3f020766c05c1249a31212bff4a77bea (patch) | |
tree | 90fcff6ccd7746273810ebf7f22536855d31ff31 /include/media | |
parent | bdf1c98e4205832c07d6dedbfd0ec6eab83df358 (diff) |
V4L/DVB: drivers/media/IR - improve keytable code
The attached patch rewrites much of the keytable code in
drivers/media/IR/ir-keytable.c.
The scancodes are now inserted into the array in sorted
order which allows for a binary search on lookup.
The code has also been shrunk by about 150 lines.
In addition it fixes the following bugs:
Any use of ir_seek_table() was racy.
ir_dev->driver_name is leaked between ir_input_register() and
ir_input_unregister().
ir_setkeycode() unconditionally does clear_bit() on dev->keybit
when removing a mapping, but there might be another mapping with
a different scancode and the same keycode.
This version has been updated to incorporate patch feedback from
Mauro Carvalho Chehab.
[mchehab@redhat.com: Fix a conflict with RC keytable breakup patches and input changes]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/ir-core.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/media/ir-core.h b/include/media/ir-core.h index c6b8e179dfe0..7a0be8d4999d 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h | |||
@@ -47,7 +47,9 @@ struct ir_scancode { | |||
47 | 47 | ||
48 | struct ir_scancode_table { | 48 | struct ir_scancode_table { |
49 | struct ir_scancode *scan; | 49 | struct ir_scancode *scan; |
50 | int size; | 50 | unsigned int size; /* Max number of entries */ |
51 | unsigned int len; /* Used number of entries */ | ||
52 | unsigned int alloc; /* Size of *scan in bytes */ | ||
51 | u64 ir_type; | 53 | u64 ir_type; |
52 | char *name; | 54 | char *name; |
53 | spinlock_t lock; | 55 | spinlock_t lock; |