Skip to contentSkip to conversation

usb: acpi: Switch to use acpi_evaluate_dsm_typed()

PATCH Superseded Andy Shevchenko 2 participants 5 messages Jan 18, 2023 – Jan 20, 2023 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: acpi: 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/usb/core/usb-acpi.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/usb/core/usb-acpi.c +4 -8
index 533baa85083c..a34b22537d7c 100644
@@ -81,15 +81,11 @@ int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index)
 		return -ENODEV;
 	}
 
-	obj = acpi_evaluate_dsm(port_handle, &guid, 0,
-				USB_DSM_DISABLE_U1_U2_FOR_PORT, NULL);
-
-	if (!obj)
-		return -ENODEV;
-
-	if (obj->type != ACPI_TYPE_INTEGER) {
+	obj = acpi_evaluate_dsm_typed(port_handle, &guid, 0,
+				      USB_DSM_DISABLE_U1_U2_FOR_PORT, NULL,
+				      ACPI_TYPE_INTEGER);
+	if (!obj) {
 		dev_dbg(&hdev->dev, "evaluate port-%d _DSM failed\n", port1);
-		ACPI_FREE(obj);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.39.0
#1 lore raw
Quoted 35 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/usb/core/usb-acpi.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/usb/core/usb-acpi.c +4 -8
index 533baa85083c..a34b22537d7c 100644
@@ -81,15 +81,11 @@ int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index)
 		return -ENODEV;
 	}
 
-	obj = acpi_evaluate_dsm(port_handle, &guid, 0,
-				USB_DSM_DISABLE_U1_U2_FOR_PORT, NULL);
-
-	if (!obj)
-		return -ENODEV;
-
-	if (obj->type != ACPI_TYPE_INTEGER) {
+	obj = acpi_evaluate_dsm_typed(port_handle, &guid, 0,
+				      USB_DSM_DISABLE_U1_U2_FOR_PORT, NULL,
+				      ACPI_TYPE_INTEGER);
+	if (!obj) {
 		dev_dbg(&hdev->dev, "evaluate port-%d _DSM failed\n", port1);
-		ACPI_FREE(obj);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.39.0

Fails to apply to my tree :(

#2 lore raw
Quoted 3 lines · Greg Kroah-Hartman
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 1 line

Fails to apply to my tree :(

It seems it's against usb-linus as Mathias' original patch is there.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 3 lines · Greg Kroah-Hartman
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 1 line

Fails to apply to my tree :(

It seems it's against usb-linus as Mathias' original patch is there.

Ah, then that can wait until it merges into my usb-next branch. Can you resend it in a week or so when that happens?

thanks,

greg k-h

#4 lore raw
Quoted 3 lines · Greg Kroah-Hartman
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Greg Kroah-Hartman

On Wed, Jan 18, 2023 at 10:04:19AM +0200, Andy Shevchenko wrote:

...

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Fails to apply to my tree :(

It seems it's against usb-linus as Mathias' original patch is there.

Ah, then that can wait until it merges into my usb-next branch. Can you resend it in a week or so when that happens?

Sure, thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko