Macro driver_initcall

Source
macro_rules! driver_initcall {
    ($func:ident) => { ... };
}
Expand description

A macro used to register driver initialization functions to be called during the system boot process.

This macro places the function pointer into the .initcall.driver section of the binary, allowing the kernel to discover and call all driver initialization functions at the appropriate time.

§Parameters

  • $func - A function with the signature fn() that register a driver

§Examples

fn register_my_driver() {
    // Driver registration logic here
}

driver_initcall!(register_my_driver);

§Safety

This macro relies on linker sections and should only be used for functions that are safe to call during the kernel’s driver initialization phase.