[PATCH v2 3/5] iio: adc: ad4130: Add SPI device ID table

Jonathan Santos posted 5 patches 3 weeks ago
There is a newer version of this series
[PATCH v2 3/5] iio: adc: ad4130: Add SPI device ID table
Posted by Jonathan Santos 3 weeks ago
Add SPI device ID table to enable non-device tree based device binding.
The id_table provides a fallback matching mechanism when of_match_table
cannot be used, which is required for proper SPI driver registration.

Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
---
Changes in v2:
* New patch.
---
 drivers/iio/adc/ad4130.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/ad4130.c b/drivers/iio/adc/ad4130.c
index 5567ae5dee88..94cb6af0c4c5 100644
--- a/drivers/iio/adc/ad4130.c
+++ b/drivers/iio/adc/ad4130.c
@@ -2109,12 +2109,19 @@ static const struct of_device_id ad4130_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ad4130_of_match);
 
+static const struct spi_device_id ad4130_id_table[] = {
+	{ "ad4130", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(spi, ad4130_id_table);
+
 static struct spi_driver ad4130_driver = {
 	.driver = {
 		.name = AD4130_NAME,
 		.of_match_table = ad4130_of_match,
 	},
 	.probe = ad4130_probe,
+	.id_table = ad4130_id_table,
 };
 module_spi_driver(ad4130_driver);
 
-- 
2.34.1
Re: [PATCH v2 3/5] iio: adc: ad4130: Add SPI device ID table
Posted by Andy Shevchenko 3 weeks ago
On Mon, Mar 16, 2026 at 08:45:26AM -0300, Jonathan Santos wrote:
> Add SPI device ID table to enable non-device tree based device binding.
> The id_table provides a fallback matching mechanism when of_match_table
> cannot be used, which is required for proper SPI driver registration.

...

> +static const struct spi_device_id ad4130_id_table[] = {
> +	{ "ad4130", 0 },

No ', 0' part, please.

> +	{ }
> +};

-- 
With Best Regards,
Andy Shevchenko