Skip to contentSkip to conversation

classmate-laptop: add missing input_sync call

PATCH Applied Herton Ronaldo Krzesinski 3 participants 5 messages Nov 30, 2010 – Dec 6, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 classmate-laptop: add missing input_sync call

Add missing input_sync call in cmpc_keys_handler function.

Cc Thadeu Lima de Souza Cascardo <[email protected]>
---
 drivers/platform/x86/classmate-laptop.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/platform/x86/classmate-laptop.c +1 -0
index 341cbfe..b714c6a 100644
@@ -655,6 +655,7 @@ static void cmpc_keys_handler(struct acpi_device *dev, u32 event)
 		code = cmpc_keys_codes[event & 0x0F];
 	inputdev = dev_get_drvdata(&dev->dev);;
 	input_report_key(inputdev, code, !(event & 0x10));
+	input_sync(inputdev);
 }
 
 static void cmpc_keys_idev_init(struct input_dev *inputdev)
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 2/2 classmate-laptop: little optimization for cmpc_rfkill_block

We don't need to call bios/acpi (cmpc_set_rfkill_wlan) if the blocked state is already set to the same value (little optimization). This can happen for example if we initialize the module with same initial hardware state (rfkill core always call cmpc_rfkill_block on initialization here).

Also GWRI method only accepts 0 or 1 for setting rfkill block, as can be seen on AML code from acpidump->DSDT from a classmate sample I have, so should be fine setting state only to 0 or 1 directly.

Cc Thadeu Lima de Souza Cascardo <[email protected]>
---
 drivers/platform/x86/classmate-laptop.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/platform/x86/classmate-laptop.c +9 -7
index b714c6a..51ec5f5 100644
@@ -522,18 +522,20 @@ static int cmpc_rfkill_block(void *data, bool blocked)
 	acpi_status status;
 	acpi_handle handle;
 	unsigned long long state;
+	bool is_blocked;
 
 	handle = data;
 	status = cmpc_get_rfkill_wlan(handle, &state);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
-	if (blocked)
-		state &= ~1;
-	else
-		state |= 1;
-	status = cmpc_set_rfkill_wlan(handle, state);
-	if (ACPI_FAILURE(status))
-		return -ENODEV;
+	/* Check if we really need to call cmpc_set_rfkill_wlan */
+	is_blocked = state & 1 ? false : true;
+	if (is_blocked != blocked) {
+		state = blocked ? 0 : 1;
+		status = cmpc_set_rfkill_wlan(handle, state);
+		if (ACPI_FAILURE(status))
+			return -ENODEV;
+	}
 	return 0;
 }
 
Signature · 1 line
1.7.3.2
maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block

Quoted 51 lines · Herton Ronaldo Krzesinski

We don't need to call bios/acpi (cmpc_set_rfkill_wlan) if the blocked state is already set to the same value (little optimization). This can happen for example if we initialize the module with same initial hardware state (rfkill core always call cmpc_rfkill_block on initialization here).

Also GWRI method only accepts 0 or 1 for setting rfkill block, as can be seen on AML code from acpidump->DSDT from a classmate sample I have, so should be fine setting state only to 0 or 1 directly.

Cc Thadeu Lima de Souza Cascardo <[email protected]>
---
 drivers/platform/x86/classmate-laptop.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/platform/x86/classmate-laptop.c +9 -7
index b714c6a..51ec5f5 100644
@@ -522,18 +522,20 @@ static int cmpc_rfkill_block(void *data, bool blocked)
 	acpi_status status;
 	acpi_handle handle;
 	unsigned long long state;
+	bool is_blocked;
 
 	handle = data;
 	status = cmpc_get_rfkill_wlan(handle, &state);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
-	if (blocked)
-		state &= ~1;
-	else
-		state |= 1;
-	status = cmpc_set_rfkill_wlan(handle, state);
-	if (ACPI_FAILURE(status))
-		return -ENODEV;
+	/* Check if we really need to call cmpc_set_rfkill_wlan */
+	is_blocked = state & 1 ? false : true;
+	if (is_blocked != blocked) {
+		state = blocked ? 0 : 1;
+		status = cmpc_set_rfkill_wlan(handle, state);
+		if (ACPI_FAILURE(status))
+			return -ENODEV;
+	}
 	return 0;
 }
 
Signature · 1 line
1.7.3.2
maintainer Acked-by on v1 1/2
#3 lore raw
In reply to Herton Ronaldo Krzesinski
Quoted 23 lines · Herton Ronaldo Krzesinski

Add missing input_sync call in cmpc_keys_handler function.

Cc Thadeu Lima de Souza Cascardo <[email protected]>
---
 drivers/platform/x86/classmate-laptop.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/platform/x86/classmate-laptop.c +1 -0
index 341cbfe..b714c6a 100644
@@ -655,6 +655,7 @@ static void cmpc_keys_handler(struct acpi_device *dev, u32 event)
 		code = cmpc_keys_codes[event & 0x0F];
 	inputdev = dev_get_drvdata(&dev->dev);;
 	input_report_key(inputdev, code, !(event & 0x10));
+	input_sync(inputdev);
 }
 
 static void cmpc_keys_idev_init(struct input_dev *inputdev)
Signature · 1 line
1.7.3.2