All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rfkill: Copy "all" global state to other types
@ 2015-08-24 16:01 João Paulo Rechi Vita
  2015-08-25  0:28 ` Joe Perches
  0 siblings, 1 reply; 10+ messages in thread
From: João Paulo Rechi Vita @ 2015-08-24 16:01 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless; +Cc: João Paulo Rechi Vita

When switching the state of all RFKill switches of type all we need to
replicate the RFKILL_TYPE_ALL global state to all the other types global
state, so it is used to initialize persistent RFKill switches on
register.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 net/rfkill/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index f12149a..1626e26 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -341,7 +341,14 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked)
 {
 	struct rfkill *rfkill;
 
-	rfkill_global_states[type].cur = blocked;
+	if (type == RFKILL_TYPE_ALL) {
+		enum rfkill_type i;
+		for (i = 0; i < NUM_RFKILL_TYPES; i++)
+			rfkill_global_states[i].cur = blocked;
+	} else {
+		rfkill_global_states[type].cur = blocked;
+	}
+
 	list_for_each_entry(rfkill, &rfkill_list, node) {
 		if (rfkill->type != type && type != RFKILL_TYPE_ALL)
 			continue;
-- 
2.1.4


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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-08-24 16:01 [PATCH] rfkill: Copy "all" global state to other types João Paulo Rechi Vita
@ 2015-08-25  0:28 ` Joe Perches
  2015-08-25  0:44   ` João Paulo Rechi Vita
  2015-08-25 12:56   ` João Paulo Rechi Vita
  0 siblings, 2 replies; 10+ messages in thread
From: Joe Perches @ 2015-08-25  0:28 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Johannes Berg, linux-wireless, João Paulo Rechi Vita

On Mon, 2015-08-24 at 12:01 -0400, João Paulo Rechi Vita wrote:
> When switching the state of all RFKill switches of type all we need to
> replicate the RFKILL_TYPE_ALL global state to all the other types global
> state, so it is used to initialize persistent RFKill switches on
> register.
[]
> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
[]
> @@ -341,7 +341,14 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked)
>  {
>  	struct rfkill *rfkill;
>  
> -	rfkill_global_states[type].cur = blocked;
> +	if (type == RFKILL_TYPE_ALL) {
> +		enum rfkill_type i;

Does it really make sense to use an enum here?

> +		for (i = 0; i < NUM_RFKILL_TYPES; i++)
> +			rfkill_global_states[i].cur = blocked;

increment it and then use it as an index?

Most every other loop use of NUM_RFKILL_TYPES is int



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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-08-25  0:28 ` Joe Perches
@ 2015-08-25  0:44   ` João Paulo Rechi Vita
  2015-08-25 12:56   ` João Paulo Rechi Vita
  1 sibling, 0 replies; 10+ messages in thread
From: João Paulo Rechi Vita @ 2015-08-25  0:44 UTC (permalink / raw)
  To: Joe Perches; +Cc: Johannes Berg, linux-wireless, João Paulo Rechi Vita

Hello Joe, thanks for your review.

On 24 August 2015 at 20:28, Joe Perches <joe@perches.com> wrote:
> On Mon, 2015-08-24 at 12:01 -0400, João Paulo Rechi Vita wrote:
>> When switching the state of all RFKill switches of type all we need to
>> replicate the RFKILL_TYPE_ALL global state to all the other types global
>> state, so it is used to initialize persistent RFKill switches on
>> register.
> []
>> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
> []
>> @@ -341,7 +341,14 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked)
>>  {
>>       struct rfkill *rfkill;
>>
>> -     rfkill_global_states[type].cur = blocked;
>> +     if (type == RFKILL_TYPE_ALL) {
>> +             enum rfkill_type i;
>
> Does it really make sense to use an enum here?
>
>> +             for (i = 0; i < NUM_RFKILL_TYPES; i++)
>> +                     rfkill_global_states[i].cur = blocked;
>
> increment it and then use it as an index?
>
> Most every other loop use of NUM_RFKILL_TYPES is int
>

I don't have a preference whether to the iterator here is an integer
or an enum, I've simply followed what is done in rfkill_fop_write(). I
can send an updated version.

--
João Paulo Rechi Vita
http://about.me/jprvita

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

* [PATCH] rfkill: Copy "all" global state to other types
  2015-08-25  0:28 ` Joe Perches
  2015-08-25  0:44   ` João Paulo Rechi Vita
@ 2015-08-25 12:56   ` João Paulo Rechi Vita
  2015-08-25 16:13     ` Marcel Holtmann
  2015-09-04 12:28     ` Johannes Berg
  1 sibling, 2 replies; 10+ messages in thread
From: João Paulo Rechi Vita @ 2015-08-25 12:56 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Joe Perches, João Paulo Rechi Vita

When switching the state of all RFKill switches of type all we need to
replicate the RFKILL_TYPE_ALL global state to all the other types global
state, so it is used to initialize persistent RFKill switches on
register.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 net/rfkill/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index f12149a..2c1284a 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -341,7 +341,14 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked)
 {
 	struct rfkill *rfkill;
 
-	rfkill_global_states[type].cur = blocked;
+	if (type == RFKILL_TYPE_ALL) {
+		int i;
+		for (i = 0; i < NUM_RFKILL_TYPES; i++)
+			rfkill_global_states[i].cur = blocked;
+	} else {
+		rfkill_global_states[type].cur = blocked;
+	}
+
 	list_for_each_entry(rfkill, &rfkill_list, node) {
 		if (rfkill->type != type && type != RFKILL_TYPE_ALL)
 			continue;
-- 
2.1.4


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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-08-25 12:56   ` João Paulo Rechi Vita
@ 2015-08-25 16:13     ` Marcel Holtmann
  2015-09-01 20:25       ` João Paulo Rechi Vita
  2015-09-04 12:28     ` Johannes Berg
  1 sibling, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2015-08-25 16:13 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: linux-wireless, Johannes Berg, Joe Perches, João Paulo Rechi Vita

Hi Joao Paulo,

> When switching the state of all RFKill switches of type all we need to
> replicate the RFKILL_TYPE_ALL global state to all the other types global
> state, so it is used to initialize persistent RFKill switches on
> register.
> 
> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
> ---
> net/rfkill/core.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel


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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-08-25 16:13     ` Marcel Holtmann
@ 2015-09-01 20:25       ` João Paulo Rechi Vita
  2015-09-02 17:42         ` Marcel Holtmann
  0 siblings, 1 reply; 10+ messages in thread
From: João Paulo Rechi Vita @ 2015-09-01 20:25 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, João Paulo Rechi Vita

Hello Johannes,

On 25 August 2015 at 12:13, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Joao Paulo,
>
>> When switching the state of all RFKill switches of type all we need to
>> replicate the RFKILL_TYPE_ALL global state to all the other types global
>> state, so it is used to initialize persistent RFKill switches on
>> register.
>>
>> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
>> ---
>> net/rfkill/core.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> Acked-by: Marcel Holtmann <marcel@holtmann.org>
>

Any feedback or any plans to pick this for mac80211-next (which I
understand is where it should go to be sent upstream)?

Thanks,

--
João Paulo Rechi Vita
http://about.me/jprvita

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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-09-01 20:25       ` João Paulo Rechi Vita
@ 2015-09-02 17:42         ` Marcel Holtmann
  2015-09-02 18:28           ` Johannes Berg
  0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2015-09-02 17:42 UTC (permalink / raw)
  To: João Paulo Rechi Vita
  Cc: Johannes Berg, linux-wireless, João Paulo Rechi Vita

Hi Joao,

>>> When switching the state of all RFKill switches of type all we need to
>>> replicate the RFKILL_TYPE_ALL global state to all the other types global
>>> state, so it is used to initialize persistent RFKill switches on
>>> register.
>>> 
>>> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
>>> ---
>>> net/rfkill/core.c | 9 ++++++++-
>>> 1 file changed, 8 insertions(+), 1 deletion(-)
>> 
>> Acked-by: Marcel Holtmann <marcel@holtmann.org>
>> 
> 
> Any feedback or any plans to pick this for mac80211-next (which I
> understand is where it should go to be sent upstream)?

I can take this through bluetooth-next tree if there are no objections.

Regards

Marcel


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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-09-02 17:42         ` Marcel Holtmann
@ 2015-09-02 18:28           ` Johannes Berg
  2015-09-02 18:35             ` João Paulo Rechi Vita
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2015-09-02 18:28 UTC (permalink / raw)
  To: Marcel Holtmann, João Paulo Rechi Vita
  Cc: linux-wireless, João Paulo Rechi Vita

On Wed, 2015-09-02 at 10:42 -0700, Marcel Holtmann wrote:
> 
> > Any feedback or any plans to pick this for mac80211-next (which I
> > understand is where it should go to be sent upstream)?
> 
> I can take this through bluetooth-next tree if there are no 
> objections.
> 

I'm going to to take it, but we're in the middle of release/merge
-window time, so there was no point in doing that just yet.

johannes

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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-09-02 18:28           ` Johannes Berg
@ 2015-09-02 18:35             ` João Paulo Rechi Vita
  0 siblings, 0 replies; 10+ messages in thread
From: João Paulo Rechi Vita @ 2015-09-02 18:35 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Marcel Holtmann, linux-wireless, João Paulo Rechi Vita

On 2 September 2015 at 14:28, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2015-09-02 at 10:42 -0700, Marcel Holtmann wrote:
>>
>> > Any feedback or any plans to pick this for mac80211-next (which I
>> > understand is where it should go to be sent upstream)?
>>
>> I can take this through bluetooth-next tree if there are no
>> objections.
>>
>
> I'm going to to take it, but we're in the middle of release/merge
> -window time, so there was no point in doing that just yet.
>

All right, thanks for the feedback!

--
João Paulo Rechi Vita
http://about.me/jprvita

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

* Re: [PATCH] rfkill: Copy "all" global state to other types
  2015-08-25 12:56   ` João Paulo Rechi Vita
  2015-08-25 16:13     ` Marcel Holtmann
@ 2015-09-04 12:28     ` Johannes Berg
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2015-09-04 12:28 UTC (permalink / raw)
  To: João Paulo Rechi Vita, linux-wireless
  Cc: Joe Perches, João Paulo Rechi Vita

On Tue, 2015-08-25 at 08:56 -0400, João Paulo Rechi Vita wrote:
> When switching the state of all RFKill switches of type all we need 
> to
> replicate the RFKILL_TYPE_ALL global state to all the other types 
> global
> state, so it is used to initialize persistent RFKill switches on
> register.
> 
Applied.

johannes

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

end of thread, other threads:[~2015-09-04 12:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-24 16:01 [PATCH] rfkill: Copy "all" global state to other types João Paulo Rechi Vita
2015-08-25  0:28 ` Joe Perches
2015-08-25  0:44   ` João Paulo Rechi Vita
2015-08-25 12:56   ` João Paulo Rechi Vita
2015-08-25 16:13     ` Marcel Holtmann
2015-09-01 20:25       ` João Paulo Rechi Vita
2015-09-02 17:42         ` Marcel Holtmann
2015-09-02 18:28           ` Johannes Berg
2015-09-02 18:35             ` João Paulo Rechi Vita
2015-09-04 12:28     ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.