Skip to content

Commit

Permalink
treewide: Convert macro and uses of __section(foo) to __section("foo")
Browse files Browse the repository at this point in the history
Use a more generic form for __section that requires quotes to avoid
complications with clang and gcc differences.

Remove the quote operator # from compiler_attributes.h __section macro.

Convert all unquoted __section(foo) uses to quoted __section("foo").
Also convert __attribute__((section("foo"))) uses to __section("foo")
even if the __attribute__ has multiple list entry forms.

Conversion done using the script at:

    https://lore.kernel.org/lkml/[email protected]/2-convert_section.pl

Signed-off-by: Joe Perches <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Reviewed-by: Miguel Ojeda <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Oct 25, 2020
1 parent 986b9ea commit 33def84
Show file tree
Hide file tree
Showing 117 changed files with 196 additions and 196 deletions.
8 changes: 4 additions & 4 deletions arch/arc/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
#else /* !__ASSEMBLY__ */

#ifdef CONFIG_ARC_HAS_ICCM
#define __arcfp_code __section(.text.arcfp)
#define __arcfp_code __section(".text.arcfp")
#else
#define __arcfp_code __section(.text)
#define __arcfp_code __section(".text")
#endif

#ifdef CONFIG_ARC_HAS_DCCM
#define __arcfp_data __section(.data.arcfp)
#define __arcfp_data __section(".data.arcfp")
#else
#define __arcfp_data __section(.data)
#define __arcfp_data __section(".data")
#endif

#endif /* __ASSEMBLY__ */
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/include/asm/mach_desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
*/
#define MACHINE_START(_type, _name) \
static const struct machine_desc __mach_desc_##_type \
__used __section(.arch.info.init) = { \
__used __section(".arch.info.init") = { \
.name = _name,

#define MACHINE_END \
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/plat-hsdk/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <asm/io.h>
#include <asm/mach_desc.h>

int arc_hsdk_axi_dmac_coherent __section(.data) = 0;
int arc_hsdk_axi_dmac_coherent __section(".data") = 0;

#define ARC_CCM_UNUSED_ADDR 0x60000000

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
#define ARCH_SLAB_MINALIGN 8
#endif

#define __read_mostly __attribute__((__section__(".data..read_mostly")))
#define __read_mostly __section(".data..read_mostly")

#endif
2 changes: 1 addition & 1 deletion arch/arm/include/asm/cpuidle.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct of_cpuidle_method {

#define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
__used __section(__cpuidle_method_of_table) \
__used __section("__cpuidle_method_of_table") \
= { .method = _method, .ops = _ops }

extern int arm_cpuidle_suspend(int index);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/idmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <linux/pgtable.h>

/* Tag a function as requiring to be executed via an identity mapping. */
#define __idmap __section(.idmap.text) noinline notrace
#define __idmap __section(".idmap.text") noinline notrace

extern pgd_t *idmap_pgd;

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/include/asm/mach/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
#define MACHINE_START(_type,_name) \
static const struct machine_desc __mach_desc_##_type \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
__section(".arch.info.init") = { \
.nr = MACH_TYPE_##_type, \
.name = _name,

Expand All @@ -91,7 +91,7 @@ static const struct machine_desc __mach_desc_##_type \
#define DT_MACHINE_START(_name, _namestr) \
static const struct machine_desc __mach_desc_##_name \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
__section(".arch.info.init") = { \
.nr = ~0, \
.name = _namestr,

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <uapi/asm/setup.h>


#define __tag __used __attribute__((__section__(".taglist.init")))
#define __tag __used __section(".taglist.init")
#define __tagtable(tag, fn) \
static const struct tagtable __tagtable_##fn __tag = { tag, fn }

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct of_cpu_method {

#define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
static const struct of_cpu_method __cpu_method_of_table_##name \
__used __section(__cpu_method_of_table) \
__used __section("__cpu_method_of_table") \
= { .method = _method, .ops = _ops }
/*
* set platform specific SMP operations
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/include/asm/tcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#include <linux/compiler.h>

/* Tag variables with this */
#define __tcmdata __section(.tcm.data)
#define __tcmdata __section(".tcm.data")
/* Tag constants with this */
#define __tcmconst __section(.tcm.rodata)
#define __tcmconst __section(".tcm.rodata")
/* Tag functions inside TCM called from outside TCM with this */
#define __tcmfunc __attribute__((long_call)) __section(.tcm.text) noinline
#define __tcmfunc __attribute__((long_call)) __section(".tcm.text") noinline
/* Tag function inside TCM called from inside TCM with this */
#define __tcmlocalfunc __section(.tcm.text)
#define __tcmlocalfunc __section(".tcm.text")

void *tcm_alloc(size_t len);
void tcm_free(void *addr, size_t len);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
extern struct of_cpuidle_method __cpuidle_method_of_table[];

static const struct of_cpuidle_method __cpuidle_method_of_table_sentinel
__used __section(__cpuidle_method_of_table_end);
__used __section("__cpuidle_method_of_table_end");

static struct cpuidle_ops cpuidle_ops[NR_CPUS] __ro_after_init;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/devtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
extern struct of_cpu_method __cpu_method_of_table[];

static const struct of_cpu_method __cpu_method_of_table_sentinel
__used __section(__cpu_method_of_table_end);
__used __section("__cpu_method_of_table_end");


static int __init set_smp_ops_by_method(struct device_node *node)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static inline u32 cache_type_cwg(void)
return (read_cpuid_cachetype() >> CTR_CWG_SHIFT) & CTR_CWG_MASK;
}

#define __read_mostly __section(.data..read_mostly)
#define __read_mostly __section(".data..read_mostly")

static inline int cache_line_size_of_cpu(void)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)
}

/* we will fill this structure from the stub, so don't put it in .bss */
struct screen_info screen_info __section(.data);
struct screen_info screen_info __section(".data");

int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/smp_spin_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <asm/smp_plat.h>

extern void secondary_holding_pen(void);
volatile unsigned long __section(.mmuoff.data.read)
volatile unsigned long __section(".mmuoff.data.read")
secondary_holding_pen_release = INVALID_HWID;

static phys_addr_t cpu_release_addr[NR_CPUS];
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
u64 idmap_t0sz = TCR_T0SZ(VA_BITS);
u64 idmap_ptrs_per_pgd = PTRS_PER_PGD;

u64 __section(.mmuoff.data.write) vabits_actual;
u64 __section(".mmuoff.data.write") vabits_actual;
EXPORT_SYMBOL(vabits_actual);

u64 kimage_voffset __ro_after_init;
Expand Down
8 changes: 4 additions & 4 deletions arch/csky/include/asm/tcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include <linux/compiler.h>

/* Tag variables with this */
#define __tcmdata __section(.tcm.data)
#define __tcmdata __section(".tcm.data")
/* Tag constants with this */
#define __tcmconst __section(.tcm.rodata)
#define __tcmconst __section(".tcm.rodata")
/* Tag functions inside TCM called from outside TCM with this */
#define __tcmfunc __section(.tcm.text) noinline
#define __tcmfunc __section(".tcm.text") noinline
/* Tag function inside TCM called from inside TCM with this */
#define __tcmlocalfunc __section(.tcm.text)
#define __tcmlocalfunc __section(".tcm.text")

void *tcm_alloc(size_t len);
void tcm_free(void *addr, size_t len);
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
# define SMP_CACHE_BYTES (1 << 3)
#endif

#define __read_mostly __attribute__((__section__(".data..read_mostly")))
#define __read_mostly __section(".data..read_mostly")

#endif /* _ASM_IA64_CACHE_H */
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
* ASM code. Default position is BSS section which is cleared
* in machine_early_init().
*/
char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
char cmd_line[COMMAND_LINE_SIZE] __section(".data");

void __init setup_arch(char **cmdline_p)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)

#define __read_mostly __attribute__((__section__(".data..read_mostly")))
#define __read_mostly __section(".data..read_mostly")

#endif /* _ASM_CACHE_H */
2 changes: 1 addition & 1 deletion arch/mips/include/asm/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern long __mips_machines_end;

#define MIPS_MACHINE(name) \
static const struct mips_machine __mips_mach_##name \
__used __section(.mips.machines.init)
__used __section(".mips.machines.init")

#define for_each_mips_machine(mach) \
for ((mach) = (struct mips_machine *)&__mips_machines_start; \
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <asm/prom.h>

#ifdef CONFIG_MIPS_ELF_APPENDED_DTB
const char __section(.appended_dtb) __appended_dtb[0x100000];
const char __section(".appended_dtb") __appended_dtb[0x100000];
#endif /* CONFIG_MIPS_ELF_APPENDED_DTB */

struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ unsigned long pgd_current[NR_CPUS];
* size, and waste space. So we place it in its own section and align
* it in the linker script.
*/
pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".bss..swapper_pg_dir");
#ifndef __PAGETABLE_PUD_FOLDED
pud_t invalid_pud_table[PTRS_PER_PUD] __page_aligned_bss;
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#define ARCH_DMA_MINALIGN L1_CACHE_BYTES

#define __read_mostly __section(.data..read_mostly)
#define __read_mostly __section(".data..read_mostly")

void parisc_cache_init(void); /* initializes cache-flushing */
void disable_sr_hashing_asm(int); /* low level support for above */
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/include/asm/ldcw.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
})

#ifdef CONFIG_SMP
# define __lock_aligned __section(.data..lock_aligned)
# define __lock_aligned __section(".data..lock_aligned")
#endif

#endif /* __PARISC_LDCW_H */
2 changes: 1 addition & 1 deletion arch/parisc/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <asm/ftrace.h>
#include <asm/patch.h>

#define __hot __attribute__ ((__section__ (".text.hot")))
#define __hot __section(".text.hot")

#ifdef CONFIG_FUNCTION_GRAPH_TRACER
/*
Expand Down
6 changes: 3 additions & 3 deletions arch/parisc/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ extern void parisc_kernel_start(void); /* Kernel entry point in head.S */
* guarantee that global objects will be laid out in memory in the same order
* as the order of declaration, so put these in different sections and use
* the linker script to order them. */
pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data..vm0.pmd"), aligned(PAGE_SIZE)));
pmd_t pmd0[PTRS_PER_PMD] __section(".data..vm0.pmd") __attribute__ ((aligned(PAGE_SIZE)));
#endif

pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data..vm0.pgd"), aligned(PAGE_SIZE)));
pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pte"), aligned(PAGE_SIZE)));
pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".data..vm0.pgd") __attribute__ ((aligned(PAGE_SIZE)));
pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __section(".data..vm0.pte") __attribute__ ((aligned(PAGE_SIZE)));

static struct resource data_resource = {
.name = "Kernel data",
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static inline u32 l1_icache_bytes(void)

#endif

#define __read_mostly __section(.data..read_mostly)
#define __read_mostly __section(".data..read_mostly")

#ifdef CONFIG_PPC_BOOK3S_32
extern long _get_L2CR(void);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ extern void book3e_idle(void);
extern struct machdep_calls ppc_md;
extern struct machdep_calls *machine_id;

#define __machine_desc __attribute__ ((__section__ (".machine.desc")))
#define __machine_desc __section(".machine.desc")

#define define_machine(name) \
extern struct machdep_calls mach_##name; \
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/btext.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
static void scrollscreen(void);
#endif

#define __force_data __section(.data)
#define __force_data __section(".data")

static int g_loc_X __force_data;
static int g_loc_Y __force_data;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <linux/linux_logo.h>

/* All of prom_init bss lives here */
#define __prombss __section(.bss.prominit)
#define __prombss __section(".bss.prominit")

/*
* Eventually bump that one up
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kvm/book3s_64_vio_hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifdef CONFIG_BUG

#define WARN_ON_ONCE_RM(condition) ({ \
static bool __section(.data.unlikely) __warned; \
static bool __section(".data.unlikely") __warned; \
int __ret_warn_once = !!(condition); \
\
if (unlikely(__ret_warn_once && !__warned)) { \
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/include/asm/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define SOC_EARLY_INIT_DECLARE(name, compat, fn) \
static const struct of_device_id __soc_early_init__##name \
__used __section(__soc_early_init_table) \
__used __section("__soc_early_init_table") \
= { .compatible = compat, .data = fn }

void soc_early_init(void);
Expand Down Expand Up @@ -46,7 +46,7 @@ struct soc_builtin_dtb {
} \
\
static const struct soc_builtin_dtb __soc_builtin_dtb__##name \
__used __section(__soc_builtin_dtb_table) = \
__used __section("__soc_builtin_dtb_table") = \
{ \
.vendor_id = vendor, \
.arch_id = arch, \
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/kernel/cpu_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;

void *__cpu_up_stack_pointer[NR_CPUS] __section(.data);
void *__cpu_up_task_pointer[NR_CPUS] __section(.data);
void *__cpu_up_stack_pointer[NR_CPUS] __section(".data");
void *__cpu_up_task_pointer[NR_CPUS] __section(".data");

extern const struct cpu_operations cpu_ops_sbi;
extern const struct cpu_operations cpu_ops_spinwait;
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "head.h"

#if defined(CONFIG_DUMMY_CONSOLE) || defined(CONFIG_EFI)
struct screen_info screen_info __section(.data) = {
struct screen_info screen_info __section(".data") = {
.orig_video_lines = 30,
.orig_video_cols = 80,
.orig_video_mode = 0,
Expand All @@ -47,7 +47,7 @@ struct screen_info screen_info __section(.data) = {
* This is used before the kernel initializes the BSS so it can't be in the
* BSS.
*/
atomic_t hart_lottery __section(.sdata);
atomic_t hart_lottery __section(".sdata");
unsigned long boot_cpu_hartid;
static DEFINE_PER_CPU(struct cpu, cpu_devices);

Expand Down
2 changes: 1 addition & 1 deletion arch/s390/boot/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct diag_ops __bootdata_preserved(diag_dma_ops) = {
.diag0c = _diag0c_dma,
.diag308_reset = _diag308_reset_dma
};
static struct diag210 _diag210_tmp_dma __section(.dma.data);
static struct diag210 _diag210_tmp_dma __section(".dma.data");
struct diag210 *__bootdata_preserved(__diag210_tmp_dma) = &_diag210_tmp_dma;

void error(char *x)
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
#define L1_CACHE_SHIFT 8
#define NET_SKB_PAD 32

#define __read_mostly __section(.data..read_mostly)
#define __read_mostly __section(".data..read_mostly")

#endif
Loading

0 comments on commit 33def84

Please sign in to comment.