diff options
author | Siddharth Menon <simeddon@gmail.com> | 2025-03-22 21:58:11 +0530 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-04-22 19:09:51 +0100 |
commit | 0b2a4f55cc422b6c6b22a5a1b7de63ebe96f2f76 (patch) | |
tree | a67017bf6f805b8620de7272548f5f59e8ac7d49 | |
parent | ad02ca57e44e9936fca5095840fad9d4b47c5559 (diff) |
iio: frequency: ad9832: devicetree probing support
Introduce struct for device match of_device_id to avoid relying on fallback
mechanisms, which could lead to false matches against other AD9832 variants
in the future.
Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
Link: https://patch.msgid.link/20250322163211.253009-1-simeddon@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/staging/iio/frequency/ad9832.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index db42810c7664b..1bf23384d28bb 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -402,6 +402,13 @@ static int ad9832_probe(struct spi_device *spi) return devm_iio_device_register(&spi->dev, indio_dev); } +static const struct of_device_id ad9832_of_match[] = { + { .compatible = "adi,ad9832" }, + { .compatible = "adi,ad9835" }, + { } +}; +MODULE_DEVICE_TABLE(of, ad9832_of_match); + static const struct spi_device_id ad9832_id[] = { {"ad9832", 0}, {"ad9835", 0}, @@ -412,6 +419,7 @@ MODULE_DEVICE_TABLE(spi, ad9832_id); static struct spi_driver ad9832_driver = { .driver = { .name = "ad9832", + .of_match_table = ad9832_of_match, }, .probe = ad9832_probe, .id_table = ad9832_id, |