Skip to contentSkip to conversation

acer-wmi: Using zero as the first WMI instance number

PATCH In review Lee, Chun-Yi 5 participants 6 messages Jun 20, 2017 – Jun 21, 2017

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

PATCH 1/1 acer-wmi: Using zero as the first WMI instance number

Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG.

This patch changes those instance number from one to zero.

Cc Darren Hart <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Pali Rohár <[email protected]>
---
 drivers/platform/x86/acer-wmi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/acer-wmi.c +4 -4
index 79fa5ab..ef420b6 100644
@@ -700,7 +700,7 @@ struct acpi_buffer *result)
 	input.length = sizeof(struct wmab_args);
 	input.pointer = (u8 *)regbuf;
 
-	status = wmi_evaluate_method(AMW0_GUID1, 1, 1, &input, result);
+	status = wmi_evaluate_method(AMW0_GUID1, 0, 1, &input, result);
 
 	return status;
 }
@@ -965,7 +965,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
 	u32 tmp = 0;
 	acpi_status status;
 
-	status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
+	status = wmi_evaluate_method(WMID_GUID1, 0, method_id, &input, &result);
 
 	if (ACPI_FAILURE(status))
 		return status;
@@ -1275,7 +1275,7 @@ static acpi_status __init WMID_set_capabilities(void)
 	acpi_status status;
 	u32 devices;
 
-	status = wmi_query_block(WMID_GUID2, 1, &out);
+	status = wmi_query_block(WMID_GUID2, 0, &out);
 	if (ACPI_FAILURE(status))
 		return status;
 
@@ -2018,7 +2018,7 @@ static u32 get_wmid_devices(void)
 	acpi_status status;
 	u32 devices = 0;
 
-	status = wmi_query_block(WMID_GUID2, 1, &out);
+	status = wmi_query_block(WMID_GUID2, 0, &out);
 	if (ACPI_FAILURE(status))
 		return 0;
 
Signature · 1 line
2.10.2
#1 lore raw
Quoted 11 lines · Chun-Yi

Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG.

This patch changes those instance number from one to zero.

Cc Darren Hart <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Pali Rohár <[email protected]>

Looks good, Reviewed-by: Pali Rohár <[email protected]>

Quoted 44 lines
---
 drivers/platform/x86/acer-wmi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/acer-wmi.c +4 -4
index 79fa5ab..ef420b6 100644
@@ -700,7 +700,7 @@ struct acpi_buffer *result)
 	input.length = sizeof(struct wmab_args);
 	input.pointer = (u8 *)regbuf;
 
-	status = wmi_evaluate_method(AMW0_GUID1, 1, 1, &input, result);
+	status = wmi_evaluate_method(AMW0_GUID1, 0, 1, &input, result);
 
 	return status;
 }
@@ -965,7 +965,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
 	u32 tmp = 0;
 	acpi_status status;
 
-	status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
+	status = wmi_evaluate_method(WMID_GUID1, 0, method_id, &input, &result);
 
 	if (ACPI_FAILURE(status))
 		return status;
@@ -1275,7 +1275,7 @@ static acpi_status __init WMID_set_capabilities(void)
 	acpi_status status;
 	u32 devices;
 
-	status = wmi_query_block(WMID_GUID2, 1, &out);
+	status = wmi_query_block(WMID_GUID2, 0, &out);
 	if (ACPI_FAILURE(status))
 		return status;
 
@@ -2018,7 +2018,7 @@ static u32 get_wmid_devices(void)
 	acpi_status status;
 	u32 devices = 0;
 
-	status = wmi_query_block(WMID_GUID2, 1, &out);
+	status = wmi_query_block(WMID_GUID2, 0, &out);
 	if (ACPI_FAILURE(status))
 		return 0;
 
Signature · 2 lines
Pali Rohár
[email protected]
#2 lore raw
Quoted 6 lines · Pali Rohár
Quoted 5 lines · Chun-Yi

Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG.

Quoted 8 lines
Quoted 6 lines

This patch changes those instance number from one to zero.

Cc Darren Hart <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Pali Rohár <[email protected]>

Looks good, Reviewed-by: Pali Rohár <[email protected]>

Unfortunately patchwork ignores this tag.
So, in the future please:
- put a tag on a separate line
- do _not_ prepend it by any characters including white spaces (except new line :-) )

No need to resend this one.

Pushed to testing, thanks!

Quoted 49 lines
Quoted 37 lines
---
 drivers/platform/x86/acer-wmi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/acer-wmi.c +3 -3
index 79fa5ab..ef420b6 100644
@@ -700,7 +700,7 @@ struct acpi_buffer *result)
      input.length = sizeof(struct wmab_args);
      input.pointer = (u8 *)regbuf;
 
-     status = wmi_evaluate_method(AMW0_GUID1, 1, 1, &input, result);
+     status = wmi_evaluate_method(AMW0_GUID1, 0, 1, &input, result);
 
      return status;
 }
@@ -965,7 +965,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
      u32 tmp = 0;
      acpi_status status;
 
-     status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
+     status = wmi_evaluate_method(WMID_GUID1, 0, method_id, &input, &result);
 
      if (ACPI_FAILURE(status))
              return status;
@@ -1275,7 +1275,7 @@ static acpi_status __init WMID_set_capabilities(void)
      acpi_status status;
      u32 devices;
 
-     status = wmi_query_block(WMID_GUID2, 1, &out);
+     status = wmi_query_block(WMID_GUID2, 0, &out);
      if (ACPI_FAILURE(status))
              return status;
 

drivers/platform/x86/acer-wmi.c static u32 get_wmid_devices(void) · line 2024

Quoted 8 lines
drivers/platform/x86/acer-wmi.c +1 -1
@@ -2018,7 +2018,7 @@ static u32 get_wmid_devices(void)
      acpi_status status;
      u32 devices = 0;
 
-     status = wmi_query_block(WMID_GUID2, 1, &out);
+     status = wmi_query_block(WMID_GUID2, 0, &out);
      if (ACPI_FAILURE(status))
              return 0;
 

--
Pali Rohár
[email protected]

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 15 lines · On Tuesday 20 June 2017 19:22:46 Andy Shevchenko wrote:
Quoted 13 lines · Pali Rohár
Quoted 11 lines · Chun-Yi

Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG.

This patch changes those instance number from one to zero.

Cc Darren Hart <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Pali Rohár <[email protected]>
Quoted 7 lines
Quoted 1 line

Looks good, Reviewed-by: Pali Rohár <[email protected]>

Unfortunately patchwork ignores this tag.
So, in the future please:
- put a tag on a separate line
- do _not_ prepend it by any characters including white spaces (except new line :-) )

I have not known that those lines are parsed automatically. Will do it in future!

Quoted 3 lines

No need to resend this one.

Pushed to testing, thanks!

Signature · 2 lines
Pali Rohár
[email protected]
#4 lore raw
Quoted 18 lines · Pali Rohár
Quoted 17 lines · On Tuesday 20 June 2017 19:22:46 Andy Shevchenko wrote:
Quoted 14 lines · Pali Rohár
Quoted 11 lines · Chun-Yi

Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG.

This patch changes those instance number from one to zero.

Cc Darren Hart <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Pali Rohár <[email protected]>

Looks good, Reviewed-by: Pali Rohár <[email protected]>

Quoted 8 lines
Quoted 5 lines

Unfortunately patchwork ignores this tag.
So, in the future please:
- put a tag on a separate line
- do _not_ prepend it by any characters including white spaces (except new line :-) )

I have not known that those lines are parsed automatically. Will do it in future!

:-) Thanks!

For reference, Patchwork tally's such things in the patch list view:
https://patchwork.kernel.org/project/platform-driver-x86/list/

And, selfishly, the more normalized these are, the less likely Andy and I are to make mistakes manipulating them into the patches.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center
maintainer
#5 lore raw
Quoted 17 lines · Darren Hart
Quoted 16 lines · Pali Rohár
Quoted 15 lines · On Tuesday 20 June 2017 19:22:46 Andy Shevchenko wrote:
Quoted 13 lines · Pali Rohár
Quoted 11 lines · Chun-Yi

Pali Rohár found that there have some wmi query/evaluation code that they used 'one' as the first WMI instance number. But the number is indexed from zero that it's must less than the instance_count in _WDG.

This patch changes those instance number from one to zero.

Cc Darren Hart <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Pali Rohár <[email protected]>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Looks good, Reviewed-by: Pali Rohár <[email protected]>

Unfortunately patchwork ignores this tag.
So, in the future please:
- put a tag on a separate line
- do _not_ prepend it by any characters including white spaces (except new line :-) )

I see! I will also follow the rules in the future.

Quoted 4 lines
Quoted 3 lines

I have not known that those lines are parsed automatically. Will do it in future!

Quoted 8 lines

:-) Thanks!

For reference, Patchwork tally's such things in the patch list view:
https://patchwork.kernel.org/project/platform-driver-x86/list/

And, selfishly, the more normalized these are, the less likely Andy and I are to make mistakes manipulating them into the patches.

Joey Lee