diff options
| author | Gideon Israel Dsouza <gidisrael@gmail.com> | 2014-04-07 18:39:20 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:36:11 -0400 |
| commit | 52f5684c8e1ec7463192aba8e2916df49807511a (patch) | |
| tree | f8e6061de05014e89e58638f626831f2c38af971 /kernel | |
| parent | ce816fa88cca083c47ab9000b2138a83043a78be (diff) | |
kernel: use macros from compiler.h instead of __attribute__((...))
To increase compiler portability there is <linux/compiler.h> which
provides convenience macros for various gcc constructs. Eg: __weak for
__attribute__((weak)). I've replaced all instances of gcc attributes
with the right macro in the kernel subsystem.
Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 3 | ||||
| -rw-r--r-- | kernel/kallsyms.c | 11 | ||||
| -rw-r--r-- | kernel/kexec.c | 5 | ||||
| -rw-r--r-- | kernel/ksysfs.c | 5 | ||||
| -rw-r--r-- | kernel/power/power.h | 3 | ||||
| -rw-r--r-- | kernel/power/snapshot.c | 3 | ||||
| -rw-r--r-- | kernel/power/suspend.c | 5 | ||||
| -rw-r--r-- | kernel/power/swap.c | 2 | ||||
| -rw-r--r-- | kernel/sched/clock.c | 3 | ||||
| -rw-r--r-- | kernel/sched/core.c | 3 | ||||
| -rw-r--r-- | kernel/signal.c | 4 | ||||
| -rw-r--r-- | kernel/time/timekeeping.c | 5 | ||||
| -rw-r--r-- | kernel/trace/trace.h | 3 |
13 files changed, 34 insertions, 21 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index e905e9c6b224..54a8d26f612f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #include <linux/signalfd.h> | 73 | #include <linux/signalfd.h> |
| 74 | #include <linux/uprobes.h> | 74 | #include <linux/uprobes.h> |
| 75 | #include <linux/aio.h> | 75 | #include <linux/aio.h> |
| 76 | #include <linux/compiler.h> | ||
| 76 | 77 | ||
| 77 | #include <asm/pgtable.h> | 78 | #include <asm/pgtable.h> |
| 78 | #include <asm/pgalloc.h> | 79 | #include <asm/pgalloc.h> |
| @@ -286,7 +287,7 @@ void __init fork_init(unsigned long mempages) | |||
| 286 | init_task.signal->rlim[RLIMIT_NPROC]; | 287 | init_task.signal->rlim[RLIMIT_NPROC]; |
| 287 | } | 288 | } |
| 288 | 289 | ||
| 289 | int __attribute__((weak)) arch_dup_task_struct(struct task_struct *dst, | 290 | int __weak arch_dup_task_struct(struct task_struct *dst, |
| 290 | struct task_struct *src) | 291 | struct task_struct *src) |
| 291 | { | 292 | { |
| 292 | *dst = *src; | 293 | *dst = *src; |
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 3127ad52cdb2..cb0cf37dac3a 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
| 24 | #include <linux/ctype.h> | 24 | #include <linux/ctype.h> |
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/compiler.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/sections.h> | 28 | #include <asm/sections.h> |
| 28 | 29 | ||
| @@ -36,8 +37,8 @@ | |||
| 36 | * These will be re-linked against their real values | 37 | * These will be re-linked against their real values |
| 37 | * during the second link stage. | 38 | * during the second link stage. |
| 38 | */ | 39 | */ |
| 39 | extern const unsigned long kallsyms_addresses[] __attribute__((weak)); | 40 | extern const unsigned long kallsyms_addresses[] __weak; |
| 40 | extern const u8 kallsyms_names[] __attribute__((weak)); | 41 | extern const u8 kallsyms_names[] __weak; |
| 41 | 42 | ||
| 42 | /* | 43 | /* |
| 43 | * Tell the compiler that the count isn't in the small data section if the arch | 44 | * Tell the compiler that the count isn't in the small data section if the arch |
| @@ -46,10 +47,10 @@ extern const u8 kallsyms_names[] __attribute__((weak)); | |||
| 46 | extern const unsigned long kallsyms_num_syms | 47 | extern const unsigned long kallsyms_num_syms |
| 47 | __attribute__((weak, section(".rodata"))); | 48 | __attribute__((weak, section(".rodata"))); |
| 48 | 49 | ||
| 49 | extern const u8 kallsyms_token_table[] __attribute__((weak)); | 50 | extern const u8 kallsyms_token_table[] __weak; |
| 50 | extern const u16 kallsyms_token_index[] __attribute__((weak)); | 51 | extern const u16 kallsyms_token_index[] __weak; |
| 51 | 52 | ||
| 52 | extern const unsigned long kallsyms_markers[] __attribute__((weak)); | 53 | extern const unsigned long kallsyms_markers[] __weak; |
| 53 | 54 | ||
| 54 | static inline int is_kernel_inittext(unsigned long addr) | 55 | static inline int is_kernel_inittext(unsigned long addr) |
| 55 | { | 56 | { |
diff --git a/kernel/kexec.c b/kernel/kexec.c index c0d261c7db7b..c8380ad203bc 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
| 33 | #include <linux/swap.h> | 33 | #include <linux/swap.h> |
| 34 | #include <linux/syscore_ops.h> | 34 | #include <linux/syscore_ops.h> |
| 35 | #include <linux/compiler.h> | ||
| 35 | 36 | ||
| 36 | #include <asm/page.h> | 37 | #include <asm/page.h> |
| 37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
| @@ -1551,10 +1552,10 @@ void vmcoreinfo_append_str(const char *fmt, ...) | |||
| 1551 | * provide an empty default implementation here -- architecture | 1552 | * provide an empty default implementation here -- architecture |
| 1552 | * code may override this | 1553 | * code may override this |
| 1553 | */ | 1554 | */ |
| 1554 | void __attribute__ ((weak)) arch_crash_save_vmcoreinfo(void) | 1555 | void __weak arch_crash_save_vmcoreinfo(void) |
| 1555 | {} | 1556 | {} |
| 1556 | 1557 | ||
| 1557 | unsigned long __attribute__ ((weak)) paddr_vmcoreinfo_note(void) | 1558 | unsigned long __weak paddr_vmcoreinfo_note(void) |
| 1558 | { | 1559 | { |
| 1559 | return __pa((unsigned long)(char *)&vmcoreinfo_note); | 1560 | return __pa((unsigned long)(char *)&vmcoreinfo_note); |
| 1560 | } | 1561 | } |
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index e660964086e2..2495a9b14ac8 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/stat.h> | 18 | #include <linux/stat.h> |
| 19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 20 | #include <linux/capability.h> | 20 | #include <linux/capability.h> |
| 21 | #include <linux/compiler.h> | ||
| 21 | 22 | ||
| 22 | #include <linux/rcupdate.h> /* rcu_expedited */ | 23 | #include <linux/rcupdate.h> /* rcu_expedited */ |
| 23 | 24 | ||
| @@ -162,8 +163,8 @@ KERNEL_ATTR_RW(rcu_expedited); | |||
| 162 | /* | 163 | /* |
| 163 | * Make /sys/kernel/notes give the raw contents of our kernel .notes section. | 164 | * Make /sys/kernel/notes give the raw contents of our kernel .notes section. |
| 164 | */ | 165 | */ |
| 165 | extern const void __start_notes __attribute__((weak)); | 166 | extern const void __start_notes __weak; |
| 166 | extern const void __stop_notes __attribute__((weak)); | 167 | extern const void __stop_notes __weak; |
| 167 | #define notes_size (&__stop_notes - &__start_notes) | 168 | #define notes_size (&__stop_notes - &__start_notes) |
| 168 | 169 | ||
| 169 | static ssize_t notes_read(struct file *filp, struct kobject *kobj, | 170 | static ssize_t notes_read(struct file *filp, struct kobject *kobj, |
diff --git a/kernel/power/power.h b/kernel/power/power.h index 1ca753106557..15f37ea08719 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #include <linux/suspend_ioctls.h> | 2 | #include <linux/suspend_ioctls.h> |
| 3 | #include <linux/utsname.h> | 3 | #include <linux/utsname.h> |
| 4 | #include <linux/freezer.h> | 4 | #include <linux/freezer.h> |
| 5 | #include <linux/compiler.h> | ||
| 5 | 6 | ||
| 6 | struct swsusp_info { | 7 | struct swsusp_info { |
| 7 | struct new_utsname uts; | 8 | struct new_utsname uts; |
| @@ -11,7 +12,7 @@ struct swsusp_info { | |||
| 11 | unsigned long image_pages; | 12 | unsigned long image_pages; |
| 12 | unsigned long pages; | 13 | unsigned long pages; |
| 13 | unsigned long size; | 14 | unsigned long size; |
| 14 | } __attribute__((aligned(PAGE_SIZE))); | 15 | } __aligned(PAGE_SIZE); |
| 15 | 16 | ||
| 16 | #ifdef CONFIG_HIBERNATION | 17 | #ifdef CONFIG_HIBERNATION |
| 17 | /* kernel/power/snapshot.c */ | 18 | /* kernel/power/snapshot.c */ |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 149e745eaa52..18fb7a2fb14b 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/highmem.h> | 27 | #include <linux/highmem.h> |
| 28 | #include <linux/list.h> | 28 | #include <linux/list.h> |
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | #include <linux/compiler.h> | ||
| 30 | 31 | ||
| 31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
| 32 | #include <asm/mmu_context.h> | 33 | #include <asm/mmu_context.h> |
| @@ -155,7 +156,7 @@ static inline void free_image_page(void *addr, int clear_nosave_free) | |||
| 155 | struct linked_page { | 156 | struct linked_page { |
| 156 | struct linked_page *next; | 157 | struct linked_page *next; |
| 157 | char data[LINKED_PAGE_DATA_SIZE]; | 158 | char data[LINKED_PAGE_DATA_SIZE]; |
| 158 | } __attribute__((packed)); | 159 | } __packed; |
| 159 | 160 | ||
| 160 | static inline void | 161 | static inline void |
| 161 | free_list_of_pages(struct linked_page *list, int clear_page_nosave) | 162 | free_list_of_pages(struct linked_page *list, int clear_page_nosave) |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 90b3d9366d1a..c3ad9cafe930 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/syscore_ops.h> | 26 | #include <linux/syscore_ops.h> |
| 27 | #include <linux/ftrace.h> | 27 | #include <linux/ftrace.h> |
| 28 | #include <trace/events/power.h> | 28 | #include <trace/events/power.h> |
| 29 | #include <linux/compiler.h> | ||
| 29 | 30 | ||
| 30 | #include "power.h" | 31 | #include "power.h" |
| 31 | 32 | ||
| @@ -156,13 +157,13 @@ static int suspend_prepare(suspend_state_t state) | |||
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | /* default implementation */ | 159 | /* default implementation */ |
| 159 | void __attribute__ ((weak)) arch_suspend_disable_irqs(void) | 160 | void __weak arch_suspend_disable_irqs(void) |
| 160 | { | 161 | { |
| 161 | local_irq_disable(); | 162 | local_irq_disable(); |
| 162 | } | 163 | } |
| 163 | 164 | ||
| 164 | /* default implementation */ | 165 | /* default implementation */ |
| 165 | void __attribute__ ((weak)) arch_suspend_enable_irqs(void) | 166 | void __weak arch_suspend_enable_irqs(void) |
| 166 | { | 167 | { |
| 167 | local_irq_enable(); | 168 | local_irq_enable(); |
| 168 | } | 169 | } |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 7c33ed200410..8c9a4819f798 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
| @@ -101,7 +101,7 @@ struct swsusp_header { | |||
| 101 | unsigned int flags; /* Flags to pass to the "boot" kernel */ | 101 | unsigned int flags; /* Flags to pass to the "boot" kernel */ |
| 102 | char orig_sig[10]; | 102 | char orig_sig[10]; |
| 103 | char sig[10]; | 103 | char sig[10]; |
| 104 | } __attribute__((packed)); | 104 | } __packed; |
| 105 | 105 | ||
| 106 | static struct swsusp_header *swsusp_header; | 106 | static struct swsusp_header *swsusp_header; |
| 107 | 107 | ||
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c index b30a2924ef14..3ef6451e972e 100644 --- a/kernel/sched/clock.c +++ b/kernel/sched/clock.c | |||
| @@ -60,13 +60,14 @@ | |||
| 60 | #include <linux/sched.h> | 60 | #include <linux/sched.h> |
| 61 | #include <linux/static_key.h> | 61 | #include <linux/static_key.h> |
| 62 | #include <linux/workqueue.h> | 62 | #include <linux/workqueue.h> |
| 63 | #include <linux/compiler.h> | ||
| 63 | 64 | ||
| 64 | /* | 65 | /* |
| 65 | * Scheduler clock - returns current time in nanosec units. | 66 | * Scheduler clock - returns current time in nanosec units. |
| 66 | * This is default implementation. | 67 | * This is default implementation. |
| 67 | * Architectures and sub-architectures can override this. | 68 | * Architectures and sub-architectures can override this. |
| 68 | */ | 69 | */ |
| 69 | unsigned long long __attribute__((weak)) sched_clock(void) | 70 | unsigned long long __weak sched_clock(void) |
| 70 | { | 71 | { |
| 71 | return (unsigned long long)(jiffies - INITIAL_JIFFIES) | 72 | return (unsigned long long)(jiffies - INITIAL_JIFFIES) |
| 72 | * (NSEC_PER_SEC / HZ); | 73 | * (NSEC_PER_SEC / HZ); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1d1b87b36778..80bd491b718c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #include <linux/init_task.h> | 73 | #include <linux/init_task.h> |
| 74 | #include <linux/binfmts.h> | 74 | #include <linux/binfmts.h> |
| 75 | #include <linux/context_tracking.h> | 75 | #include <linux/context_tracking.h> |
| 76 | #include <linux/compiler.h> | ||
| 76 | 77 | ||
| 77 | #include <asm/switch_to.h> | 78 | #include <asm/switch_to.h> |
| 78 | #include <asm/tlb.h> | 79 | #include <asm/tlb.h> |
| @@ -6498,7 +6499,7 @@ static cpumask_var_t fallback_doms; | |||
| 6498 | * cpu core maps. It is supposed to return 1 if the topology changed | 6499 | * cpu core maps. It is supposed to return 1 if the topology changed |
| 6499 | * or 0 if it stayed the same. | 6500 | * or 0 if it stayed the same. |
| 6500 | */ | 6501 | */ |
| 6501 | int __attribute__((weak)) arch_update_cpu_topology(void) | 6502 | int __weak arch_update_cpu_topology(void) |
| 6502 | { | 6503 | { |
| 6503 | return 0; | 6504 | return 0; |
| 6504 | } | 6505 | } |
diff --git a/kernel/signal.c b/kernel/signal.c index 5d4b05a229a6..6ea13c09ae56 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -33,6 +33,8 @@ | |||
| 33 | #include <linux/uprobes.h> | 33 | #include <linux/uprobes.h> |
| 34 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
| 35 | #include <linux/cn_proc.h> | 35 | #include <linux/cn_proc.h> |
| 36 | #include <linux/compiler.h> | ||
| 37 | |||
| 36 | #define CREATE_TRACE_POINTS | 38 | #define CREATE_TRACE_POINTS |
| 37 | #include <trace/events/signal.h> | 39 | #include <trace/events/signal.h> |
| 38 | 40 | ||
| @@ -3618,7 +3620,7 @@ SYSCALL_DEFINE3(sigsuspend, int, unused1, int, unused2, old_sigset_t, mask) | |||
| 3618 | } | 3620 | } |
| 3619 | #endif | 3621 | #endif |
| 3620 | 3622 | ||
| 3621 | __attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma) | 3623 | __weak const char *arch_vma_name(struct vm_area_struct *vma) |
| 3622 | { | 3624 | { |
| 3623 | return NULL; | 3625 | return NULL; |
| 3624 | } | 3626 | } |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 5b40279ecd71..f7df8ea21707 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/tick.h> | 22 | #include <linux/tick.h> |
| 23 | #include <linux/stop_machine.h> | 23 | #include <linux/stop_machine.h> |
| 24 | #include <linux/pvclock_gtod.h> | 24 | #include <linux/pvclock_gtod.h> |
| 25 | #include <linux/compiler.h> | ||
| 25 | 26 | ||
| 26 | #include "tick-internal.h" | 27 | #include "tick-internal.h" |
| 27 | #include "ntp_internal.h" | 28 | #include "ntp_internal.h" |
| @@ -760,7 +761,7 @@ u64 timekeeping_max_deferment(void) | |||
| 760 | * | 761 | * |
| 761 | * XXX - Do be sure to remove it once all arches implement it. | 762 | * XXX - Do be sure to remove it once all arches implement it. |
| 762 | */ | 763 | */ |
| 763 | void __attribute__((weak)) read_persistent_clock(struct timespec *ts) | 764 | void __weak read_persistent_clock(struct timespec *ts) |
| 764 | { | 765 | { |
| 765 | ts->tv_sec = 0; | 766 | ts->tv_sec = 0; |
| 766 | ts->tv_nsec = 0; | 767 | ts->tv_nsec = 0; |
| @@ -775,7 +776,7 @@ void __attribute__((weak)) read_persistent_clock(struct timespec *ts) | |||
| 775 | * | 776 | * |
| 776 | * XXX - Do be sure to remove it once all arches implement it. | 777 | * XXX - Do be sure to remove it once all arches implement it. |
| 777 | */ | 778 | */ |
| 778 | void __attribute__((weak)) read_boot_clock(struct timespec *ts) | 779 | void __weak read_boot_clock(struct timespec *ts) |
| 779 | { | 780 | { |
| 780 | ts->tv_sec = 0; | 781 | ts->tv_sec = 0; |
| 781 | ts->tv_nsec = 0; | 782 | ts->tv_nsec = 0; |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index ffc314b7e92b..2e29d7ba5a52 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/hw_breakpoint.h> | 13 | #include <linux/hw_breakpoint.h> |
| 14 | #include <linux/trace_seq.h> | 14 | #include <linux/trace_seq.h> |
| 15 | #include <linux/ftrace_event.h> | 15 | #include <linux/ftrace_event.h> |
| 16 | #include <linux/compiler.h> | ||
| 16 | 17 | ||
| 17 | #ifdef CONFIG_FTRACE_SYSCALLS | 18 | #ifdef CONFIG_FTRACE_SYSCALLS |
| 18 | #include <asm/unistd.h> /* For NR_SYSCALLS */ | 19 | #include <asm/unistd.h> /* For NR_SYSCALLS */ |
| @@ -1279,7 +1280,7 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled); | |||
| 1279 | #undef FTRACE_ENTRY | 1280 | #undef FTRACE_ENTRY |
| 1280 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ | 1281 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ |
| 1281 | extern struct ftrace_event_call \ | 1282 | extern struct ftrace_event_call \ |
| 1282 | __attribute__((__aligned__(4))) event_##call; | 1283 | __aligned(4) event_##call; |
| 1283 | #undef FTRACE_ENTRY_DUP | 1284 | #undef FTRACE_ENTRY_DUP |
| 1284 | #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print, filter) \ | 1285 | #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print, filter) \ |
| 1285 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print), \ | 1286 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print), \ |
