mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 12:53:04 -04:00
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@gmail.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Siddharth Menon <simeddon@gmail.com> Link: https://patch.msgid.link/20250322163211.253009-1-simeddon@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
ad02ca57e4
commit
0b2a4f55cc
@@ -402,6 +402,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},
|
||||
@@ -412,6 +419,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,
|
||||
|
||||
Reference in New Issue
Block a user