struct xxx_device_id
驱动程序匹配ID表
xxx有of、platform、i2c、spi、acpi、usb、pci也可以是位于include/linux/mod_devicetable.h中定义的总线类型。
MODULE_DEVICE_TABLE(type, name)
使用MODULE_DEVICE_TABLE寄向内核公开设备支持的设备ID。
module_platform_driver(name)
module_platform_driver(name)宏向内核注册struct platform_driver类型驱动。
struct platform_driver需要实现probe, remove 2个回调函数和driver成员的of_match_table和name。
of_match_table是指向前面使用MODULE_DEVICE_TABLE(type,name)申明的id_table。
本文详细解读Linux设备树驱动中的`structxxx_device_id`结构,如何使用MODULE_DEVICE_TABLE声明设备ID,以及module_platform_driver用于注册platform_driver驱动,包括probe和remove回调函数及of_match_table的运用。
1235

被折叠的 条评论
为什么被折叠?



