platform: x86: Remove acpi_has_method() call in wmi.c
diff mbox series

Message ID 20190722031158.70311-1-skunberg.kelsey@gmail.com
State In Next
Commit bad9da86f9f10a2e68a1574dd34edde6f8556d5f
Headers show
Series
  • platform: x86: Remove acpi_has_method() call in wmi.c
Related show

Commit Message

Kelsey Skunberg July 22, 2019, 3:11 a.m. UTC
acpi_has_method() is unnecessary within __query_block() and should be
removed to avoid extra work.

wc_status is initialized to AE_ERROR before the acpi_has_method() call.
acpi_has_method() and acpi_execute_simple_method() failing due to the
method not existing will result in the same outcome from __query_block().

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
---
 drivers/platform/x86/wmi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Andy Shevchenko July 25, 2019, 5:58 p.m. UTC | #1
On Mon, Jul 22, 2019 at 6:13 AM Kelsey Skunberg
<skunberg.kelsey@gmail.com> wrote:
>
> acpi_has_method() is unnecessary within __query_block() and should be
> removed to avoid extra work.
>
> wc_status is initialized to AE_ERROR before the acpi_has_method() call.
> acpi_has_method() and acpi_execute_simple_method() failing due to the
> method not existing will result in the same outcome from __query_block().
>

Pushed to my review and testing queue, thanks!

> Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> ---
>  drivers/platform/x86/wmi.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 784cea8572c2..59e9aa0f9643 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -340,9 +340,7 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance,
>                  * expensive, but have no corresponding WCxx method. So we
>                  * should not fail if this happens.
>                  */
> -               if (acpi_has_method(handle, wc_method))
> -                       wc_status = acpi_execute_simple_method(handle,
> -                                                               wc_method, 1);
> +               wc_status = acpi_execute_simple_method(handle, wc_method, 1);
>         }
>
>         strcpy(method, "WQ");
> --
> 2.20.1
>

Patch
diff mbox series

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 784cea8572c2..59e9aa0f9643 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -340,9 +340,7 @@  static acpi_status __query_block(struct wmi_block *wblock, u8 instance,
 		 * expensive, but have no corresponding WCxx method. So we
 		 * should not fail if this happens.
 		 */
-		if (acpi_has_method(handle, wc_method))
-			wc_status = acpi_execute_simple_method(handle,
-								wc_method, 1);
+		wc_status = acpi_execute_simple_method(handle, wc_method, 1);
 	}
 
 	strcpy(method, "WQ");