Device in kernel::device
This reference page documents kernel::device::Device, the Rust type the kernel hands a driver to represent one piece of hardware. It explains that a device is either a bus device (PCI, USB, I2C, SPI,…
Everything the kernel knows about one piece of hardware, its parent bus, its name, its power state, its place in the device model, hangs off a single common structure, and the Rust type for it is what you are handed when your driver is matched to hardware. You use it to log messages with the right prefix, to tie allocations to the device's lifetime, and to reach bus-specific operations. It is reference counted, so keeping it beyond the call that gave it to you means taking a reference rather than copying a pointer. Treating it as a plain pointer in C is how drivers end up logging against a device that has already been freed.
This reference page documents kernel::device::Device, the Rust type the kernel hands a driver to represent one piece of hardware. It explains that a device is either a bus device (PCI, USB, I2C, SPI,…