All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] classmate-laptop: add missing input_sync call
@ 2010-11-30 18:30 Herton Ronaldo Krzesinski
  2010-11-30 18:30 ` [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block Herton Ronaldo Krzesinski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Herton Ronaldo Krzesinski @ 2010-11-30 18:30 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: Matthew Garrett, Thadeu Lima de Souza Cascardo,
	Herton Ronaldo Krzesinski

Add missing input_sync call in cmpc_keys_handler function.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
---
 drivers/platform/x86/classmate-laptop.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index 341cbfe..b714c6a 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -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)
-- 
1.7.3.2

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

* [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block
  2010-11-30 18:30 [PATCH 1/2] classmate-laptop: add missing input_sync call Herton Ronaldo Krzesinski
@ 2010-11-30 18:30 ` Herton Ronaldo Krzesinski
  2010-11-30 18:54   ` Thadeu Lima de Souza Cascardo
  2010-11-30 18:50 ` [PATCH 1/2] classmate-laptop: add missing input_sync call Thadeu Lima de Souza Cascardo
  2010-12-06 22:03 ` Matthew Garrett
  2 siblings, 1 reply; 5+ messages in thread
From: Herton Ronaldo Krzesinski @ 2010-11-30 18:30 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: Matthew Garrett, Thadeu Lima de Souza Cascardo,
	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.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
---
 drivers/platform/x86/classmate-laptop.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index b714c6a..51ec5f5 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -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;
 }
 
-- 
1.7.3.2

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

* Re: [PATCH 1/2] classmate-laptop: add missing input_sync call
  2010-11-30 18:30 [PATCH 1/2] classmate-laptop: add missing input_sync call Herton Ronaldo Krzesinski
  2010-11-30 18:30 ` [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block Herton Ronaldo Krzesinski
@ 2010-11-30 18:50 ` Thadeu Lima de Souza Cascardo
  2010-12-06 22:03 ` Matthew Garrett
  2 siblings, 0 replies; 5+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2010-11-30 18:50 UTC (permalink / raw)
  To: Herton Ronaldo Krzesinski; +Cc: platform-driver-x86, Matthew Garrett

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

On Tue, Nov 30, 2010 at 04:30:42PM -0200, Herton Ronaldo Krzesinski wrote:
> Add missing input_sync call in cmpc_keys_handler function.
> 
> Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
> Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
> ---
>  drivers/platform/x86/classmate-laptop.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
> index 341cbfe..b714c6a 100644
> --- a/drivers/platform/x86/classmate-laptop.c
> +++ b/drivers/platform/x86/classmate-laptop.c
> @@ -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)
> -- 
> 1.7.3.2
> 

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block
  2010-11-30 18:30 ` [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block Herton Ronaldo Krzesinski
@ 2010-11-30 18:54   ` Thadeu Lima de Souza Cascardo
  0 siblings, 0 replies; 5+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2010-11-30 18:54 UTC (permalink / raw)
  To: Herton Ronaldo Krzesinski; +Cc: platform-driver-x86, Matthew Garrett

[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]

On Tue, Nov 30, 2010 at 04:30:43PM -0200, Herton Ronaldo Krzesinski wrote:
> 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.
> 
> Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
> Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
> ---
>  drivers/platform/x86/classmate-laptop.c |   16 +++++++++-------
>  1 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
> index b714c6a..51ec5f5 100644
> --- a/drivers/platform/x86/classmate-laptop.c
> +++ b/drivers/platform/x86/classmate-laptop.c
> @@ -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;
>  }
>  
> -- 
> 1.7.3.2
> 

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 1/2] classmate-laptop: add missing input_sync call
  2010-11-30 18:30 [PATCH 1/2] classmate-laptop: add missing input_sync call Herton Ronaldo Krzesinski
  2010-11-30 18:30 ` [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block Herton Ronaldo Krzesinski
  2010-11-30 18:50 ` [PATCH 1/2] classmate-laptop: add missing input_sync call Thadeu Lima de Souza Cascardo
@ 2010-12-06 22:03 ` Matthew Garrett
  2 siblings, 0 replies; 5+ messages in thread
From: Matthew Garrett @ 2010-12-06 22:03 UTC (permalink / raw)
  To: Herton Ronaldo Krzesinski
  Cc: platform-driver-x86, Thadeu Lima de Souza Cascardo

Applied these to -next, thanks.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

end of thread, other threads:[~2010-12-06 22:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30 18:30 [PATCH 1/2] classmate-laptop: add missing input_sync call Herton Ronaldo Krzesinski
2010-11-30 18:30 ` [PATCH 2/2] classmate-laptop: little optimization for cmpc_rfkill_block Herton Ronaldo Krzesinski
2010-11-30 18:54   ` Thadeu Lima de Souza Cascardo
2010-11-30 18:50 ` [PATCH 1/2] classmate-laptop: add missing input_sync call Thadeu Lima de Souza Cascardo
2010-12-06 22:03 ` Matthew Garrett

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.