Skip to contentSkip to conversation

PM: Fix build warnings for unusual configs

PATCH New Rafael J. Wysocki 1 participant 3 messages Jul 11, 2012

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

cover PM: Fix build warnings for unusual configs

Hi all,

The following two patches fix build warnings for unusual combinations of .config options.

[1/2] Fix build warnings in drivers/base/power/domain.c for CONFIG_PM_RUNTIME
unset.
[2/2] Fix build warning in drivers/base/power/sysfs.c for CONFIG_PM_SLEEP unset.

Thanks,
Rafael

#1 lore raw

PATCH 1/2 PM / Domains: Fix build warning for CONFIG_PM_RUNTIME unset

From: Rafael J. Wysocki <[email protected]>

The functions genpd_save_dev() and genpd_restore_dev() are not used for CONFIG_PM_RUNTIME unset, so move them under an appropriate #ifdef.

---
 drivers/base/power/domain.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/base/power/domain.c +13 -13
Index: linux/drivers/base/power/domain.c
===================================================================
@@ -75,19 +75,6 @@ static int genpd_start_dev(struct generi
 					start_latency_ns, "start");
 }
 
-static int genpd_save_dev(struct generic_pm_domain *genpd, struct device *dev)
-{
-	return GENPD_DEV_TIMED_CALLBACK(genpd, int, save_state, dev,
-					save_state_latency_ns, "state save");
-}
-
-static int genpd_restore_dev(struct generic_pm_domain *genpd, struct device *dev)
-{
-	return GENPD_DEV_TIMED_CALLBACK(genpd, int, restore_state, dev,
-					restore_state_latency_ns,
-					"state restore");
-}
-
 static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
 {
 	bool ret = false;
@@ -275,6 +262,19 @@ int pm_genpd_poweron(struct generic_pm_d
 
 #ifdef CONFIG_PM_RUNTIME
 
+static int genpd_save_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_TIMED_CALLBACK(genpd, int, save_state, dev,
+					save_state_latency_ns, "state save");
+}
+
+static int genpd_restore_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+	return GENPD_DEV_TIMED_CALLBACK(genpd, int, restore_state, dev,
+					restore_state_latency_ns,
+					"state restore");
+}
+
 static int genpd_dev_pm_qos_notifier(struct notifier_block *nb,
 				     unsigned long val, void *ptr)
 {
#2 lore raw

PATCH 2/2 PM / Sleep: Fix build warning in sysfs.c for CONFIG_PM_SLEEP unset

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The power/async device sysfs attribute is only used if both CONFIG_PM_ADVANCED_DEBUG and CONFIG_PM_SLEEP are set, but the code implementing it doesn't depend on CONFIG_PM_SLEEP. As a result, a build warning appears if CONFIG_PM_ADVANCED_DEBUG is set and CONFIG_PM_SLEEP is not set.

Fix it by adding a #ifdef CONFIG_PM_SLEEP around the code in question.

---
 drivers/base/power/sysfs.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/base/power/sysfs.c +4 -0
Index: linux/drivers/base/power/sysfs.c
===================================================================
@@ -474,6 +474,8 @@ static DEVICE_ATTR(runtime_enabled, 0444
 
 #endif
 
+#ifdef CONFIG_PM_SLEEP
+
 static ssize_t async_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
 {
@@ -500,6 +502,8 @@ static ssize_t async_store(struct device
 }
 
 static DEVICE_ATTR(async, 0644, async_show, async_store);
+
+#endif
 #endif /* CONFIG_PM_ADVANCED_DEBUG */
 
 static struct attribute *power_attrs[] = {