Commit a6175616 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Rafael J. Wysocki

PM / clk: Fix broken build due to non-matching code and header #ifdefs

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 32b88194
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment