Re: [lm-sensors] [PATCH 2/3] hwmon: ads7828: Add devicetree support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 07/22/2015 09:30 AM, Denis Carikli wrote:
Signed-off-by: Denis Carikli <denis@xxxxxxxxxx>
---

i2c drivers do not need explicit devicetree support.

Guenter

  drivers/hwmon/ads7828.c | 11 +++++++++++
  1 file changed, 11 insertions(+)

diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c
index 6c99ee7..a2d297f 100644
--- a/drivers/hwmon/ads7828.c
+++ b/drivers/hwmon/ads7828.c
@@ -31,6 +31,7 @@
  #include <linux/i2c.h>
  #include <linux/init.h>
  #include <linux/module.h>
+#include <linux/of.h>
  #include <linux/platform_data/ads7828.h>
  #include <linux/regmap.h>
  #include <linux/slab.h>
@@ -160,6 +161,15 @@ static int ads7828_probe(struct i2c_client *client,
  	return PTR_ERR_OR_ZERO(hwmon_dev);
  }

+#ifdef CONFIG_OF
+static const struct of_device_id ads7828_of_match[] = {
+	{ .compatible = "ti,ads7828", .data = (void *) ads7828, },
+	{ .compatible = "ti,ads7830", .data = (void *) ads7830, },
+
+};
+MODULE_DEVICE_TABLE(of, ads7828_of_match);
+#endif
+
  static const struct i2c_device_id ads7828_device_ids[] = {
  	{ "ads7828", ads7828 },
  	{ "ads7830", ads7830 },
@@ -170,6 +180,7 @@ MODULE_DEVICE_TABLE(i2c, ads7828_device_ids);
  static struct i2c_driver ads7828_driver = {
  	.driver = {
  		.name = "ads7828",
+		.of_match_table = of_match_ptr(ads7828_of_match),
  	},

  	.id_table = ads7828_device_ids,


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux