From bfa40a9b2dee7adac2f53cadd518d721d68a59fa Mon Sep 17 00:00:00 2001 From: gaoyang3513 Date: Wed, 3 Jul 2024 20:31:56 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=20=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=85=B3=E8=81=94of=5Fnode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spi/pn5180.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/spi/pn5180.c b/spi/pn5180.c index 17f27ac53..a370ce8b1 100644 --- a/spi/pn5180.c +++ b/spi/pn5180.c @@ -47,14 +47,29 @@ int CHIP_remove(struct spi_device *spi) 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 = { .driver = { - .name = "CHIP", - .owner = THIS_MODULE, + .name = "CHIP", + .owner = THIS_MODULE, +#ifdef CONFIG_OF + .of_match_table = CHIP_of_match, +#endif // CONFIG_OF }, - - .probe = CHIP_probe, - .remove = CHIP_remove, + .probe = CHIP_probe, + .remove = CHIP_remove, }; module_spi_driver(CHIP_driver); + +MODULE_AUTHOR("Gao yang "); +MODULE_DESCRIPTION("NXP PN5180 NFC driver"); +MODULE_LICENSE("GPL");