Skip to content

Commit 451ef1c

Browse files
tmlindgregkh
authored andcommitted
init.h: Update initcall_sync variants to fix build errors
We are getting randconfig build errors on device drivers with tristate Kconfig option if they are using custom initcall levels. Rather than add ifdeffery into the drivers, let's add the missing initcall_sync variants. As the comment in init.h has kept people from updating the list of initcalls that can be just module_init when the driver is loaded as a loadable module, let's also update the comment a bit to describe valid use cases custom initcall levels. While most drivers should nowadays use just regular module_init because of the deferred probe, we do have quite a few custom initcall levels left that we cannot remove until tested properly. There are also still few valid cases where a custom initcall level might make sense that I'm aware of. For example a bus snooping driver can provide information about invalid bus access and is handy loader early when built in. But there's no hard dependency to have it necessarily built in and a loadable module is a valid option. Another example is a driver implementing a Linux framework like pinctrl framework. That driver may be needed early on some platforms because of legacy reasons, while it can be just a regular module_init on most platforms. Signed-off-by: Tony Lindgren <tony@atomide.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a996d01 commit 451ef1c

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎include/linux/init.h‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,28 @@ void __init parse_early_options(char *cmdline);
297297

298298
#else /* MODULE */
299299

300-
/* Don't use these in loadable modules, but some people do... */
300+
/*
301+
* In most cases loadable modules do not need custom
302+
* initcall levels. There are still some valid cases where
303+
* a driver may be needed early if built in, and does not
304+
* matter when built as a loadable module. Like bus
305+
* snooping debug drivers.
306+
*/
301307
#define early_initcall(fn) module_init(fn)
302308
#define core_initcall(fn) module_init(fn)
309+
#define core_initcall_sync(fn) module_init(fn)
303310
#define postcore_initcall(fn) module_init(fn)
311+
#define postcore_initcall_sync(fn) module_init(fn)
304312
#define arch_initcall(fn) module_init(fn)
305313
#define subsys_initcall(fn) module_init(fn)
314+
#define subsys_initcall_sync(fn) module_init(fn)
306315
#define fs_initcall(fn) module_init(fn)
316+
#define fs_initcall_sync(fn) module_init(fn)
307317
#define rootfs_initcall(fn) module_init(fn)
308318
#define device_initcall(fn) module_init(fn)
319+
#define device_initcall_sync(fn) module_init(fn)
309320
#define late_initcall(fn) module_init(fn)
321+
#define late_initcall_sync(fn) module_init(fn)
310322

311323
#define console_initcall(fn) module_init(fn)
312324
#define security_initcall(fn) module_init(fn)

0 commit comments

Comments
 (0)