Skip to contentSkip to conversation

hwmon: (tmp102) Use device_property_read_string API

PATCH Applied Flaviu Nistor 2 participants 2 messages May 10 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hwmon: (tmp102) Use device_property_read_string API

Replace of_property_read_string() with the preferded device_property_read_string() in the probe function to read the device label property, improving the driver compatibility since this method is not limited to Device Tree only.

---
Changes in v3:
- Remove of_match_ptr() as identified in:
https://sashiko.dev/#/patchset/[email protected]?part=1
- Link to v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
- Add/remove include files suggested by Guenter Roeck.
- Link to v1: https://lore.kernel.org/all/[email protected]/

 drivers/hwmon/tmp102.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/hwmon/tmp102.c +4 -3
index 3aa1a3fbeaa9..055ee7fe6351 100644
@@ -15,7 +15,8 @@
 #include <linux/jiffies.h>
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
 
 #define	DRIVER_NAME "tmp102"
 
@@ -313,7 +314,7 @@ static int tmp102_probe(struct i2c_client *client)
 	if (!tmp102)
 		return -ENOMEM;
 
-	of_property_read_string(dev->of_node, "label", &tmp102->label);
+	device_property_read_string(dev, "label", &tmp102->label);
 
 	i2c_set_clientdata(client, tmp102);
 
@@ -408,7 +409,7 @@ MODULE_DEVICE_TABLE(of, tmp102_of_match);
 
 static struct i2c_driver tmp102_driver = {
 	.driver.name	= DRIVER_NAME,
-	.driver.of_match_table = of_match_ptr(tmp102_of_match),
+	.driver.of_match_table = tmp102_of_match,
 	.driver.pm	= pm_sleep_ptr(&tmp102_dev_pm_ops),
 	.probe		= tmp102_probe,
 	.id_table	= tmp102_id,
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Flaviu Nistor

Replace of_property_read_string() with the preferded device_property_read_string() in the probe function to read the device label property, improving the driver compatibility since this method is not limited to Device Tree only.

Applied.

Thanks,
Guenter