Skip to contentSkip to conversation

iio: srf08: add device tree table

PATCH Superseded Andreas Klinger 2 participants 2 messages Aug 2, 2017 – Aug 12, 2017

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Andreas Klinger

author maintainer
#0 lore raw

PATCH 4/7 iio: srf08: add device tree table

Added MODULE_DEVICE_TABLE for device tree bindings.

It used to work without it by using the i2c_device_id table, but adding the table makes everything clear and documented.

---
 drivers/iio/proximity/srf08.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/iio/proximity/srf08.c +9 -0
index 92e1799c430c..a2913a5bf68e 100644
@@ -455,6 +455,14 @@ static int srf08_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
+static const struct of_device_id of_srf08_match[] = {
+	{ .compatible = "devantech,srf08", (void *)SRF08},
+	{ .compatible = "devantech,srf10", (void *)SRF10},
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, of_srf08_match);
+
 static const struct i2c_device_id srf08_id[] = {
 	{ "srf08", SRF08 },
 	{ "srf10", SRF10 },
@@ -465,6 +473,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);
 static struct i2c_driver srf08_driver = {
 	.driver = {
 		.name	= "srf08",
+		.of_match_table	= of_srf08_match,
 	},
 	.probe = srf08_probe,
 	.id_table = srf08_id,
Signature · 4 lines
2.1.4


-- 
maintainer
#1 lore raw
Quoted 6 lines · On Thu, 3 Aug 2017 01:25:04 +0200 Andreas Klinger <[email protected]> wrote:

Added MODULE_DEVICE_TABLE for device tree bindings.

It used to work without it by using the i2c_device_id table, but adding the table makes everything clear and documented.

Looks fine. Will pick up once the rest are sorted.

Jonathan

Quoted 31 lines
---
 drivers/iio/proximity/srf08.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/iio/proximity/srf08.c +9 -0
index 92e1799c430c..a2913a5bf68e 100644
@@ -455,6 +455,14 @@ static int srf08_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
+static const struct of_device_id of_srf08_match[] = {
+	{ .compatible = "devantech,srf08", (void *)SRF08},
+	{ .compatible = "devantech,srf10", (void *)SRF10},
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, of_srf08_match);
+
 static const struct i2c_device_id srf08_id[] = {
 	{ "srf08", SRF08 },
 	{ "srf10", SRF10 },
@@ -465,6 +473,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);
 static struct i2c_driver srf08_driver = {
 	.driver = {
 		.name	= "srf08",
+		.of_match_table	= of_srf08_match,
 	},
 	.probe = srf08_probe,
 	.id_table = srf08_id,