From: Siddharth Menon <simeddon@gmail.com>
To: linux-iio@vger.kernel.org, lars@metafoo.de,
Michael.Hennerich@analog.com, jic23@kernel.org,
gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
marcelo.schmitt1@gmail.com, Siddharth Menon <simeddon@gmail.com>
Subject: [PATCH v2] iio: frequency: ad9832: devicetree probing support
Date: Sat, 22 Mar 2025 21:58:11 +0530 [thread overview]
Message-ID: <20250322163211.253009-1-simeddon@gmail.com> (raw)
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>
Signed-off-by: Siddharth Menon <simeddon@gmail.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
next reply other threads:[~2025-03-22 16:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-22 16:28 Siddharth Menon [this message]
2025-03-23 12:02 ` [PATCH v2] iio: frequency: ad9832: devicetree probing support Jonathan Cameron
2025-03-23 21:49 ` Siddharth Menon
2025-03-30 16:40 ` Jonathan Cameron
2025-04-16 18:58 ` Rob Herring
2025-04-18 14:26 ` Jonathan Cameron
2025-04-28 16:06 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250322163211.253009-1-simeddon@gmail.com \
--to=simeddon@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=marcelo.schmitt1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).