[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250322163211.253009-1-simeddon@gmail.com>
Date: Sat, 22 Mar 2025 21:58:11 +0530
From: Siddharth Menon <simeddon@...il.com>
To: linux-iio@...r.kernel.org,
lars@...afoo.de,
Michael.Hennerich@...log.com,
jic23@...nel.org,
gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev,
marcelo.schmitt1@...il.com,
Siddharth Menon <simeddon@...il.com>
Subject: [PATCH v2] 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@...il.com>
Signed-off-by: Siddharth Menon <simeddon@...il.com>
---
v1->v2:
- updated commit message to be more informative
- minor changes to code formatting
drivers/staging/iio/frequency/ad9832.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index 140ee4f9c137..7d4f655f6df1 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -431,6 +431,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},
@@ -441,6 +448,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,
--
2.48.1
Powered by blists - more mailing lists