6eb9435b87
Some spinlocks are not properly initialized on ir core: [ 471.714132] BUG: spinlock bad magic on CPU#0, modprobe/1899 [ 471.719838] lock: f92a08ac, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 [ 471.727301] Pid: 1899, comm: modprobe Not tainted 2.6.33 #36 [ 471.733062] Call Trace: [ 471.735537] [<c1498793>] ? printk+0x1d/0x22 [ 471.739866] [<c12694e3>] spin_bug+0xa3/0xf0 [ 471.744224] [<c126962d>] do_raw_spin_lock+0x7d/0x160 [ 471.749364] [<f92a01ff>] ? ir_rc5_register+0x6f/0xf0 [ir_rc5_decoder] So, use static initialization for the static spinlocks, instead of the dynamic ones (currently used), as proposed by David Härdeman on one of his RFC patches. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
89 lines
2 KiB
C
89 lines
2 KiB
C
/* ir-raw-event.c - handle IR Pulse/Space event
|
|
*
|
|
* Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <media/ir-core.h>
|
|
#include <linux/spinlock.h>
|
|
|
|
/* Used to handle IR raw handler extensions */
|
|
static LIST_HEAD(rc_map_list);
|
|
static DEFINE_SPINLOCK(rc_map_lock);
|
|
|
|
static struct rc_keymap *seek_rc_map(const char *name)
|
|
{
|
|
struct rc_keymap *map = NULL;
|
|
|
|
spin_lock(&rc_map_lock);
|
|
list_for_each_entry(map, &rc_map_list, list) {
|
|
if (!strcmp(name, map->map.name)) {
|
|
spin_unlock(&rc_map_lock);
|
|
return map;
|
|
}
|
|
}
|
|
spin_unlock(&rc_map_lock);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
struct ir_scancode_table *get_rc_map(const char *name)
|
|
{
|
|
int rc = 0;
|
|
|
|
struct rc_keymap *map;
|
|
|
|
map = seek_rc_map(name);
|
|
#ifdef MODULE
|
|
if (!map) {
|
|
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) {
|
|
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;
|
|
}
|
|
EXPORT_SYMBOL_GPL(get_rc_map);
|
|
|
|
int ir_register_map(struct rc_keymap *map)
|
|
{
|
|
spin_lock(&rc_map_lock);
|
|
list_add_tail(&map->list, &rc_map_list);
|
|
spin_unlock(&rc_map_lock);
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(ir_register_map);
|
|
|
|
void ir_unregister_map(struct rc_keymap *map)
|
|
{
|
|
spin_lock(&rc_map_lock);
|
|
list_del(&map->list);
|
|
spin_unlock(&rc_map_lock);
|
|
}
|
|
EXPORT_SYMBOL_GPL(ir_unregister_map);
|
|
|
|
void rc_map_init(void)
|
|
{
|
|
spin_lock_init(&rc_map_lock);
|
|
|
|
}
|