ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed()
PATCH 1/1 ACPI: x86: s2idle: Switch to use acpi_evaluate_dsm_typed()
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 <[email protected]>
--- drivers/acpi/x86/s2idle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/x86/s2idle.c +2 -3
@@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *dint 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;
Signature · 1 line
2.40.0.1.gaa8946217a0b
Quoted 4 lines · Andy Shevchenko
The
acpi_evaluate_dsm_typed()provides a way to check the type of the object evaluated by_DSMcall. Use it instead of open coded variant.Signed-off-by Andy Shevchenko <[email protected]>
Reviewed-by Mario Limonciello <[email protected]>
Quoted 22 lines
--- drivers/acpi/x86/s2idle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/acpi/x86/s2idle.c +2
-3@@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *dint 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;
Quoted 8 lines · Mario Limonciello
Quoted 4 lines · Andy Shevchenko
The
acpi_evaluate_dsm_typed()provides a way to check the type of the object evaluated by_DSMcall. Use it instead of open coded variant.Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Mario Limonciello <[email protected]>
Applied as 6.7 material, thanks!
Quoted 23 lines
Quoted 22 lines
--- drivers/acpi/x86/s2idle.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/acpi/x86/s2idle.c +2
-3@@ -417,11 +417,10 @@ static int validate_dsm(acpi_handle handle, const char *uuid, int rev, guid_t *dint 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;