Skip to content

Commit 7fedac9

Browse files
committed
modpost: merge add_{intree_flag,retpoline,staging_flag} to add_header
add_intree_flag(), add_retpoline(), and add_staging_flag() are small enough to be merged into add_header(). Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> Tested-by: Nathan Chancellor <[email protected]>
1 parent 5d53508 commit 7fedac9

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

scripts/mod/modpost.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,25 +2243,17 @@ static void add_header(struct buffer *b, struct module *mod)
22432243
"#endif\n");
22442244
buf_printf(b, "\t.arch = MODULE_ARCH_INIT,\n");
22452245
buf_printf(b, "};\n");
2246-
}
22472246

2248-
static void add_intree_flag(struct buffer *b, int is_intree)
2249-
{
2250-
if (is_intree)
2247+
if (!external_module)
22512248
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
2252-
}
22532249

2254-
/* Cannot check for assembler */
2255-
static void add_retpoline(struct buffer *b)
2256-
{
2257-
buf_printf(b, "\n#ifdef CONFIG_RETPOLINE\n");
2258-
buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n");
2259-
buf_printf(b, "#endif\n");
2260-
}
2250+
buf_printf(b,
2251+
"\n"
2252+
"#ifdef CONFIG_RETPOLINE\n"
2253+
"MODULE_INFO(retpoline, \"Y\");\n"
2254+
"#endif\n");
22612255

2262-
static void add_staging_flag(struct buffer *b, const char *name)
2263-
{
2264-
if (strstarts(name, "drivers/staging"))
2256+
if (strstarts(mod->name, "drivers/staging"))
22652257
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
22662258
}
22672259

@@ -2577,9 +2569,6 @@ int main(int argc, char **argv)
25772569
check_exports(mod);
25782570

25792571
add_header(&buf, mod);
2580-
add_intree_flag(&buf, !external_module);
2581-
add_retpoline(&buf);
2582-
add_staging_flag(&buf, mod->name);
25832572
add_versions(&buf, mod);
25842573
add_depends(&buf, mod);
25852574
add_moddevtable(&buf, mod);

0 commit comments

Comments
 (0)