Skip to content

Commit d94b93a

Browse files
arndbkees
authored andcommitted
ARM: cpuidle: Avoid orphan section warning
Since commit 83109d5 ("x86/build: Warn on orphan section placement"), we get a warning for objects in orphan sections. The cpuidle implementation for OMAP causes this when CONFIG_CPU_IDLE is disabled: arm-linux-gnueabi-ld: warning: orphan section `__cpuidle_method_of_table' from `arch/arm/mach-omap2/pm33xx-core.o' being placed in section `__cpuidle_method_of_table' arm-linux-gnueabi-ld: warning: orphan section `__cpuidle_method_of_table' from `arch/arm/mach-omap2/pm33xx-core.o' being placed in section `__cpuidle_method_of_table' arm-linux-gnueabi-ld: warning: orphan section `__cpuidle_method_of_table' from `arch/arm/mach-omap2/pm33xx-core.o' being placed in section `__cpuidle_method_of_table' Change the definition of CPUIDLE_METHOD_OF_DECLARE() to silently drop the table and all code referenced from it when CONFIG_CPU_IDLE is disabled. Fixes: 06ee7a9 ("ARM: OMAP2+: pm33xx-core: Add cpuidle_ops for am335x/am437x") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Miguel Ojeda <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d07f6ca commit d94b93a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/arm/include/asm/cpuidle.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
#ifdef CONFIG_CPU_IDLE
88
extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
99
struct cpuidle_driver *drv, int index);
10+
#define __cpuidle_method_section __used __section("__cpuidle_method_of_table")
1011
#else
1112
static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
1213
struct cpuidle_driver *drv, int index) { return -ENODEV; }
14+
#define __cpuidle_method_section __maybe_unused /* drop silently */
1315
#endif
1416

1517
/* Common ARM WFI state */
@@ -42,8 +44,7 @@ struct of_cpuidle_method {
4244

4345
#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
4446
static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
45-
__used __section("__cpuidle_method_of_table") \
46-
= { .method = _method, .ops = _ops }
47+
__cpuidle_method_section = { .method = _method, .ops = _ops }
4748

4849
extern int arm_cpuidle_suspend(int index);
4950

0 commit comments

Comments
 (0)