[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <72746bdfd8f74171943e41759b891c7af40627ec.1684579603.git.anupnewsmail@gmail.com>
Date: Sat, 20 May 2023 16:25:38 +0530
From: Anup Sharma <anupnewsmail@...il.com>
To: Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Anup Sharma <anupnewsmail@...il.com>,
Peter Meerwald <pmeerw@...erw.net>,
u.kleine-koenig@...gutronix.de, andriy.shevchenko@...ux.intel.com,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/2] iio: temperature: tmp006: Add OF device matching
support
Adds an of_device_id table entry to the driver, enabling
device matching through device tree. With this update, the driver
can now match devices using both the i2c_device_id entry and the
newly added of_device_id table.
Signed-off-by: Anup Sharma <anupnewsmail@...il.com>
---
Changes:
V1 -> V2: Keep the exsisting MODULE_DEVICE_TABLE entry.
Removed the inner comma in of_device_id.
Order the included header to improve code organization.
---
drivers/iio/temperature/tmp006.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index cdf08477e63f..5f5a7450bd5b 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -15,6 +15,7 @@
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/pm.h>
#include <linux/bitops.h>
@@ -272,6 +273,12 @@ static int tmp006_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume);
+static const struct of_device_id tmp006_of_match[] = {
+ { .compatible = "ti,tmp006" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tmp006_of_match);
+
static const struct i2c_device_id tmp006_id[] = {
{ "tmp006", 0 },
{ }
@@ -281,6 +288,7 @@ MODULE_DEVICE_TABLE(i2c, tmp006_id);
static struct i2c_driver tmp006_driver = {
.driver = {
.name = "tmp006",
+ .of_match_table = tmp006_of_match,
.pm = pm_sleep_ptr(&tmp006_pm_ops),
},
.probe_new = tmp006_probe,
--
2.34.1
Powered by blists - more mailing lists