[PATCH] ACPI: scope acpi_device_is_first_physical_node() to CONFIG_PM

Pengpeng Hou posted 1 patch 1 month ago
[PATCH] ACPI: scope acpi_device_is_first_physical_node() to CONFIG_PM
Posted by Pengpeng Hou 1 month ago
In current linux.git (1954c4f01220), the helper function
acpi_device_is_first_physical_node() is defined and declared
unconditionally. However, its only in-tree caller resides in
drivers/acpi/device_pm.c, which is built under CONFIG_PM.

Match the helper's prototype and definition to that scope by wrapping
them in #ifdef CONFIG_PM. This fixes the config-scope mismatch and
avoids unnecessary code inclusion when power management is disabled.

Signed-off-by: Pengpeng Hou <pengpeng.hou@isrc.iscas.ac.cn>
---
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@
  * Note that the caller have to provide valid @adev pointer.
  */
+#ifdef CONFIG_PM
 bool acpi_device_is_first_physical_node(struct acpi_device *adev,
 					const struct device *dev)
 {
 	return !!acpi_primary_dev_companion(adev, dev);
 }
+#endif
 
 /*
  * acpi_companion_match() - Can we match via ACPI companion device
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@
 void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
 bool acpi_device_is_enabled(const struct acpi_device *adev);
 bool acpi_device_is_present(const struct acpi_device *adev);
 bool acpi_device_is_battery(struct acpi_device *adev);
+#ifdef CONFIG_PM
 bool acpi_device_is_first_physical_node(struct acpi_device *adev,
 					const struct device *dev);
+#endif
 int acpi_bus_register_early_device(int type);