diff mbox series

[v1,2/3] hwmon: (sht3x) add devicetree support

Message ID DB4PR10MB62613726F6A32B31A9B31F109226A@DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM (mailing list archive)
State Changes Requested
Headers show
Series [v1,1/3] hwmon: (sht3x) convert some of sysfs interface to hwmon | expand

Commit Message

JuenKit Yip June 26, 2023, 7:29 a.m. UTC
From: JuenKit Yip <JuenKit_Yip@hotmail.com>

add "compatible" property for supporting devicetree

Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
---
v1:
  - add MODULE_DEVICE_TABLE(of, sht3x_of_match)
  - drop of_match_ptr

 drivers/hwmon/sht3x.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
index bd483af1c5ab..46b0a0231b06 100644
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -911,8 +911,19 @@  static int sht3x_probe(struct i2c_client *client)
 	return PTR_ERR_OR_ZERO(hwmon_dev);
 }
 
+/* devicetree ID table */
+static const struct of_device_id sht3x_of_match[] = {
+	{ .compatible = "sensirion,sht3x" },
+	{ .compatible = "sensirion,sts3x" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, sht3x_of_match);
+
 static struct i2c_driver sht3x_i2c_driver = {
-	.driver.name = "sht3x",
+	.driver = {
+		.name = "sht3x",
+		.of_match_table = sht3x_of_match,
+	},
 	.probe       = sht3x_probe,
 	.id_table    = sht3x_ids,
 };