Skip to content

linux/drivers/base/core.c

Imported from _research/manual-study-linux/file-notes/linux__drivers__base__core.c.md.

File Notes: drivers/base/core.c

Status: reviewed.

Purpose: device model core lifecycle.

Review target: devices, buses, drivers, sysfs exposure, ownership, and Rust driver API design.

Evidence

  • drivers/base/core.c is the core driver-model file for device registration.
  • include/linux/device.h documents struct device around lines 618-699 and defines it at line 701.
  • device_register(), device_initialize(), and device_add() are declared around lines 1159-1162 of include/linux/device.h.
  • The probe path is in drivers/base/dd.c: call_driver_probe() lines 621-650, really_probe() lines 652-775, __driver_probe_device() line 827, and driver_probe_device() line 892.
  • really_probe() handles supplier checks, driver assignment, pinctrl, DMA, sysfs, power domains, the probe callback, and failure unwind.

Design Notes

The device model is a generic lifecycle substrate. Subsystems embed struct device inside richer objects. Rust should expose probe as a typed, staged construction flow and use RAII guards for every acquired resource.