Skip to contentSkip to conversation

ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

PATCH In review Andy Shevchenko 5 participants 11 messages Oct 2, 2023 – Feb 2, 2024 1 message not in the archive

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

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
index f96bf32cd368..280da408c02c 100644
@@ -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
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · 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.

Quoted 20 lines
---
 drivers/acpi/nfit/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/nfit/core.c +2 -3
index f96bf32cd368..280da408c02c 100644
@@ -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);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Andy Shevchenko
Quoted 13 lines · 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.

---
 drivers/acpi/nfit/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/nfit/core.c +0 -0
index f96bf32cd368..280da408c02c 100644

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 -0
 		ACPI_FREE(out_obj);

Just nitpicks, functionally code seems correct to me.

#3 lore raw
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.

Thank you!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
In reply to Wilczynski, Michal
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 _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 +0 -0
index f96bf32cd368..280da408c02c 100644
@@ -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.

#5 lore raw
In reply to Andy Shevchenko
Quoted 2 lines · 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.

Dan, do you have any comments?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw
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 _DSM call. Use it instead of open coded variant.

Looks good to me.

Thank you!

Who is taking care of this? Rafael?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw
Quoted 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 _DSM call. Use it instead of open coded variant.

Quoted 7 lines
Quoted 3 lines

Looks good to me.

Thank you!

Who is taking care of this? Rafael?

I can apply it.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
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 _DSM call. Use it instead of open coded variant.

Looks good to me.

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
#11 lore raw
Quoted 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 _DSM call. Use it instead of open coded variant.

Looks good to me.

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!