struct of_device_id¶
Purpose¶
struct of_device_id defines Device Tree compatible strings that a driver can match.
It is the bridge between a Device Tree node and a kernel driver.
Header¶
Typical Usage¶
static const struct of_device_id my_of_match[] = {
{ .compatible = "myvendor,my-device" },
{ }
};
MODULE_DEVICE_TABLE(of, my_of_match);
In the platform driver:
In Device Tree:
Common Pitfalls¶
- mismatch between DTS
compatibleand driver match table - missing terminating empty entry
{ } - missing
MODULE_DEVICE_TABLE(of, ...) - using a generic compatible string that does not describe the actual hardware