Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/lib: Add __init attribute to eligible functions

Some functions defined in 'arch/powerpc/lib' are deserving of an `__init`
macro attribute. These functions are only called by other initialization
functions and therefore should inherit the attribute.
Also, change function declarations in header files to include `__init`.

Signed-off-by: Nick Child <nick.child@ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211216220035.605465-3-nick.child@ibm.com

authored by

Nick Child and committed by
Michael Ellerman
ce0c6be9 d276960d

+15 -15
+1 -1
arch/powerpc/include/asm/setup.h
··· 75 75 #else 76 76 static inline void setup_spectre_v2(void) {} 77 77 #endif 78 - void do_btb_flush_fixups(void); 78 + void __init do_btb_flush_fixups(void); 79 79 80 80 #endif /* !__ASSEMBLY__ */ 81 81
+1 -1
arch/powerpc/lib/code-patching.c
··· 397 397 398 398 #ifdef CONFIG_CODE_PATCHING_SELFTEST 399 399 400 - static int instr_is_branch_to_addr(const u32 *instr, unsigned long addr) 400 + static int __init instr_is_branch_to_addr(const u32 *instr, unsigned long addr) 401 401 { 402 402 if (instr_is_branch_iform(ppc_inst_read(instr)) || 403 403 instr_is_branch_bform(ppc_inst_read(instr)))
+13 -13
arch/powerpc/lib/feature-fixups.c
··· 580 580 printk(KERN_DEBUG "barrier-nospec: patched %d locations\n", i); 581 581 } 582 582 583 - static void patch_btb_flush_section(long *curr) 583 + static void __init patch_btb_flush_section(long *curr) 584 584 { 585 585 unsigned int *start, *end; 586 586 ··· 592 592 } 593 593 } 594 594 595 - void do_btb_flush_fixups(void) 595 + void __init do_btb_flush_fixups(void) 596 596 { 597 597 long *start, *end; 598 598 ··· 621 621 } 622 622 } 623 623 624 - static void do_final_fixups(void) 624 + static void __init do_final_fixups(void) 625 625 { 626 626 #if defined(CONFIG_PPC64) && defined(CONFIG_RELOCATABLE) 627 627 ppc_inst_t inst; ··· 715 715 /* This must be after the text it fixes up, vmlinux.lds.S enforces that atm */ 716 716 static struct fixup_entry fixup; 717 717 718 - static long calc_offset(struct fixup_entry *entry, unsigned int *p) 718 + static long __init calc_offset(struct fixup_entry *entry, unsigned int *p) 719 719 { 720 720 return (unsigned long)p - (unsigned long)entry; 721 721 } 722 722 723 - static void test_basic_patching(void) 723 + static void __init test_basic_patching(void) 724 724 { 725 725 extern unsigned int ftr_fixup_test1[]; 726 726 extern unsigned int end_ftr_fixup_test1[]; ··· 751 751 check(memcmp(ftr_fixup_test1, ftr_fixup_test1_expected, size) == 0); 752 752 } 753 753 754 - static void test_alternative_patching(void) 754 + static void __init test_alternative_patching(void) 755 755 { 756 756 extern unsigned int ftr_fixup_test2[]; 757 757 extern unsigned int end_ftr_fixup_test2[]; ··· 784 784 check(memcmp(ftr_fixup_test2, ftr_fixup_test2_expected, size) == 0); 785 785 } 786 786 787 - static void test_alternative_case_too_big(void) 787 + static void __init test_alternative_case_too_big(void) 788 788 { 789 789 extern unsigned int ftr_fixup_test3[]; 790 790 extern unsigned int end_ftr_fixup_test3[]; ··· 810 810 check(memcmp(ftr_fixup_test3, ftr_fixup_test3_orig, size) == 0); 811 811 } 812 812 813 - static void test_alternative_case_too_small(void) 813 + static void __init test_alternative_case_too_small(void) 814 814 { 815 815 extern unsigned int ftr_fixup_test4[]; 816 816 extern unsigned int end_ftr_fixup_test4[]; ··· 856 856 check(memcmp(ftr_fixup_test5, ftr_fixup_test5_expected, size) == 0); 857 857 } 858 858 859 - static void test_alternative_case_with_external_branch(void) 859 + static void __init test_alternative_case_with_external_branch(void) 860 860 { 861 861 extern unsigned int ftr_fixup_test6[]; 862 862 extern unsigned int end_ftr_fixup_test6[]; ··· 866 866 check(memcmp(ftr_fixup_test6, ftr_fixup_test6_expected, size) == 0); 867 867 } 868 868 869 - static void test_alternative_case_with_branch_to_end(void) 869 + static void __init test_alternative_case_with_branch_to_end(void) 870 870 { 871 871 extern unsigned int ftr_fixup_test7[]; 872 872 extern unsigned int end_ftr_fixup_test7[]; ··· 876 876 check(memcmp(ftr_fixup_test7, ftr_fixup_test7_expected, size) == 0); 877 877 } 878 878 879 - static void test_cpu_macros(void) 879 + static void __init test_cpu_macros(void) 880 880 { 881 881 extern u8 ftr_fixup_test_FTR_macros[]; 882 882 extern u8 ftr_fixup_test_FTR_macros_expected[]; ··· 888 888 ftr_fixup_test_FTR_macros_expected, size) == 0); 889 889 } 890 890 891 - static void test_fw_macros(void) 891 + static void __init test_fw_macros(void) 892 892 { 893 893 #ifdef CONFIG_PPC64 894 894 extern u8 ftr_fixup_test_FW_FTR_macros[]; ··· 902 902 #endif 903 903 } 904 904 905 - static void test_lwsync_macros(void) 905 + static void __init test_lwsync_macros(void) 906 906 { 907 907 extern u8 lwsync_fixup_test[]; 908 908 extern u8 end_lwsync_fixup_test[];