kernel::driver
This page documents the part of the Linux kernel's Rust layer that connects a driver to a bus such as PCI or the platform bus. A driver does not run by itself; it registers with a bus, and the bus ca…
Implementing the driver trait does nothing until the driver is registered with its bus, and it must be unregistered before the module unloads or the kernel will later call into code that no longer exists. In Rust the registration is a value: creating it registers, dropping it unregisters, and it is stored inside your module type so unloading the module drops it automatically. An adapter layer in between converts the C callback signatures the bus expects into the safe trait methods you wrote. This makes the register-without-unregister crash, one of the ugliest failures in C module code, structurally impossible.
This page documents the part of the Linux kernel's Rust layer that connects a driver to a bus such as PCI or the platform bus. A driver does not run by itself; it registers with a bus, and the bus ca…