[Mod] 增加设备信息,关联of_node

This commit is contained in:
gaoyang3513
2024-07-03 20:31:56 +08:00
parent ad4c4c383f
commit bfa40a9b2d

View File

@ -47,14 +47,29 @@ int CHIP_remove(struct spi_device *spi)
return 0; return 0;
} }
#ifdef CONFIG_OF
static const struct of_device_id CHIP_of_match[] = {
{ .compatible = "nxp,pn5180", },
{ }
};
MODULE_DEVICE_TABLE(of, CHIP_of_match);
#endif // CONFIG_OF
static struct spi_driver CHIP_driver = { static struct spi_driver CHIP_driver = {
.driver = { .driver = {
.name = "CHIP", .name = "CHIP",
.owner = THIS_MODULE, .owner = THIS_MODULE,
#ifdef CONFIG_OF
.of_match_table = CHIP_of_match,
#endif // CONFIG_OF
}, },
.probe = CHIP_probe,
.probe = CHIP_probe, .remove = CHIP_remove,
.remove = CHIP_remove,
}; };
module_spi_driver(CHIP_driver); module_spi_driver(CHIP_driver);
MODULE_AUTHOR("Gao yang <gaoyang3513@163.com>");
MODULE_DESCRIPTION("NXP PN5180 NFC driver");
MODULE_LICENSE("GPL");