[PATCH v2 3/4] iio: adc: ad7887: add OF match table

From: Alexandru Ardelean
Date: Thu Nov 19 2020 - 05:03:05 EST


This will make the driver probe-able via device-tree and ACPI via PRP0001.
While the SPI match table may be sufficient, this should extend the cover
of this driver being probed by other methods.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
---
drivers/iio/adc/ad7887.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index c28f704301d9..eb3a5b0080ee 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -341,9 +341,16 @@ static const struct spi_device_id ad7887_id[] = {
};
MODULE_DEVICE_TABLE(spi, ad7887_id);

+static const struct of_device_id ad7887_of_match[] = {
+ { .compatible = "adi,ad7887" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, ad7887_of_match);
+
static struct spi_driver ad7887_driver = {
.driver = {
.name = "ad7887",
+ .of_match_table = ad7887_of_match,
},
.probe = ad7887_probe,
.id_table = ad7887_id,
--
2.17.1