Skip to contentSkip to conversation

staging: iio: ad7746: add device tree support

PATCH In review João Seckler 2 participants 3 messages May 18, 2019 – May 19, 2019

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

PATCH 1/1 staging: iio: ad7746: add device tree support

Add a of_device_id struct variable and subsequent call to MODULE_DEVICE_TABLE macro to support device tree.

---
 drivers/staging/iio/cdc/ad7746.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/staging/iio/cdc/ad7746.c +10 -0
index 47610d863908..21527d84f940 100644
@@ -748,9 +748,19 @@ static const struct i2c_device_id ad7746_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, ad7746_id);
 
+static const struct of_device_id ad7746_of_match[] = {
+	{ .compatible = "adi,ad7745" },
+	{ .compatible = "adi,ad7746" },
+	{ .compatible = "adi,ad7747" },
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, ad7746_of_match);
+
 static struct i2c_driver ad7746_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
+		.of_match_table = ad7746_of_match,
 	},
 	.probe = ad7746_probe,
 	.id_table = ad7746_id,
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 6 lines · On Sat, 18 May 2019 19:27:33 -0300 João Seckler <[email protected]> wrote:

Add a of_device_id struct variable and subsequent call to MODULE_DEVICE_TABLE macro to support device tree.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

For a future improvement, try to explain the 'why' rather than
'what' of a patch in the description. This particular change
is so common I don't mind that much, but it is a good habit to get into!

Thanks,

Jonathan

Quoted 28 lines
---
 drivers/staging/iio/cdc/ad7746.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/staging/iio/cdc/ad7746.c +10 -0
index 47610d863908..21527d84f940 100644
@@ -748,9 +748,19 @@ static const struct i2c_device_id ad7746_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, ad7746_id);
 
+static const struct of_device_id ad7746_of_match[] = {
+	{ .compatible = "adi,ad7745" },
+	{ .compatible = "adi,ad7746" },
+	{ .compatible = "adi,ad7747" },
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, ad7746_of_match);
+
 static struct i2c_driver ad7746_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
+		.of_match_table = ad7746_of_match,
 	},
 	.probe = ad7746_probe,
 	.id_table = ad7746_id,
maintainer
#2 lore raw
Quoted 9 lines · On Sun, 19 May 2019 12:02:50 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 6 lines · On Sat, 18 May 2019 19:27:33 -0300 João Seckler <[email protected]> wrote:

Add a of_device_id struct variable and subsequent call to MODULE_DEVICE_TABLE macro to support device tree.

Quoted 7 lines

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

For a future improvement, try to explain the 'why' rather than
'what' of a patch in the description. This particular change
is so common I don't mind that much, but it is a good habit to get into!

Ah, you do say to support device tree at the end, but more detail on that would have been good!

Thanks,

J

Quoted 33 lines

Thanks,

Jonathan

Quoted 28 lines
---
 drivers/staging/iio/cdc/ad7746.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/staging/iio/cdc/ad7746.c +10 -0
index 47610d863908..21527d84f940 100644
@@ -748,9 +748,19 @@ static const struct i2c_device_id ad7746_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, ad7746_id);
 
+static const struct of_device_id ad7746_of_match[] = {
+	{ .compatible = "adi,ad7745" },
+	{ .compatible = "adi,ad7746" },
+	{ .compatible = "adi,ad7747" },
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, ad7746_of_match);
+
 static struct i2c_driver ad7746_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
+		.of_match_table = ad7746_of_match,
 	},
 	.probe = ad7746_probe,
 	.id_table = ad7746_id,