Skip to content

Commit

Permalink
cpufeature: correctly annotate the module init function
Browse files Browse the repository at this point in the history
A section mismatch warning is reported if an __init annotated function is
specified for module_cpu_feature_match().
Change the module_cpu_feature_match() function and annotate the generated
cpu_feature_match_* function as __init.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Hendrik Brueckner authored and Martin Schwidefsky committed Jul 22, 2015
1 parent 9977e88 commit 7d0c502
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/linux/cpufeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#ifdef CONFIG_GENERIC_CPU_AUTOPROBE

#include <linux/init.h>
#include <linux/mod_devicetable.h>
#include <asm/cpufeature.h>

Expand Down Expand Up @@ -43,16 +44,16 @@
* For a list of legal values for 'feature', please consult the file
* 'asm/cpufeature.h' of your favorite architecture.
*/
#define module_cpu_feature_match(x, __init) \
#define module_cpu_feature_match(x, __initfunc) \
static struct cpu_feature const cpu_feature_match_ ## x[] = \
{ { .feature = cpu_feature(x) }, { } }; \
MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \
\
static int cpu_feature_match_ ## x ## _init(void) \
static int __init cpu_feature_match_ ## x ## _init(void) \
{ \
if (!cpu_have_feature(cpu_feature(x))) \
return -ENODEV; \
return __init(); \
return __initfunc(); \
} \
module_init(cpu_feature_match_ ## x ## _init)

Expand Down

0 comments on commit 7d0c502

Please sign in to comment.