Skip to contentSkip to conversation

mmc: sdhci-pci: Switch to use acpi_evaluate_dsm_typed()

PATCH In review Andy Shevchenko 3 participants 3 messages Oct 2, 2023 – Oct 10, 2023

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

PATCH 1/1 mmc: sdhci-pci: 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/mmc/host/sdhci-pci-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +3 -2
index 7c14feb5db77..025b31aa712c 100644
@@ -483,11 +483,12 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
 	int err = 0;
 	size_t len;
 
-	obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL);
+	obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL,
+				      ACPI_TYPE_BUFFER);
 	if (!obj)
 		return -EOPNOTSUPP;
 
-	if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < 1) {
+	if (obj->buffer.length < 1) {
 		err = -EINVAL;
 		goto out;
 	}
Signature · 1 line
2.40.0.1.gaa8946217a0b
maintainer Acked-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 23 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +3 -2
index 7c14feb5db77..025b31aa712c 100644
@@ -483,11 +483,12 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
 	int err = 0;
 	size_t len;
 
-	obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL);
+	obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL,
+				      ACPI_TYPE_BUFFER);
 	if (!obj)
 		return -EOPNOTSUPP;
 
-	if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < 1) {
+	if (obj->buffer.length < 1) {
 		err = -EINVAL;
 		goto out;
 	}
#2 lore raw
In reply to Andy Shevchenko
Quoted 5 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.

Applied for next, thanks!

Kind regards
Uffe

Quoted 26 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +3 -3
index 7c14feb5db77..025b31aa712c 100644
@@ -483,11 +483,12 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
        int err = 0;
        size_t len;
 
-       obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL);
+       obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL,
+                                     ACPI_TYPE_BUFFER);
        if (!obj)
                return -EOPNOTSUPP;
 
-       if (obj->type != ACPI_TYPE_BUFFER || obj->buffer.length < 1) {
+       if (obj->buffer.length < 1) {
                err = -EINVAL;
                goto out;
        }
--

2.40.0.1.gaa8946217a0b