ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()
Subsystems (2)
PATCH 1/1 ACPI: NFIT: 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.
--- drivers/acpi/nfit/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/nfit/core.c +2 -3
@@ -1737,9 +1737,8 @@ __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem)if ((nfit_mem->dsm_mask & (1 << func)) ==0 )return ; - out_obj =acpi_evaluate_dsm (handle, guid, revid, func, &in_obj); -if (!out_obj || out_obj->type !=ACPI_TYPE_BUFFER - || out_obj->buffer.length <sizeof (smart)) { + out_obj =acpi_evaluate_dsm_typed (handle, guid, revid, func, &in_obj,ACPI_TYPE_BUFFER ); +if (!out_obj || out_obj->buffer.length <sizeof (smart)) {dev_dbg (dev->parent,"%s: failed to retrieve initial health\n" ,dev_name (dev));ACPI_FREE (out_obj);
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]>
Quoted 20 lines
--- drivers/acpi/nfit/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/acpi/nfit/core.c +2
-3@@ -1737,9 +1737,8 @@ __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem)if ((nfit_mem->dsm_mask & (1 << func)) ==0 )return ; - out_obj =acpi_evaluate_dsm (handle, guid, revid, func, &in_obj); -if (!out_obj || out_obj->type !=ACPI_TYPE_BUFFER - || out_obj->buffer.length <sizeof (smart)) { + out_obj =acpi_evaluate_dsm_typed (handle, guid, revid, func, &in_obj,ACPI_TYPE_BUFFER ); +if (!out_obj || out_obj->buffer.length <sizeof (smart)) {dev_dbg (dev->parent,"%s: failed to retrieve initial health\n" ,dev_name (dev));ACPI_FREE (out_obj);
Quoted 13 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]>--- drivers/acpi/nfit/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/acpi/nfit/core.c +0
-0
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1740
Quoted 7 lines
drivers/acpi/nfit/core.c +1
-3@@ -1737,9 +1737,8 @@ __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem)if ((nfit_mem->dsm_mask & (1 << func)) ==0 )return ; - out_obj =acpi_evaluate_dsm (handle, guid, revid, func, &in_obj); -if (!out_obj || out_obj->type !=ACPI_TYPE_BUFFER - || out_obj->buffer.length <sizeof (smart)) { + out_obj =acpi_evaluate_dsm_typed (handle, guid, revid, func, &in_obj,ACPI_TYPE_BUFFER );
This line is 90 characters long, wouldn't it be better to split it ?
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1743
Quoted 3 lines
drivers/acpi/nfit/core.c +1
-0+if (!out_obj || out_obj->buffer.length <sizeof (smart)) {dev_dbg (dev->parent,"%s: failed to retrieve initial health\n" ,dev_name (dev));
While at it maybe fix alignment ? :-)
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1744
Quoted 1 line
drivers/acpi/nfit/core.c +0
-0ACPI_FREE (out_obj);
Just nitpicks, functionally code seems correct to me.
Quoted 1 line · Michal
On 10/2/2023 3:54 PM, Andy Shevchenko wrote:
...
Quoted 3 lines
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1740
Quoted 1 line
drivers/acpi/nfit/core.c +1
-0+ out_obj =acpi_evaluate_dsm_typed (handle, guid, revid, func, &in_obj,ACPI_TYPE_BUFFER );This line is 90 characters long, wouldn't it be better to split it ?
I dunno it's a problem, but if people insist, I can redo that.
...
Quoted 5 lines
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1743
Quoted 3 lines
drivers/acpi/nfit/core.c +1
-0+if (!out_obj || out_obj->buffer.length <sizeof (smart)) {dev_dbg (dev->parent,"%s: failed to retrieve initial health\n" ,dev_name (dev));While at it maybe fix alignment ? :-)
I don't think it's in scope of this change.
Quoted 4 lines
Quoted 1 line
ACPI_FREE(out_obj);Just nitpicks, functionally code seems correct to me.
Reviewed-by Michal Wilczynski <[email protected]>
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 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.
Dan, do you have any comments?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 19 lines · Michal
Quoted 16 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]>--- drivers/acpi/nfit/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/acpi/nfit/core.c +0
-0@@ -1737,9 +1737,8 @@ __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem)if ((nfit_mem->dsm_mask & (1 << func)) ==0 )return ;
Quoted 6 lines
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1740
Quoted 4 lines
drivers/acpi/nfit/core.c +1
-3- out_obj =acpi_evaluate_dsm (handle, guid, revid, func, &in_obj); -if (!out_obj || out_obj->type !=ACPI_TYPE_BUFFER - || out_obj->buffer.length <sizeof (smart)) { + out_obj =acpi_evaluate_dsm_typed (handle, guid, revid, func, &in_obj,ACPI_TYPE_BUFFER );This line is 90 characters long, wouldn't it be better to split it ?
100 characters is allowed these days.
Quoted 5 lines
drivers/acpi/nfit/core.c __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) · line 1743
Quoted 3 lines
drivers/acpi/nfit/core.c +1
-0+if (!out_obj || out_obj->buffer.length <sizeof (smart)) {dev_dbg (dev->parent,"%s: failed to retrieve initial health\n" ,dev_name (dev));While at it maybe fix alignment ? :-)
Life is too short to fiddle with indentation. For old code leave it alone, for new code just use clang-format.
Quoted 2 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.
Looks good to me.
Quoted 7 lines · Dan Williams
Quoted 2 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.Looks good to me.
Reviewed-by Dan Williams <[email protected]>
Thank you!
Who is taking care of this? Rafael?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Rafael J. Wysocki
maintainerQuoted 6 lines · Andy Shevchenko
Quoted 4 lines · Dan Williams
Quoted 2 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.
Quoted 7 lines
Quoted 3 lines
Looks good to me.
Reviewed-by Dan Williams <[email protected]>Thank you!
Who is taking care of this? Rafael?
I can apply it.
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Dan Williams
Quoted 2 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.Looks good to me.
Reviewed-by Dan Williams <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Thank you!
Who is taking care of this? Rafael?
I can apply it.
Would be nice, thank you!
Any news on this?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Rafael J. Wysocki
maintainerQuoted 16 lines · Andy Shevchenko
Quoted 14 lines · Andy Shevchenko
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Andy Shevchenko
Quoted 7 lines · Dan Williams
Quoted 2 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.Looks good to me.
Reviewed-by Dan Williams <[email protected]>Thank you!
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Who is taking care of this? Rafael?
I can apply it.
Would be nice, thank you!
Any news on this?
Fell through the cracks, sorry about that.
Applied now (as 6.9 material).
Thanks!