rfkill: print events when input handler is disabled/enabled
Johannes Berg
maintainerPATCH 1/1 rfkill: print events when input handler is disabled/enabled
It is useful for debugging when we know if something disabled the in-kernel rfkill input handler.
--- net/rfkill/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/rfkill/core.c +4 -2
@@ -1134,7 +1134,8 @@ static int rfkill_fop_release(struct ino#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 filemutex_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; }
Hi Johannes,
Quoted 21 lines
It is useful for debugging when we know if something disabled the in-kernel rfkill input handler.
Signed-off-by Johannes Berg <[email protected]>--- net/rfkill/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)net/rfkill/core.c +2
-1@@ -1134,7 +1134,8 @@ static int rfkill_fop_release(struct ino#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);
net/rfkill/core.c static long rfkill_fop_ioctl(struct file · line 1164
Quoted 8 lines
net/rfkill/core.c +2
-1@@ -1157,7 +1158,8 @@ static long rfkill_fop_ioctl(struct filemutex_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; }
do you really think the == 1 is the correct thing here. I think that should be a > 0.
Regards
Marcel
Johannes Berg
maintainerQuoted 9 lines · Marcel Holtmann
net/rfkill/core.c static long rfkill_fop_ioctl(struct file · line 1164
Quoted 6 lines
net/rfkill/core.c +2
-1if (!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; }do you really think the == 1 is the correct thing here. I think that should be a > 0.
Why would you want to know every time somebody uses the ioctl? I think the first time should be sufficient, no? Common case will hopefully be only one program using it anyway though.
johannes
Marcel Holtmann
Acked-byHi Johannes,
Quoted 10 lines
Quoted 9 lines
net/rfkill/core.c static long rfkill_fop_ioctl(struct file · line 1164
Quoted 6 lines
net/rfkill/core.c +2
-1if (!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; }do you really think the == 1 is the correct thing here. I think that should be a > 0.
Quoted 3 lines
Why would you want to know every time somebody uses the ioctl? I think the first time should be sufficient, no? Common case will hopefully be only one program using it anyway though.
you are right, we only care about the printk once. No need to keep printing it on every change.
Regard
Marcel