* [PATCH] rfkill: properly assign a boolean type
@ 2011-09-16 13:33 Mohammed Shafi Shajakhan
2011-09-16 13:37 ` Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: Mohammed Shafi Shajakhan @ 2011-09-16 13:33 UTC (permalink / raw)
To: linville; +Cc: johannes, linux-wireless, Mohammed Shafi Shajakhan
From: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
---
net/rfkill/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index be90640..5be1957 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
else
rfkill->state &= ~RFKILL_BLOCK_HW;
*change = prev != blocked;
- any = rfkill->state & RFKILL_BLOCK_ANY;
+ any = !!(rfkill->state & RFKILL_BLOCK_ANY);
spin_unlock_irqrestore(&rfkill->lock, flags);
rfkill_led_trigger_event(rfkill);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 13:33 [PATCH] rfkill: properly assign a boolean type Mohammed Shafi Shajakhan
@ 2011-09-16 13:37 ` Johannes Berg
2011-09-16 13:53 ` mohammed
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2011-09-16 13:37 UTC (permalink / raw)
To: Mohammed Shafi Shajakhan; +Cc: linville, linux-wireless
On Fri, 2011-09-16 at 19:03 +0530, Mohammed Shafi Shajakhan wrote:
> From: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
>
> Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
> ---
> net/rfkill/core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
> index be90640..5be1957 100644
> --- a/net/rfkill/core.c
> +++ b/net/rfkill/core.c
> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
> else
> rfkill->state &= ~RFKILL_BLOCK_HW;
> *change = prev != blocked;
> - any = rfkill->state & RFKILL_BLOCK_ANY;
> + any = !!(rfkill->state & RFKILL_BLOCK_ANY);
I believe this is not necessary since "any" is a "bool" and as such
should cast correctly to 0/1.
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 13:37 ` Johannes Berg
@ 2011-09-16 13:53 ` mohammed
2011-09-16 14:01 ` Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: mohammed @ 2011-09-16 13:53 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
On Friday 16 September 2011 07:07 PM, Johannes Berg wrote:
> On Fri, 2011-09-16 at 19:03 +0530, Mohammed Shafi Shajakhan wrote:
>> From: Mohammed Shafi Shajakhan<mohammed@qca.qualcomm.com>
>>
>> Signed-off-by: Mohammed Shafi Shajakhan<mohammed@qca.qualcomm.com>
>> ---
>> net/rfkill/core.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
>> index be90640..5be1957 100644
>> --- a/net/rfkill/core.c
>> +++ b/net/rfkill/core.c
>> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
>> else
>> rfkill->state&= ~RFKILL_BLOCK_HW;
>> *change = prev != blocked;
>> - any = rfkill->state& RFKILL_BLOCK_ANY;
>> + any = !!(rfkill->state& RFKILL_BLOCK_ANY);
>
> I believe this is not necessary since "any" is a "bool" and as such
> should cast correctly to 0/1.
Hi johannes,
I agree the older one works perfectly fine. I stumbled upon this when i
was trying to understand rfkill. but will not this change make it look
better ? if it looks like a too trivial please drop it. Thanks!
>
> johannes
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 13:53 ` mohammed
@ 2011-09-16 14:01 ` Johannes Berg
2011-09-16 14:02 ` mohammed
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2011-09-16 14:01 UTC (permalink / raw)
To: mohammed; +Cc: linville, linux-wireless
On Fri, 2011-09-16 at 19:23 +0530, mohammed wrote:
> >> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
> >> else
> >> rfkill->state&= ~RFKILL_BLOCK_HW;
> >> *change = prev != blocked;
> >> - any = rfkill->state& RFKILL_BLOCK_ANY;
> >> + any = !!(rfkill->state& RFKILL_BLOCK_ANY);
> >
> > I believe this is not necessary since "any" is a "bool" and as such
> > should cast correctly to 0/1.
> I agree the older one works perfectly fine. I stumbled upon this when i
> was trying to understand rfkill. but will not this change make it look
> better ? if it looks like a too trivial please drop it. Thanks!
Sure, whatever, I don't care; we can change it, but I think it'll
generate exactly the same code :)
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 14:01 ` Johannes Berg
@ 2011-09-16 14:02 ` mohammed
2011-09-16 14:08 ` Johannes Berg
0 siblings, 1 reply; 8+ messages in thread
From: mohammed @ 2011-09-16 14:02 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
On Friday 16 September 2011 07:31 PM, Johannes Berg wrote:
> On Fri, 2011-09-16 at 19:23 +0530, mohammed wrote:
>
>>>> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
>>>> else
>>>> rfkill->state&= ~RFKILL_BLOCK_HW;
>>>> *change = prev != blocked;
>>>> - any = rfkill->state& RFKILL_BLOCK_ANY;
>>>> + any = !!(rfkill->state& RFKILL_BLOCK_ANY);
>>>
>>> I believe this is not necessary since "any" is a "bool" and as such
>>> should cast correctly to 0/1.
>
>> I agree the older one works perfectly fine. I stumbled upon this when i
>> was trying to understand rfkill. but will not this change make it look
>> better ? if it looks like a too trivial please drop it. Thanks!
>
> Sure, whatever, I don't care; we can change it, but I think it'll
> generate exactly the same code :)
oh ok, thanks.
>
> johannes
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 14:02 ` mohammed
@ 2011-09-16 14:08 ` Johannes Berg
2011-09-16 14:11 ` mohammed
2011-09-16 14:26 ` mohammed
0 siblings, 2 replies; 8+ messages in thread
From: Johannes Berg @ 2011-09-16 14:08 UTC (permalink / raw)
To: mohammed; +Cc: linville, linux-wireless
On Fri, 2011-09-16 at 19:32 +0530, mohammed wrote:
> On Friday 16 September 2011 07:31 PM, Johannes Berg wrote:
> > On Fri, 2011-09-16 at 19:23 +0530, mohammed wrote:
> >
> >>>> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
> >>>> else
> >>>> rfkill->state&= ~RFKILL_BLOCK_HW;
> >>>> *change = prev != blocked;
> >>>> - any = rfkill->state& RFKILL_BLOCK_ANY;
> >>>> + any = !!(rfkill->state& RFKILL_BLOCK_ANY);
> >>>
> >>> I believe this is not necessary since "any" is a "bool" and as such
> >>> should cast correctly to 0/1.
> >
> >> I agree the older one works perfectly fine. I stumbled upon this when i
> >> was trying to understand rfkill. but will not this change make it look
> >> better ? if it looks like a too trivial please drop it. Thanks!
> >
> > Sure, whatever, I don't care; we can change it, but I think it'll
> > generate exactly the same code :)
>
> oh ok, thanks.
Sure. I just wanted to clarify that it was to make the coder nicer, not
to fix a bug or so.
johannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 14:08 ` Johannes Berg
@ 2011-09-16 14:11 ` mohammed
2011-09-16 14:26 ` mohammed
1 sibling, 0 replies; 8+ messages in thread
From: mohammed @ 2011-09-16 14:11 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
On Friday 16 September 2011 07:38 PM, Johannes Berg wrote:
> On Fri, 2011-09-16 at 19:32 +0530, mohammed wrote:
>> On Friday 16 September 2011 07:31 PM, Johannes Berg wrote:
>>> On Fri, 2011-09-16 at 19:23 +0530, mohammed wrote:
>>>
>>>>>> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
>>>>>> else
>>>>>> rfkill->state&= ~RFKILL_BLOCK_HW;
>>>>>> *change = prev != blocked;
>>>>>> - any = rfkill->state& RFKILL_BLOCK_ANY;
>>>>>> + any = !!(rfkill->state& RFKILL_BLOCK_ANY);
>>>>>
>>>>> I believe this is not necessary since "any" is a "bool" and as such
>>>>> should cast correctly to 0/1.
>>>
>>>> I agree the older one works perfectly fine. I stumbled upon this when i
>>>> was trying to understand rfkill. but will not this change make it look
>>>> better ? if it looks like a too trivial please drop it. Thanks!
>>>
>>> Sure, whatever, I don't care; we can change it, but I think it'll
>>> generate exactly the same code :)
>>
>> oh ok, thanks.
>
> Sure. I just wanted to clarify that it was to make the coder nicer, not
> to fix a bug or so.
no it does not fixes any bug :) thanks a lot for reviewing.
>
> johannes
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] rfkill: properly assign a boolean type
2011-09-16 14:08 ` Johannes Berg
2011-09-16 14:11 ` mohammed
@ 2011-09-16 14:26 ` mohammed
1 sibling, 0 replies; 8+ messages in thread
From: mohammed @ 2011-09-16 14:26 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
On Friday 16 September 2011 07:38 PM, Johannes Berg wrote:
> On Fri, 2011-09-16 at 19:32 +0530, mohammed wrote:
>> On Friday 16 September 2011 07:31 PM, Johannes Berg wrote:
>>> On Fri, 2011-09-16 at 19:23 +0530, mohammed wrote:
>>>
>>>>>> @@ -235,7 +235,7 @@ static bool __rfkill_set_hw_state(struct rfkill *rfkill,
>>>>>> else
>>>>>> rfkill->state&= ~RFKILL_BLOCK_HW;
>>>>>> *change = prev != blocked;
>>>>>> - any = rfkill->state& RFKILL_BLOCK_ANY;
>>>>>> + any = !!(rfkill->state& RFKILL_BLOCK_ANY);
>>>>>
>>>>> I believe this is not necessary since "any" is a "bool" and as such
>>>>> should cast correctly to 0/1.
>>>
>>>> I agree the older one works perfectly fine. I stumbled upon this when i
>>>> was trying to understand rfkill. but will not this change make it look
>>>> better ? if it looks like a too trivial please drop it. Thanks!
>>>
>>> Sure, whatever, I don't care; we can change it, but I think it'll
>>> generate exactly the same code :)
>>
>> oh ok, thanks.
>
> Sure. I just wanted to clarify that it was to make the coder nicer, not
> to fix a bug or so.
actually, I was trying to figure out why software rfkill overrides
hardware rfkill when the card is not inbuilt with the laptop. have not
tested with all the cards.
i have tested with ath9k and another one, where i can simply unblock
with software unblock command even though the card is hardblocked. this
does not seems to be the case when the card is inbuilt(i tested with in
an inbuilt iwlagn in lenovo, it works properly). not sure its driver
bug, i need to verify ath9k card that comes inbuilt with the laptop. if
you have any thoughts please let me know. i dont have the complete
understanding of rfkill. thought of doing more ground work before
asking. thanks.
>
> johannes
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-09-16 14:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-16 13:33 [PATCH] rfkill: properly assign a boolean type Mohammed Shafi Shajakhan
2011-09-16 13:37 ` Johannes Berg
2011-09-16 13:53 ` mohammed
2011-09-16 14:01 ` Johannes Berg
2011-09-16 14:02 ` mohammed
2011-09-16 14:08 ` Johannes Berg
2011-09-16 14:11 ` mohammed
2011-09-16 14:26 ` mohammed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).