rfkill: print events when input handler is disabled/enabled
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 7 Jun 2009 10:26:52 +0000 (12:26 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 10 Jun 2009 17:27:54 +0000 (13:27 -0400)
It is useful for debugging when we know if something disabled
the in-kernel rfkill input handler.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/rfkill/core.c

index 11b7314723dfa9f66e32f1b90881b16eff8dff12..e161ebc40a3573ef0714e684900bb966ababbed9 100644 (file)
@@ -1134,7 +1134,8 @@ static int rfkill_fop_release(struct inode *inode, struct file *file)
 
 #ifdef CONFIG_RFKILL_INPUT
        if (data->input_handler)
-               atomic_dec(&rfkill_input_disabled);
+               if (atomic_dec_return(&rfkill_input_disabled) == 0)
+                       printk(KERN_DEBUG "rfkill: input handler enabled\n");
 #endif
 
        kfree(data);
@@ -1157,7 +1158,8 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
        mutex_lock(&data->mtx);
 
        if (!data->input_handler) {
-               atomic_inc(&rfkill_input_disabled);
+               if (atomic_inc_return(&rfkill_input_disabled) == 1)
+                       printk(KERN_DEBUG "rfkill: input handler disabled\n");
                data->input_handler = true;
        }