public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed()
@ 2023-10-02 13:52 Andy Shevchenko
  2023-10-02 14:04 ` Mario Limonciello
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2023-10-02 13:52 UTC (permalink / raw)
  To: Rafael J. Wysocki, Mario Limonciello, linux-acpi, linux-kernel
  Cc: Rafael J. Wysocki, Len Brown, Andy Shevchenko

The acpi_evaluate_dsm_typed() provides a way to check the type of the
object evaluated by _DSM call. Use it instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/x86/s2idle.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index 08f7c6708206..7d64e655f1b8 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d
 	int ret = -EINVAL;
 
 	guid_parse(uuid, dsm_guid);
-	obj = acpi_evaluate_dsm(handle, dsm_guid, rev, 0, NULL);
 
 	/* Check if the _DSM is present and as expected. */
-	if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length == 0 ||
-	    obj->buffer.length > sizeof(u32)) {
+	obj = acpi_evaluate_dsm_typed(handle, dsm_guid, rev, 0, NULL, ACPI_TYPE_BUFFER);
+	if (!obj || obj->buffer.length == 0 || obj->buffer.length > sizeof(u32)) {
 		acpi_handle_debug(handle,
 				"_DSM UUID %s rev %d function 0 evaluation failed\n", uuid, rev);
 		goto out;
-- 
2.40.0.1.gaa8946217a0b


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

* Re: [PATCH v1 1/1] ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed()
  2023-10-02 13:52 [PATCH v1 1/1] ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
@ 2023-10-02 14:04 ` Mario Limonciello
  0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2023-10-02 14:04 UTC (permalink / raw)
  To: Andy Shevchenko, Rafael J. Wysocki, linux-acpi, linux-kernel
  Cc: Rafael J. Wysocki, Len Brown

On 10/2/2023 08:52, Andy Shevchenko wrote:
> The acpi_evaluate_dsm_typed() provides a way to check the type of the
> object evaluated by _DSM call. Use it instead of open coded variant.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
>   drivers/acpi/x86/s2idle.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index 08f7c6708206..7d64e655f1b8 100644
> --- a/drivers/acpi/x86/s2idle.c
> +++ b/drivers/acpi/x86/s2idle.c
> @@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *d
>   	int ret = -EINVAL;
>   
>   	guid_parse(uuid, dsm_guid);
> -	obj = acpi_evaluate_dsm(handle, dsm_guid, rev, 0, NULL);
>   
>   	/* Check if the _DSM is present and as expected. */
> -	if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length == 0 ||
> -	    obj->buffer.length > sizeof(u32)) {
> +	obj = acpi_evaluate_dsm_typed(handle, dsm_guid, rev, 0, NULL, ACPI_TYPE_BUFFER);
> +	if (!obj || obj->buffer.length == 0 || obj->buffer.length > sizeof(u32)) {
>   		acpi_handle_debug(handle,
>   				"_DSM UUID %s rev %d function 0 evaluation failed\n", uuid, rev);
>   		goto out;


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

end of thread, other threads:[~2023-10-02 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 13:52 [PATCH v1 1/1] ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed() Andy Shevchenko
2023-10-02 14:04 ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox