diff options
| author | Flaviu Nistor <flaviu.nistor@gmail.com> | 2026-05-10 12:25:43 +0300 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-06-09 18:22:59 +0300 |
| commit | 624fce2eec59ab28fd05c235ee26d3cbf1cbef60 (patch) | |
| tree | 69cc84747c9cbb963f139313e923d24e70aa58cd | |
| parent | e28d0c73d4d7adc9cd3747d81fdc7338217f9a0c (diff) | |
| download | linux-624fce2eec59ab28fd05c235ee26d3cbf1cbef60.tar.xz | |
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.
Also drop the now unnecessary __maybe_unused from tmp102_of_match.
Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
Link: https://lore.kernel.org/r/20260510092543.12352-1-flaviu.nistor@gmail.com
Link: https://lore.kernel.org/r/20260518122210.10288-1-flaviu.nistor@gmail.com
[groeck: Combined API change with __maybe_unused patch]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| -rw-r--r-- | drivers/hwmon/tmp102.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index 3aa1a3fbeaa9..ad525c55daf0 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c @@ -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); @@ -400,7 +401,7 @@ static const struct i2c_device_id tmp102_id[] = { }; MODULE_DEVICE_TABLE(i2c, tmp102_id); -static const struct of_device_id __maybe_unused tmp102_of_match[] = { +static const struct of_device_id tmp102_of_match[] = { { .compatible = "ti,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, |
