[PATCH 02/19] pmdomain: use single implementation for dev_pm_domain_attach

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Jan 19 08:25:53 PST 2024


genpd_dev_pm_attach already has a stub definition when
!CONFIG_PM_GENERIC_DOMAINS, so we can just call it unconditionally
from dev_pm_domain_attach.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/pm_domain.h | 53 ++++++++++++++++++++-------------------------
 1 file changed, 24 insertions(+), 29 deletions(-)

diff --git a/include/pm_domain.h b/include/pm_domain.h
index ac0ec477b6b1..bf122460d0fe 100644
--- a/include/pm_domain.h
+++ b/include/pm_domain.h
@@ -30,30 +30,6 @@ void genpd_activate(void);
 
 int genpd_dev_pm_attach(struct device *dev);
 
-/**
- * dev_pm_domain_attach - Attach a device to its PM domain.
- * @dev: Device to attach.
- * @power_on: Used to indicate whether we should power on the device.
- *
- * The @dev may only be attached to a single PM domain. By iterating through
- * the available alternatives we try to find a valid PM domain for the device.
- * As attachment succeeds, the ->detach() callback in the struct dev_pm_domain
- * should be assigned by the corresponding attach function.
- *
- * This function should typically be invoked from subsystem level code during
- * the probe phase. Especially for those that holds devices which requires
- * power management through PM domains.
- *
- * Callers must ensure proper synchronization of this function with power
- * management callbacks.
- *
- * Returns 0 on successfully attached PM domain or negative error code.
- */
-static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
-{
-	return genpd_dev_pm_attach(dev);
-}
-
 int pm_genpd_init(struct generic_pm_domain *genpd, void *gov, bool is_off);
 
 int of_genpd_add_provider_simple(struct device_node *np,
@@ -87,11 +63,6 @@ static inline int genpd_dev_pm_attach(struct device *dev)
 	return 0;
 }
 
-static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
-{
-	return 0;
-}
-
 static inline int
 of_genpd_add_provider_simple(struct device_node *np,
 			     struct generic_pm_domain *genpd)
@@ -101,4 +72,28 @@ of_genpd_add_provider_simple(struct device_node *np,
 
 #endif
 
+/**
+ * dev_pm_domain_attach - Attach a device to its PM domain.
+ * @dev: Device to attach.
+ * @power_on: Used to indicate whether we should power on the device.
+ *
+ * The @dev may only be attached to a single PM domain. By iterating through
+ * the available alternatives we try to find a valid PM domain for the device.
+ * As attachment succeeds, the ->detach() callback in the struct dev_pm_domain
+ * should be assigned by the corresponding attach function.
+ *
+ * This function should typically be invoked from subsystem level code during
+ * the probe phase. Especially for those that holds devices which requires
+ * power management through PM domains.
+ *
+ * Callers must ensure proper synchronization of this function with power
+ * management callbacks.
+ *
+ * Returns 0 on successfully attached PM domain or negative error code.
+ */
+static inline int dev_pm_domain_attach(struct device *dev, bool power_on)
+{
+	return genpd_dev_pm_attach(dev);
+}
+
 #endif
-- 
2.39.2




More information about the barebox mailing list