Skip to contentSkip to conversation

acer-wmi: fix rfkill conversion

PATCH In review Troy Moure 3 participants 4 messages Jun 17, 2009 – Jul 19, 2009

Subsystems (2)
lore
Share & tools
lore

Troy Moure

author
#0 lore raw

PATCH 1/1 acer-wmi: fix rfkill conversion

Commit 19d337dff95cbf76ed ("rfkill: rewrite") incorrectly reversed the meaning of 'state' in acer_rfkill_update() when it changed rfkill_force_state() to rfkill_set_sw_state(). Fix it.

---
This fixes the rfkill switch on my Acer laptop, which was behaving backwards (the state reported in the logs was the opposite of the state indicated by the LED).

 drivers/platform/x86/acer-wmi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/acer-wmi.c +2 -2
index 09a503e..be2fd6f 100644
@@ -958,12 +958,12 @@ static void acer_rfkill_update(struct work_struct *ignored)
 
 	status = get_u32(&state, ACER_CAP_WIRELESS);
 	if (ACPI_SUCCESS(status))
-		rfkill_set_sw_state(wireless_rfkill, !!state);
+		rfkill_set_sw_state(wireless_rfkill, !state);
 
 	if (has_cap(ACER_CAP_BLUETOOTH)) {
 		status = get_u32(&state, ACER_CAP_BLUETOOTH);
 		if (ACPI_SUCCESS(status))
-			rfkill_set_sw_state(bluetooth_rfkill, !!state);
+			rfkill_set_sw_state(bluetooth_rfkill, !state);
 	}
 
 	schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 9 lines · Troy Moure

Commit 19d337dff95cbf76ed ("rfkill: rewrite") incorrectly reversed the meaning of 'state' in acer_rfkill_update() when it changed rfkill_force_state() to rfkill_set_sw_state(). Fix it.

---
This fixes the rfkill switch on my Acer laptop, which was behaving backwards (the state reported in the logs was the opposite of the state indicated by the LED).

Thanks. Looks like I made this mistake a few times.

johannes

Quoted 22 lines
 drivers/platform/x86/acer-wmi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/acer-wmi.c +2 -2
index 09a503e..be2fd6f 100644
@@ -958,12 +958,12 @@ static void acer_rfkill_update(struct work_struct *ignored)
 
 	status = get_u32(&state, ACER_CAP_WIRELESS);
 	if (ACPI_SUCCESS(status))
-		rfkill_set_sw_state(wireless_rfkill, !!state);
+		rfkill_set_sw_state(wireless_rfkill, !state);
 
 	if (has_cap(ACER_CAP_BLUETOOTH)) {
 		status = get_u32(&state, ACER_CAP_BLUETOOTH);
 		if (ACPI_SUCCESS(status))
-			rfkill_set_sw_state(bluetooth_rfkill, !!state);
+			rfkill_set_sw_state(bluetooth_rfkill, !state);
 	}
 
 	schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
#2 lore raw

PATCH 1/1 acer-wmi: fix rfkill conversion

In reply to Troy Moure
Quoted 9 lines · Troy Moure

Commit 19d337dff95cbf76ed ("rfkill: rewrite") incorrectly reversed the meaning of 'state' in acer_rfkill_update() when it changed rfkill_force_state() to rfkill_set_sw_state(). Fix it.

---
This fixes the rfkill switch on my Acer laptop, which was behaving backwards (the state reported in the logs was the opposite of the state indicated by the LED).

I think there's another reversal error that you didn't notice :-). I found that acer-wmi disables the wireless when it is loaded.

The core tries to initialize the wireless to enabled, but the polarity is wrong in acer_rfkill_set(). It ends up disabling the wireless instead.

Here's a patch for it.

--->

Quoted 1 line

From 75953366b4958a77019729662a997f5d361a7529 Mon Sep 17 00:00:00 2001

From: Alan Jenkins <[email protected]>
Date: Sun, 19 Jul 2009 09:29:21 +0100
Subject: [PATCH] acer-wmi: fix rfkill conversion

Fix another polarity error introduced by the rfkill rewrite, this time in acer_rfkill_set().

---
 drivers/platform/x86/acer-wmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -1
index be2fd6f..fb45f5e 100644
@@ -973,7 +973,7 @@ static int acer_rfkill_set(void *data, bool blocked)
 {
 	acpi_status status;
 	u32 cap = (unsigned long)data;
-	status = set_u32(!!blocked, cap);
+	status = set_u32(!blocked, cap);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 	return 0;
Signature · 1 line
1.6.3.2
#3 lore raw
Quoted 5 lines · Alan Jenkins
Quoted 4 lines · Troy Moure

Commit 19d337dff95cbf76ed ("rfkill: rewrite") incorrectly reversed the meaning of 'state' in acer_rfkill_update() when it changed rfkill_force_state() to rfkill_set_sw_state(). Fix it.

Quoted 8 lines
Quoted 5 lines

---
This fixes the rfkill switch on my Acer laptop, which was behaving backwards (the state reported in the logs was the opposite of the state indicated by the LED).

I think there's another reversal error that you didn't notice :-). I found that acer-wmi disables the wireless when it is loaded.

Ahrg.

Quoted 5 lines

The core tries to initialize the wireless to enabled, but the polarity is wrong in acer_rfkill_set(). It ends up disabling the wireless instead.

Here's a patch for it.

I really should go back and audit it again, but every instance takes me about 5 minutes to do the (not state != unblocked) thing in my head ... :/

Thanks!

johannes

Quoted 27 lines

--->
From 75953366b4958a77019729662a997f5d361a7529 Mon Sep 17 00:00:00 2001
From: Alan Jenkins <[email protected]>
Date: Sun, 19 Jul 2009 09:29:21 +0100
Subject: [PATCH] acer-wmi: fix rfkill conversion

Fix another polarity error introduced by the rfkill rewrite, this time in acer_rfkill_set().

---
 drivers/platform/x86/acer-wmi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -1
index be2fd6f..fb45f5e 100644
@@ -973,7 +973,7 @@ static int acer_rfkill_set(void *data, bool blocked)
 {
 	acpi_status status;
 	u32 cap = (unsigned long)data;
-	status = set_u32(!!blocked, cap);
+	status = set_u32(!blocked, cap);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 	return 0;