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

From: Pavel Machek
Date: Mon Oct 19 2015 - 04:49:05 EST


On Mon 2015-10-19 10:16:07, Geert Uytterhoeven wrote:
> 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>

Acked-by: Pavel Machek <pavel@xxxxxx>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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/