Skip to contentSkip to conversation

ACPI / platform: drop redundant ACPI_HANDLE check

PATCH In review Josh Cartwright 3 participants 3 messages Feb 14, 2014

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

PATCH 1/1 ACPI / platform: drop redundant ACPI_HANDLE check

The acpi_dev_pm_attach/_detach functions perform their own checks to ensure the device has an ACPI companion. It is not necessary for the caller to do so.

This mirrors what other busses with ACPI dev PM support do (i2c, spi, sdio).

Cc Len Brown <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 drivers/base/platform.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/base/platform.c +4 -7
index bc78848..e714709 100644
@@ -481,11 +481,10 @@ static int platform_drv_probe(struct device *_dev)
 	struct platform_device *dev = to_platform_device(_dev);
 	int ret;
 
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_attach(_dev, true);
+	acpi_dev_pm_attach(_dev, true);
 
 	ret = drv->probe(dev);
-	if (ret && ACPI_HANDLE(_dev))
+	if (ret)
 		acpi_dev_pm_detach(_dev, true);
 
 	if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -508,8 +507,7 @@ static int platform_drv_remove(struct device *_dev)
 	int ret;
 
 	ret = drv->remove(dev);
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_detach(_dev, true);
+	acpi_dev_pm_detach(_dev, true);
 
 	return ret;
 }
@@ -520,8 +518,7 @@ static void platform_drv_shutdown(struct device *_dev)
 	struct platform_device *dev = to_platform_device(_dev);
 
 	drv->shutdown(dev);
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_detach(_dev, true);
+	acpi_dev_pm_detach(_dev, true);
 }
 
 /**
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Josh Cartwright

The acpi_dev_pm_attach/_detach functions perform their own checks to ensure the device has an ACPI companion. It is not necessary for the caller to do so.

This mirrors what other busses with ACPI dev PM support do (i2c, spi, sdio).

Cc Len Brown <[email protected]>
Cc Rafael J. Wysocki <[email protected]>

Hi Greg,

If you want to take this, please feel free to add:

to it. If you want me to take it, please let me know.

Rafael

Quoted 43 lines
---
 drivers/base/platform.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/base/platform.c +4 -7
index bc78848..e714709 100644
@@ -481,11 +481,10 @@ static int platform_drv_probe(struct device *_dev)
 	struct platform_device *dev = to_platform_device(_dev);
 	int ret;
 
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_attach(_dev, true);
+	acpi_dev_pm_attach(_dev, true);
 
 	ret = drv->probe(dev);
-	if (ret && ACPI_HANDLE(_dev))
+	if (ret)
 		acpi_dev_pm_detach(_dev, true);
 
 	if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -508,8 +507,7 @@ static int platform_drv_remove(struct device *_dev)
 	int ret;
 
 	ret = drv->remove(dev);
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_detach(_dev, true);
+	acpi_dev_pm_detach(_dev, true);
 
 	return ret;
 }
@@ -520,8 +518,7 @@ static void platform_drv_shutdown(struct device *_dev)
 	struct platform_device *dev = to_platform_device(_dev);
 
 	drv->shutdown(dev);
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_detach(_dev, true);
+	acpi_dev_pm_detach(_dev, true);
 }
 
 /**
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#2 lore raw
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Josh Cartwright

The acpi_dev_pm_attach/_detach functions perform their own checks to ensure the device has an ACPI companion. It is not necessary for the caller to do so.

This mirrors what other busses with ACPI dev PM support do (i2c, spi, sdio).

Cc Len Brown <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Quoted 7 lines

Hi Greg,

If you want to take this, please feel free to add:

to it. If you want me to take it, please let me know.

Thanks, I'll go take it through my tree.

greg k-h