[PATCH] PM / clk: Fix broken build due to non-matching code and header #ifdefs
From: Geert Uytterhoeven
Date: Mon Oct 19 2015 - 04:17:41 EST
If an architecture's main Kconfig file doesn't include
kernel/power/Kconfig, but CONFIG_PM=y and HAVE_CLK=y (e.g. m68knommu
allmodconfig):
drivers/base/power/clock_ops.c: In function â__pm_clk_addâ:
drivers/base/power/clock_ops.c:106: error: âstruct pm_subsys_dataâ has no member named âclock_listâ
drivers/base/power/clock_ops.c: At top level:
drivers/base/power/clock_ops.c:120: error: redefinition of âpm_clk_addâ
include/linux/pm_clock.h:64: error: previous definition of âpm_clk_addâ was here
drivers/base/power/clock_ops.c:135: error: redefinition of âpm_clk_add_clkâ
include/linux/pm_clock.h:69: error: previous definition of âpm_clk_add_clkâ was here
drivers/base/power/clock_ops.c:171: error: redefinition of âpm_clk_removeâ
include/linux/pm_clock.h:73: error: previous definition of âpm_clk_removeâ was here
drivers/base/power/clock_ops.c: In function âpm_clk_removeâ:
drivers/base/power/clock_ops.c:180: error: âstruct pm_subsys_dataâ has no member named âclock_listâ
drivers/base/power/clock_ops.c:180: error: âstruct pm_subsys_dataâ has no member named âclock_listâ
drivers/base/power/clock_ops.c: At top level:
drivers/base/power/clock_ops.c:207: error: redefinition of âpm_clk_initâ
include/linux/pm_clock.h:54: error: previous definition of âpm_clk_initâ was here
drivers/base/power/clock_ops.c: In function âpm_clk_initâ:
drivers/base/power/clock_ops.c:210: error: âstruct pm_subsys_dataâ has no member named âclock_listâ
drivers/base/power/clock_ops.c: At top level:
drivers/base/power/clock_ops.c:221: error: redefinition of âpm_clk_createâ
include/linux/pm_clock.h:57: error: previous definition of âpm_clk_createâ was here
drivers/base/power/clock_ops.c:234: error: redefinition of âpm_clk_destroyâ
include/linux/pm_clock.h:61: error: previous definition of âpm_clk_destroyâ was here
drivers/base/power/clock_ops.c: In function âpm_clk_destroyâ:
drivers/base/power/clock_ops.c:246: error: âstruct pm_subsys_dataâ has no member named âclock_listâ
drivers/base/power/clock_ops.c:246: error: âstruct pm_subsys_dataâ has no member named âclock_listâ
drivers/base/power/clock_ops.c: At top level:
drivers/base/power/clock_ops.c:263: error: expected identifier or â(â before âvoidâ
drivers/base/power/clock_ops.c:263: error: expected â)â before numeric constant
drivers/base/power/clock_ops.c:293: error: expected identifier or â(â before âvoidâ
drivers/base/power/clock_ops.c:293: error: expected â)â before numeric constant
drivers/base/power/clock_ops.c: In function âpm_clk_runtime_suspendâ:
drivers/base/power/clock_ops.c:384: error: called object â0uâ is not a function
drivers/base/power/clock_ops.c: In function âpm_clk_runtime_resumeâ:
drivers/base/power/clock_ops.c:400: error: called object â0uâ is not a function
This happens because:
- drivers/base/power/clock_ops.c depends on CONFIG_HAVE_CLK,
- the failing code inside clock_ops.c additionally depends on
CONFIG_PM,
- the forward declarations and other definitions in <linux/pm_clock.h>
depend on CONFIG_PM_CLK,
- CONFIG_PM_CLK is defined as PM && HAVE_CLK in kernel/power/Kconfig,
but it is not included on all architectures.
Fix this by protecting the failing code inside clock_ops.c by
CONFIG_PM_CLK instead of CONFIG_PM, so it matches <linux/pm_clock.h>.
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
Probably m68knommu should start including kernel/power/Kconfig, but
this patch fixes an inconsistency anyway.
drivers/base/power/clock_ops.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 652b5a367c1f37fd..fd0973b922a75086 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -17,7 +17,7 @@
#include <linux/err.h>
#include <linux/pm_runtime.h>
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_CLK
enum pce_status {
PCE_STATUS_NONE = 0,
@@ -404,7 +404,7 @@ int pm_clk_runtime_resume(struct device *dev)
return pm_generic_runtime_resume(dev);
}
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_CLK */
/**
* enable_clock - Enable a device clock.
@@ -484,7 +484,7 @@ static int pm_clk_notify(struct notifier_block *nb,
return 0;
}
-#endif /* !CONFIG_PM */
+#endif /* !CONFIG_PM_CLK */
/**
* pm_clk_add_notifier - Add bus type notifier for power management clocks.
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/