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/kernel: Add __init attribute to eligible functions

Some functions defined in `arch/powerpc/kernel` (and one in `arch/powerpc/
kexec`) 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-2-nick.child@ibm.com

authored by

Nick Child and committed by
Michael Ellerman
d276960d a8968521

+69 -68
+5 -5
arch/powerpc/include/asm/btext.h
··· 23 23 24 24 extern void btext_drawchar(char c); 25 25 extern void btext_drawstring(const char *str); 26 - extern void btext_drawhex(unsigned long v); 27 - extern void btext_drawtext(const char *c, unsigned int len); 26 + void __init btext_drawhex(unsigned long v); 27 + void __init btext_drawtext(const char *c, unsigned int len); 28 28 29 - extern void btext_clearscreen(void); 30 - extern void btext_flushscreen(void); 31 - extern void btext_flushline(void); 29 + void __init btext_clearscreen(void); 30 + void __init btext_flushscreen(void); 31 + void __init btext_flushline(void); 32 32 33 33 #endif /* __KERNEL__ */ 34 34 #endif /* __PPC_BTEXT_H */
+1 -1
arch/powerpc/include/asm/eeh.h
··· 460 460 } 461 461 462 462 463 - void eeh_cache_debugfs_init(void); 463 + void __init eeh_cache_debugfs_init(void); 464 464 465 465 #endif /* CONFIG_PPC64 */ 466 466 #endif /* __KERNEL__ */
+3 -3
arch/powerpc/include/asm/fadump-internal.h
··· 137 137 }; 138 138 139 139 /* Helper functions */ 140 - s32 fadump_setup_cpu_notes_buf(u32 num_cpus); 140 + s32 __init fadump_setup_cpu_notes_buf(u32 num_cpus); 141 141 void fadump_free_cpu_notes_buf(void); 142 - u32 *fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs); 143 - void fadump_update_elfcore_header(char *bufp); 142 + u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs); 143 + void __init fadump_update_elfcore_header(char *bufp); 144 144 bool is_fadump_boot_mem_contiguous(void); 145 145 bool is_fadump_reserved_mem_contiguous(void); 146 146
+1 -1
arch/powerpc/include/asm/kexec.h
··· 84 84 extern int crash_shutdown_unregister(crash_shutdown_t handler); 85 85 86 86 extern void crash_kexec_secondary(struct pt_regs *regs); 87 - extern int overlaps_crashkernel(unsigned long start, unsigned long size); 87 + int __init overlaps_crashkernel(unsigned long start, unsigned long size); 88 88 extern void reserve_crashkernel(void); 89 89 extern void machine_kexec_mask_interrupts(void); 90 90
+1 -1
arch/powerpc/include/asm/kvm_guest.h
··· 16 16 return static_branch_unlikely(&kvm_guest); 17 17 } 18 18 19 - int check_kvm_guest(void); 19 + int __init check_kvm_guest(void); 20 20 #else 21 21 static inline bool is_kvm_guest(void) { return false; } 22 22 static inline int check_kvm_guest(void) { return 0; }
+1 -1
arch/powerpc/include/asm/pci.h
··· 48 48 } 49 49 50 50 #ifdef CONFIG_PCI 51 - extern void set_pci_dma_ops(const struct dma_map_ops *dma_ops); 51 + void __init set_pci_dma_ops(const struct dma_map_ops *dma_ops); 52 52 #else /* CONFIG_PCI */ 53 53 #define set_pci_dma_ops(d) 54 54 #endif
+2 -2
arch/powerpc/include/asm/setup.h
··· 55 55 void setup_uaccess_flush(bool enable); 56 56 void do_rfi_flush_fixups(enum l1d_flush_type types); 57 57 #ifdef CONFIG_PPC_BARRIER_NOSPEC 58 - void setup_barrier_nospec(void); 58 + void __init setup_barrier_nospec(void); 59 59 #else 60 60 static inline void setup_barrier_nospec(void) { } 61 61 #endif ··· 71 71 #endif 72 72 73 73 #ifdef CONFIG_PPC_FSL_BOOK3E 74 - void setup_spectre_v2(void); 74 + void __init setup_spectre_v2(void); 75 75 #else 76 76 static inline void setup_spectre_v2(void) {} 77 77 #endif
+4 -4
arch/powerpc/include/asm/udbg.h
··· 23 23 __attribute__ ((format (printf, 1, 2))); 24 24 extern void udbg_progress(char *s, unsigned short hex); 25 25 26 - extern void udbg_uart_init_mmio(void __iomem *addr, unsigned int stride); 27 - extern void udbg_uart_init_pio(unsigned long port, unsigned int stride); 26 + void __init udbg_uart_init_mmio(void __iomem *addr, unsigned int stride); 27 + void __init udbg_uart_init_pio(unsigned long port, unsigned int stride); 28 28 29 - extern void udbg_uart_setup(unsigned int speed, unsigned int clock); 30 - extern unsigned int udbg_probe_uart_speed(unsigned int clock); 29 + void __init udbg_uart_setup(unsigned int speed, unsigned int clock); 30 + unsigned int __init udbg_probe_uart_speed(unsigned int clock); 31 31 32 32 struct device_node; 33 33 extern void udbg_scc_init(int force_scc);
+6 -6
arch/powerpc/kernel/btext.c
··· 161 161 boot_text_mapped = 1; 162 162 } 163 163 164 - static int btext_initialize(struct device_node *np) 164 + static int __init btext_initialize(struct device_node *np) 165 165 { 166 166 unsigned int width, height, depth, pitch; 167 167 unsigned long address = 0; ··· 292 292 } 293 293 EXPORT_SYMBOL(btext_update_display); 294 294 295 - void btext_clearscreen(void) 295 + void __init btext_clearscreen(void) 296 296 { 297 297 unsigned int *base = (unsigned int *)calc_base(0, 0); 298 298 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * ··· 310 310 rmci_maybe_off(); 311 311 } 312 312 313 - void btext_flushscreen(void) 313 + void __init btext_flushscreen(void) 314 314 { 315 315 unsigned int *base = (unsigned int *)calc_base(0, 0); 316 316 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * ··· 329 329 __asm__ __volatile__ ("sync" ::: "memory"); 330 330 } 331 331 332 - void btext_flushline(void) 332 + void __init btext_flushline(void) 333 333 { 334 334 unsigned int *base = (unsigned int *)calc_base(0, g_loc_Y << 4); 335 335 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * ··· 544 544 btext_drawchar(*c++); 545 545 } 546 546 547 - void btext_drawtext(const char *c, unsigned int len) 547 + void __init btext_drawtext(const char *c, unsigned int len) 548 548 { 549 549 if (!boot_text_mapped) 550 550 return; ··· 552 552 btext_drawchar(*c++); 553 553 } 554 554 555 - void btext_drawhex(unsigned long v) 555 + void __init btext_drawhex(unsigned long v) 556 556 { 557 557 if (!boot_text_mapped) 558 558 return;
+1 -1
arch/powerpc/kernel/dt_cpu_ftrs.c
··· 344 344 return 1; 345 345 } 346 346 347 - static void hfscr_pmu_enable(void) 347 + static void __init hfscr_pmu_enable(void) 348 348 { 349 349 u64 hfscr = mfspr(SPRN_HFSCR); 350 350 hfscr |= PPC_BIT(60);
+1 -1
arch/powerpc/kernel/eeh_cache.c
··· 280 280 } 281 281 DEFINE_SHOW_ATTRIBUTE(eeh_addr_cache); 282 282 283 - void eeh_cache_debugfs_init(void) 283 + void __init eeh_cache_debugfs_init(void) 284 284 { 285 285 debugfs_create_file_unsafe("eeh_address_cache", 0400, 286 286 arch_debugfs_dir, NULL,
+9 -9
arch/powerpc/kernel/fadump.c
··· 251 251 } 252 252 253 253 /* Print firmware assisted dump configurations for debugging purpose. */ 254 - static void fadump_show_config(void) 254 + static void __init fadump_show_config(void) 255 255 { 256 256 int i; 257 257 ··· 353 353 * Calculate the total memory size required to be reserved for 354 354 * firmware-assisted dump registration. 355 355 */ 356 - static unsigned long get_fadump_area_size(void) 356 + static unsigned long __init get_fadump_area_size(void) 357 357 { 358 358 unsigned long size = 0; 359 359 ··· 462 462 * with the given memory range. 463 463 * False, otherwise. 464 464 */ 465 - static bool overlaps_reserved_ranges(u64 base, u64 end, int *idx) 465 + static bool __init overlaps_reserved_ranges(u64 base, u64 end, int *idx) 466 466 { 467 467 bool ret = false; 468 468 int i; ··· 737 737 fw_dump.ops->fadump_trigger(fdh, str); 738 738 } 739 739 740 - u32 *fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs) 740 + u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs) 741 741 { 742 742 struct elf_prstatus prstatus; 743 743 ··· 752 752 return buf; 753 753 } 754 754 755 - void fadump_update_elfcore_header(char *bufp) 755 + void __init fadump_update_elfcore_header(char *bufp) 756 756 { 757 757 struct elf_phdr *phdr; 758 758 ··· 770 770 return; 771 771 } 772 772 773 - static void *fadump_alloc_buffer(unsigned long size) 773 + static void *__init fadump_alloc_buffer(unsigned long size) 774 774 { 775 775 unsigned long count, i; 776 776 struct page *page; ··· 792 792 free_reserved_area((void *)vaddr, (void *)(vaddr + size), -1, NULL); 793 793 } 794 794 795 - s32 fadump_setup_cpu_notes_buf(u32 num_cpus) 795 + s32 __init fadump_setup_cpu_notes_buf(u32 num_cpus) 796 796 { 797 797 /* Allocate buffer to hold cpu crash notes. */ 798 798 fw_dump.cpu_notes_buf_size = num_cpus * sizeof(note_buf_t); ··· 1447 1447 } 1448 1448 1449 1449 /* Release the reserved memory and disable the FADump */ 1450 - static void unregister_fadump(void) 1450 + static void __init unregister_fadump(void) 1451 1451 { 1452 1452 fadump_cleanup(); 1453 1453 fadump_release_memory(fw_dump.reserve_dump_area_start, ··· 1547 1547 1548 1548 DEFINE_SHOW_ATTRIBUTE(fadump_region); 1549 1549 1550 - static void fadump_init_files(void) 1550 + static void __init fadump_init_files(void) 1551 1551 { 1552 1552 int rc = 0; 1553 1553
+3 -3
arch/powerpc/kernel/nvram_64.c
··· 540 540 .write = nvram_pstore_write, 541 541 }; 542 542 543 - static int nvram_pstore_init(void) 543 + static int __init nvram_pstore_init(void) 544 544 { 545 545 int rc = 0; 546 546 ··· 562 562 return rc; 563 563 } 564 564 #else 565 - static int nvram_pstore_init(void) 565 + static int __init nvram_pstore_init(void) 566 566 { 567 567 return -1; 568 568 } ··· 755 755 * Per the criteria passed via nvram_remove_partition(), should this 756 756 * partition be removed? 1=remove, 0=keep 757 757 */ 758 - static int nvram_can_remove_partition(struct nvram_partition *part, 758 + static int __init nvram_can_remove_partition(struct nvram_partition *part, 759 759 const char *name, int sig, const char *exceptions[]) 760 760 { 761 761 if (part->header.signature != sig)
+1 -1
arch/powerpc/kernel/pci-common.c
··· 62 62 63 63 static const struct dma_map_ops *pci_dma_ops; 64 64 65 - void set_pci_dma_ops(const struct dma_map_ops *dma_ops) 65 + void __init set_pci_dma_ops(const struct dma_map_ops *dma_ops) 66 66 { 67 67 pci_dma_ops = dma_ops; 68 68 }
+2 -2
arch/powerpc/kernel/pci_32.c
··· 37 37 EXPORT_SYMBOL(isa_io_base); 38 38 EXPORT_SYMBOL(pci_dram_offset); 39 39 40 - void pcibios_make_OF_bus_map(void); 40 + void __init pcibios_make_OF_bus_map(void); 41 41 42 42 static void fixup_cpc710_pci64(struct pci_dev* dev); 43 43 static u8* pci_to_OF_bus_map; ··· 109 109 } 110 110 } 111 111 112 - void 112 + void __init 113 113 pcibios_make_OF_bus_map(void) 114 114 { 115 115 int i;
+2 -2
arch/powerpc/kernel/prom.c
··· 447 447 */ 448 448 449 449 #ifdef CONFIG_SPARSEMEM 450 - static bool validate_mem_limit(u64 base, u64 *size) 450 + static bool __init validate_mem_limit(u64 base, u64 *size) 451 451 { 452 452 u64 max_mem = 1UL << (MAX_PHYSMEM_BITS); 453 453 ··· 458 458 return true; 459 459 } 460 460 #else 461 - static bool validate_mem_limit(u64 base, u64 *size) 461 + static bool __init validate_mem_limit(u64 base, u64 *size) 462 462 { 463 463 return true; 464 464 }
+6 -6
arch/powerpc/kernel/prom_init.c
··· 672 672 return call_prom("getproplen", 2, 1, node, ADDR(pname)); 673 673 } 674 674 675 - static void add_string(char **str, const char *q) 675 + static void __init add_string(char **str, const char *q) 676 676 { 677 677 char *p = *str; 678 678 ··· 682 682 *str = p; 683 683 } 684 684 685 - static char *tohex(unsigned int x) 685 + static char *__init tohex(unsigned int x) 686 686 { 687 687 static const char digits[] __initconst = "0123456789abcdef"; 688 688 static char result[9] __prombss; ··· 728 728 #define prom_islower(c) ('a' <= (c) && (c) <= 'z') 729 729 #define prom_toupper(c) (prom_islower(c) ? ((c) - 'a' + 'A') : (c)) 730 730 731 - static unsigned long prom_strtoul(const char *cp, const char **endp) 731 + static unsigned long __init prom_strtoul(const char *cp, const char **endp) 732 732 { 733 733 unsigned long result = 0, base = 10, value; 734 734 ··· 753 753 return result; 754 754 } 755 755 756 - static unsigned long prom_memparse(const char *ptr, const char **retptr) 756 + static unsigned long __init prom_memparse(const char *ptr, const char **retptr) 757 757 { 758 758 unsigned long ret = prom_strtoul(ptr, retptr); 759 759 int shift = 0; ··· 1786 1786 } 1787 1787 1788 1788 #ifdef CONFIG_PPC_SVM 1789 - static int prom_rtas_hcall(uint64_t args) 1789 + static int __init prom_rtas_hcall(uint64_t args) 1790 1790 { 1791 1791 register uint64_t arg1 asm("r3") = H_RTAS; 1792 1792 register uint64_t arg2 asm("r4") = args; ··· 3248 3248 /* 3249 3249 * Perform the Enter Secure Mode ultracall. 3250 3250 */ 3251 - static int enter_secure_mode(unsigned long kbase, unsigned long fdt) 3251 + static int __init enter_secure_mode(unsigned long kbase, unsigned long fdt) 3252 3252 { 3253 3253 register unsigned long r3 asm("r3") = UV_ESM; 3254 3254 register unsigned long r4 asm("r4") = kbase;
+3 -3
arch/powerpc/kernel/rtasd.c
··· 455 455 } 456 456 457 457 #ifdef CONFIG_PPC64 458 - static void retrieve_nvram_error_log(void) 458 + static void __init retrieve_nvram_error_log(void) 459 459 { 460 460 unsigned int err_type ; 461 461 int rc ; ··· 473 473 } 474 474 } 475 475 #else /* CONFIG_PPC64 */ 476 - static void retrieve_nvram_error_log(void) 476 + static void __init retrieve_nvram_error_log(void) 477 477 { 478 478 } 479 479 #endif /* CONFIG_PPC64 */ 480 480 481 - static void start_event_scan(void) 481 + static void __init start_event_scan(void) 482 482 { 483 483 printk(KERN_DEBUG "RTAS daemon started\n"); 484 484 pr_debug("rtasd: will sleep for %d milliseconds\n",
+2 -2
arch/powerpc/kernel/security.c
··· 44 44 do_barrier_nospec_fixups(enable); 45 45 } 46 46 47 - void setup_barrier_nospec(void) 47 + void __init setup_barrier_nospec(void) 48 48 { 49 49 bool enable; 50 50 ··· 132 132 #endif /* CONFIG_PPC_FSL_BOOK3E || CONFIG_PPC_BOOK3S_64 */ 133 133 134 134 #ifdef CONFIG_PPC_FSL_BOOK3E 135 - void setup_spectre_v2(void) 135 + void __init setup_spectre_v2(void) 136 136 { 137 137 if (no_spectrev2 || cpu_mitigations_off()) 138 138 do_btb_flush_fixups();
+1 -1
arch/powerpc/kernel/setup_64.c
··· 499 499 * routines and/or provided to userland 500 500 */ 501 501 502 - static void init_cache_info(struct ppc_cache_info *info, u32 size, u32 lsize, 502 + static void __init init_cache_info(struct ppc_cache_info *info, u32 size, u32 lsize, 503 503 u32 bsize, u32 sets) 504 504 { 505 505 info->size = size;
+3 -2
arch/powerpc/kernel/smp.c
··· 936 936 return tg; 937 937 } 938 938 939 - static int update_mask_from_threadgroup(cpumask_var_t *mask, struct thread_groups *tg, int cpu, int cpu_group_start) 939 + static int __init update_mask_from_threadgroup(cpumask_var_t *mask, struct thread_groups *tg, 940 + int cpu, int cpu_group_start) 940 941 { 941 942 int first_thread = cpu_first_thread_sibling(cpu); 942 943 int i; ··· 1683 1682 } 1684 1683 #endif 1685 1684 1686 - static void fixup_topology(void) 1685 + static void __init fixup_topology(void) 1687 1686 { 1688 1687 int i; 1689 1688
+5 -5
arch/powerpc/kernel/sysfs.c
··· 214 214 static DEVICE_ATTR(dscr_default, 0600, 215 215 show_dscr_default, store_dscr_default); 216 216 217 - static void sysfs_create_dscr_default(void) 217 + static void __init sysfs_create_dscr_default(void) 218 218 { 219 219 if (cpu_has_feature(CPU_FTR_DSCR)) { 220 220 int cpu; ··· 744 744 } 745 745 static DEVICE_ATTR(svm, 0444, show_svm, NULL); 746 746 747 - static void create_svm_file(void) 747 + static void __init create_svm_file(void) 748 748 { 749 749 device_create_file(cpu_subsys.dev_root, &dev_attr_svm); 750 750 } 751 751 #else 752 - static void create_svm_file(void) 752 + static void __init create_svm_file(void) 753 753 { 754 754 } 755 755 #endif /* CONFIG_PPC_SVM */ ··· 1110 1110 /* NUMA stuff */ 1111 1111 1112 1112 #ifdef CONFIG_NUMA 1113 - static void register_nodes(void) 1113 + static void __init register_nodes(void) 1114 1114 { 1115 1115 int i; 1116 1116 ··· 1134 1134 EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); 1135 1135 1136 1136 #else 1137 - static void register_nodes(void) 1137 + static void __init register_nodes(void) 1138 1138 { 1139 1139 return; 1140 1140 }
+5 -5
arch/powerpc/kernel/udbg_16550.c
··· 84 84 return udbg_uart_in(UART_RBR); 85 85 } 86 86 87 - static void udbg_use_uart(void) 87 + static void __init udbg_use_uart(void) 88 88 { 89 89 udbg_putc = udbg_uart_putc; 90 90 udbg_flush = udbg_uart_flush; ··· 92 92 udbg_getc_poll = udbg_uart_getc_poll; 93 93 } 94 94 95 - void udbg_uart_setup(unsigned int speed, unsigned int clock) 95 + void __init udbg_uart_setup(unsigned int speed, unsigned int clock) 96 96 { 97 97 unsigned int dll, base_bauds; 98 98 ··· 121 121 udbg_uart_out(UART_FCR, 0x7); 122 122 } 123 123 124 - unsigned int udbg_probe_uart_speed(unsigned int clock) 124 + unsigned int __init udbg_probe_uart_speed(unsigned int clock) 125 125 { 126 126 unsigned int dll, dlm, divisor, prescaler, speed; 127 127 u8 old_lcr; ··· 172 172 outb(data, udbg_uart.pio_base + (reg * udbg_uart_stride)); 173 173 } 174 174 175 - void udbg_uart_init_pio(unsigned long port, unsigned int stride) 175 + void __init udbg_uart_init_pio(unsigned long port, unsigned int stride) 176 176 { 177 177 if (!port) 178 178 return; ··· 194 194 } 195 195 196 196 197 - void udbg_uart_init_mmio(void __iomem *addr, unsigned int stride) 197 + void __init udbg_uart_init_mmio(void __iomem *addr, unsigned int stride) 198 198 { 199 199 if (!addr) 200 200 return;
+1 -1
arch/powerpc/kexec/core.c
··· 185 185 } 186 186 } 187 187 188 - int overlaps_crashkernel(unsigned long start, unsigned long size) 188 + int __init overlaps_crashkernel(unsigned long start, unsigned long size) 189 189 { 190 190 return (start + size) > crashk_res.start && start <= crashk_res.end; 191 191 }