V4L/DVB: ir: Make sure that the spinlocks are properly initialized
authorMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 7 Apr 2010 19:19:36 +0000 (16:19 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:57:01 +0000 (12:57 -0300)
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>
drivers/media/IR/ir-nec-decoder.c
drivers/media/IR/ir-raw-event.c
drivers/media/IR/ir-rc5-decoder.c
drivers/media/IR/rc-map.c

index 9d1ada9..18918e5 100644 (file)
@@ -25,7 +25,7 @@
 
 /* Used to register nec_decoder clients */
 static LIST_HEAD(decoder_list);
-static spinlock_t decoder_lock;
+static DEFINE_SPINLOCK(decoder_lock);
 
 enum nec_state {
        STATE_INACTIVE,
index 57990a3..ddb3365 100644 (file)
@@ -21,7 +21,7 @@
 
 /* Used to handle IR raw handler extensions */
 static LIST_HEAD(ir_raw_handler_list);
-static spinlock_t ir_raw_handler_lock;
+static DEFINE_SPINLOCK(ir_raw_handler_lock);
 
 /**
  * RUN_DECODER()       - runs an operation on all IR decoders
@@ -205,8 +205,6 @@ static void init_decoders(struct work_struct *work)
 
 void ir_raw_init(void)
 {
-       spin_lock_init(&ir_raw_handler_lock);
-
 #ifdef MODULE
        INIT_WORK(&wq_load, init_decoders);
        schedule_work(&wq_load);
index a62277b..6323066 100644 (file)
@@ -29,7 +29,7 @@ static unsigned int ir_rc5_remote_gap = 888888;
 
 /* Used to register rc5_decoder clients */
 static LIST_HEAD(decoder_list);
-static spinlock_t decoder_lock;
+static DEFINE_SPINLOCK(decoder_lock);
 
 enum rc5_state {
        STATE_INACTIVE,
index 2f6201c..ff185c0 100644 (file)
@@ -17,8 +17,7 @@
 
 /* Used to handle IR raw handler extensions */
 static LIST_HEAD(rc_map_list);
-static spinlock_t rc_map_lock;
-
+static DEFINE_SPINLOCK(rc_map_lock);
 
 static struct rc_keymap *seek_rc_map(const char *name)
 {