Skip to contentSkip to conversation

iio: frequency: ad9832: devicetree probing support

PATCH Applied Siddharth Menon 3 participants 7 messages Mar 22, 2025 – Apr 28, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
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(+)
drivers/staging/iio/frequency/ad9832.c +8 -0
index 140ee4f9c137..7d4f655f6df1 100644
@@ -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,
Signature · 1 line
2.48.1
maintainer Applied
#1 lore raw
Quoted 7 lines · On Sat, 22 Mar 2025 21:58:11 +0530 Siddharth Menon <[email protected]> wrote:

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.

---

Marcelo gave a Reviewed-by tag. This time I've picked it up manually but in general it is the responsibility of the submitter to include those on new versions. Obviously sometimes things race though so maybe that is what happened here!

Applied

Thanks,

Jonathan

Quoted 32 lines

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(+)
drivers/staging/iio/frequency/ad9832.c +8 -0
index 140ee4f9c137..7d4f655f6df1 100644
@@ -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 lore raw
Quoted 4 lines · Jonathan Cameron

Marcelo gave a Reviewed-by tag. This time I've picked it up manually but in general it is the responsibility of the submitter to include those on new versions. Obviously sometimes things race though so maybe that is what happened here!

Sorry, I was unsure whether the tag still applied after modifying a patch or if it needed to be reviewed again.

Thanks,
Siddharth Menon

maintainer
#3 lore raw
Quoted 8 lines · On Mon, 24 Mar 2025 03:19:31 +0530 Siddharth Menon <[email protected]> wrote:
Quoted 4 lines · Jonathan Cameron

Marcelo gave a Reviewed-by tag. This time I've picked it up manually but in general it is the responsibility of the submitter to include those on new versions. Obviously sometimes things race though so maybe that is what happened here!

Sorry, I was unsure whether the tag still applied after modifying a patch or if it needed to be reviewed again.

It is up to you as the submitter to make that decision, but if you do drop a tag due to changes, I'd expect to see a comment under the --- (alongside the change log) saying why.

Jonathan

Quoted 3 lines

Thanks,
Siddharth Menon

#4 lore raw
In reply to Siddharth Menon
Quoted 18 lines · Siddharth Menon

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.

---
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(+)
drivers/staging/iio/frequency/ad9832.c +0 -0
index 140ee4f9c137..7d4f655f6df1 100644

drivers/staging/iio/frequency/ad9832.c static int ad9832_probe(struct spi_device *spi) · line 436

Quoted 6 lines
drivers/staging/iio/frequency/ad9832.c +3 -0
@@ -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" },

Is there some reason we can't add a binding for this?

Rob

maintainer
#5 lore raw
Quoted 22 lines · On Wed, 16 Apr 2025 13:58:46 -0500 Rob Herring <[email protected]> wrote:
Quoted 21 lines · Siddharth Menon

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.

---
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(+)
drivers/staging/iio/frequency/ad9832.c +0 -0
index 140ee4f9c137..7d4f655f6df1 100644
@@ -431,6 +431,13 @@ static int ad9832_probe(struct spi_device *spi)
 	return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
Quoted 6 lines

drivers/staging/iio/frequency/ad9832.c static int ad9832_probe(struct spi_device *spi) · line 436

Quoted 3 lines
drivers/staging/iio/frequency/ad9832.c +3 -0
+static const struct of_device_id ad9832_of_match[] = {
+	{ .compatible = "adi,ad9832" },
+	{ .compatible = "adi,ad9835" },  

Is there some reason we can't add a binding for this?

It might take some thought on how to actually describe some aspects of this device that aren't yet supported by the driver,
but in principle we certainly should. For drivers that have been in staging a long time I'm a little reluctant to do merge a binding until we are fairly sure the driver is going to move out of staging though.

Quoted 1 line
#6 lore raw
Quoted 31 lines · Jonathan Cameron
Quoted 22 lines · On Wed, 16 Apr 2025 13:58:46 -0500 Rob Herring <[email protected]> wrote:
Quoted 21 lines · Siddharth Menon

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.

---
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(+)
drivers/staging/iio/frequency/ad9832.c +0 -0
index 140ee4f9c137..7d4f655f6df1 100644
@@ -431,6 +431,13 @@ static int ad9832_probe(struct spi_device *spi)
 	return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
Quoted 6 lines

drivers/staging/iio/frequency/ad9832.c static int ad9832_probe(struct spi_device *spi) · line 436

Quoted 3 lines
drivers/staging/iio/frequency/ad9832.c +3 -0
+static const struct of_device_id ad9832_of_match[] = {
+	{ .compatible = "adi,ad9832" },
+	{ .compatible = "adi,ad9835" },  

Is there some reason we can't add a binding for this?

Quoted 5 lines

It might take some thought on how to actually describe some aspects of this device that aren't yet supported by the driver,
but in principle we certainly should. For drivers that have been in staging a long time I'm a little reluctant to do merge a binding until we are fairly sure the driver is going to move out of staging though.

Okay, I suppose I could exclude staging from looking for compatible strings.

Rob