linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: rfkill: gpio: Fix clock status
@ 2014-09-16 12:53 Loic Poulain
  2014-09-17 15:11 ` John W. Linville
  0 siblings, 1 reply; 3+ messages in thread
From: Loic Poulain @ 2014-09-16 12:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Loic Poulain

Clock is disabled when the device is blocked.
So, clock_enabled is the logical negation of "blocked".

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
---
 net/rfkill/rfkill-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 14c98e4..408e51f 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -54,7 +54,7 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
 	if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled)
 		clk_disable(rfkill->clk);
 
-	rfkill->clk_enabled = blocked;
+	rfkill->clk_enabled = !blocked;
 
 	return 0;
 }
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: rfkill: gpio: Fix clock status
  2014-09-16 12:53 [PATCH] net: rfkill: gpio: Fix clock status Loic Poulain
@ 2014-09-17 15:11 ` John W. Linville
  2014-09-17 15:34   ` Loic Poulain
  0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2014-09-17 15:11 UTC (permalink / raw)
  To: Loic Poulain; +Cc: johannes, linux-wireless

On Tue, Sep 16, 2014 at 02:53:58PM +0200, Loic Poulain wrote:
> Clock is disabled when the device is blocked.
> So, clock_enabled is the logical negation of "blocked".
> 
> Signed-off-by: Loic Poulain <loic.poulain@intel.com>
> ---
>  net/rfkill/rfkill-gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> index 14c98e4..408e51f 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -54,7 +54,7 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
>  	if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled)
>  		clk_disable(rfkill->clk);
>  
> -	rfkill->clk_enabled = blocked;
> +	rfkill->clk_enabled = !blocked;
>  
>  	return 0;
>  }

This looks like the right fix, but...the code has been that way for
a long time.  If this patch is correct, how has this gone undetected
for so long?

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: rfkill: gpio: Fix clock status
  2014-09-17 15:11 ` John W. Linville
@ 2014-09-17 15:34   ` Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2014-09-17 15:34 UTC (permalink / raw)
  To: John W. Linville; +Cc: johannes, linux-wireless

If rfkill block/unblock are balanced, the following conditions are never 
true:
- if (!blocked && !rfkill->clk_enabled)
- if (blocked && rfkill->clk_enabled)

Then, clock is neither disabled nor enabled.
If clock is enabled by default, it does not cause any obvious issue.

Or maybe there's not much device with clock resource.

Regards,
Loic

On 17/09/2014 17:11, John W. Linville wrote:
> On Tue, Sep 16, 2014 at 02:53:58PM +0200, Loic Poulain wrote:
>> Clock is disabled when the device is blocked.
>> So, clock_enabled is the logical negation of "blocked".
>>
>> Signed-off-by: Loic Poulain <loic.poulain@intel.com>
>> ---
>>   net/rfkill/rfkill-gpio.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
>> index 14c98e4..408e51f 100644
>> --- a/net/rfkill/rfkill-gpio.c
>> +++ b/net/rfkill/rfkill-gpio.c
>> @@ -54,7 +54,7 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
>>   	if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled)
>>   		clk_disable(rfkill->clk);
>>   
>> -	rfkill->clk_enabled = blocked;
>> +	rfkill->clk_enabled = !blocked;
>>   
>>   	return 0;
>>   }
> This looks like the right fix, but...the code has been that way for
> a long time.  If this patch is correct, how has this gone undetected
> for so long?
>
> John

-- 
Intel Open Source Technology Center
http://oss.intel.com/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-17 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-16 12:53 [PATCH] net: rfkill: gpio: Fix clock status Loic Poulain
2014-09-17 15:11 ` John W. Linville
2014-09-17 15:34   ` Loic Poulain

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).