diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-11-21 21:00:25 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-12-13 21:35:30 -0500 |
commit | 6f33d58794ef4cef4b2c706029810f9688bd3026 (patch) | |
tree | 9004029454efa12a5d662592bea16c54452130a0 /include/linux/compiler.h | |
parent | d890f510c8e45aaf33b8737f211ea05aecb8b460 (diff) |
__UNIQUE_ID()
Jan Beulich points out __COUNTER__ (gcc 4.3 and above), so let's use
that to create unique ids. This is better than __LINE__ which we use
today, so provide a wrapper.
Stanislaw Gruszka <sgruszka@redhat.com> reported that some module parameters
start with a digit, so we need to prepend when we for the unique id.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r-- | include/linux/compiler.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index f430e4162f41..5f45335e1ac7 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -42,6 +42,10 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
42 | # define __rcu | 42 | # define __rcu |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ | ||
46 | #define ___PASTE(a,b) a##b | ||
47 | #define __PASTE(a,b) ___PASTE(a,b) | ||
48 | |||
45 | #ifdef __KERNEL__ | 49 | #ifdef __KERNEL__ |
46 | 50 | ||
47 | #ifdef __GNUC__ | 51 | #ifdef __GNUC__ |
@@ -164,6 +168,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
164 | (typeof(ptr)) (__ptr + (off)); }) | 168 | (typeof(ptr)) (__ptr + (off)); }) |
165 | #endif | 169 | #endif |
166 | 170 | ||
171 | /* Not-quite-unique ID. */ | ||
172 | #ifndef __UNIQUE_ID | ||
173 | # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) | ||
174 | #endif | ||
175 | |||
167 | #endif /* __KERNEL__ */ | 176 | #endif /* __KERNEL__ */ |
168 | 177 | ||
169 | #endif /* __ASSEMBLY__ */ | 178 | #endif /* __ASSEMBLY__ */ |