diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-04-02 20:01:00 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 12:56:50 -0300 |
commit | 02858eedcb78a664215b918d98cdb753ce432ce6 (patch) | |
tree | dd212b7b2e63cd846a1c9cf0d9b751514648b130 /drivers/media/IR/rc-map.c | |
parent | b2245ba1644eb1eba400fd04c6e7bb3ab2d4a8fa (diff) |
V4L/DVB: ir-core: Make use of the new IR keymap modules
Instead of using the ugly keymap sequences, use the new rc-*.ko keymap
files. For now, it is still needed to have one keymap loaded, for the
RC code to work. Later patches will remove this depenency.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR/rc-map.c')
-rw-r--r-- | drivers/media/IR/rc-map.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c index 02c72f086fe0..2f6201ce1898 100644 --- a/drivers/media/IR/rc-map.c +++ b/drivers/media/IR/rc-map.c @@ -26,12 +26,14 @@ static struct rc_keymap *seek_rc_map(const char *name) spin_lock(&rc_map_lock); list_for_each_entry(map, &rc_map_list, list) { - if (!strcmp(name, map->map.name)) - break; + if (!strcmp(name, map->map.name)) { + spin_unlock(&rc_map_lock); + return map; + } } spin_unlock(&rc_map_lock); - return map; + return NULL; } struct ir_scancode_table *get_rc_map(const char *name) @@ -43,15 +45,22 @@ struct ir_scancode_table *get_rc_map(const char *name) map = seek_rc_map(name); #ifdef MODULE if (!map) { - rc = request_module("name"); - if (rc < 0) + rc = request_module(name); + if (rc < 0) { + printk(KERN_ERR "Couldn't load IR keymap %s\n", name); return NULL; + } + msleep(20); /* Give some time for IR to register */ map = seek_rc_map(name); } #endif - if (!map) + if (!map) { + printk(KERN_ERR "IR keymap %s not found\n", name); return NULL; + } + + printk(KERN_INFO "Registered IR keymap %s\n", map->map.name); return &map->map; } @@ -73,3 +82,9 @@ void ir_unregister_map(struct rc_keymap *map) spin_unlock(&rc_map_lock); } EXPORT_SYMBOL_GPL(ir_unregister_map); + +void rc_map_init(void) +{ + spin_lock_init(&rc_map_lock); + +} |