Skip to contentSkip to conversation

media: atomisp_gmin_platform: Switch to use acpi_evaluate_dsm_typed()

PATCH Superseded Andy Shevchenko 2 participants 2 messages Jul 15, 2022 – Jul 17, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: atomisp_gmin_platform: 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/staging/media/atomisp/pci/atomisp_gmin_platform.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +2 -5
index bf527b366ab3..d4cfda07f7fb 100644
@@ -1207,16 +1207,13 @@ static int gmin_get_config_dsm_var(struct device *dev,
 	if (!strcmp(var, "CamClk"))
 		return -EINVAL;
 
-	obj = acpi_evaluate_dsm(handle, &atomisp_dsm_guid, 0, 0, NULL);
+	/* Return on unexpected object type */
+	obj = acpi_evaluate_dsm_typed(handle, &atomisp_dsm_guid, 0, 0, NULL, ACPI_TYPE_PACKAGE);
 	if (!obj) {
 		dev_info_once(dev, "Didn't find ACPI _DSM table.\n");
 		return -EINVAL;
 	}
 
-	/* Return on unexpected object type */
-	if (obj->type != ACPI_TYPE_PACKAGE)
-		return -EINVAL;
-
 #if 0 /* Just for debugging purposes */
 	for (i = 0; i < obj->package.count; i++) {
 		union acpi_object *cur = &obj->package.elements[i];
Signature · 1 line
2.35.1
#1 lore raw

Hi Andy,

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/staging/media/atomisp/pci/atomisp_gmin_platform.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0 -0
index bf527b366ab3..d4cfda07f7fb 100644

drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c static int gmin_get_config_dsm_var(struct device *dev, · line 1211

Quoted 6 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +2 -1
@@ -1207,16 +1207,13 @@ static int gmin_get_config_dsm_var(struct device *dev,
 	if (!strcmp(var, "CamClk"))
 		return -EINVAL;
 
-	obj = acpi_evaluate_dsm(handle, &atomisp_dsm_guid, 0, 0, NULL);
+	/* Return on unexpected object type */
+	obj = acpi_evaluate_dsm_typed(handle, &atomisp_dsm_guid, 0, 0, NULL, ACPI_TYPE_PACKAGE);

Can you please run:

	$ ./scripts/checkpatch.pl --strict --max-line-length=80

I.e. the preferred line length is 80 or less, unless there are other reasons to keep it longer.

Quoted 12 lines
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0 -4
 	if (!obj) {
 		dev_info_once(dev, "Didn't find ACPI _DSM table.\n");
 		return -EINVAL;
 	}
 
-	/* Return on unexpected object type */
-	if (obj->type != ACPI_TYPE_PACKAGE)
-		return -EINVAL;
-
 #if 0 /* Just for debugging purposes */
 	for (i = 0; i < obj->package.count; i++) {
 		union acpi_object *cur = &obj->package.elements[i];
Signature · 3 lines
Kind regards,

Sakari Ailus