Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] hwmon: (tmp102) Change mode to read label property
@ 2026-05-09 11:24 Flaviu Nistor
  2026-05-09 11:37 ` sashiko-bot
  2026-05-09 11:39 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Flaviu Nistor @ 2026-05-09 11:24 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Flaviu Nistor, linux-hwmon, linux-kernel

Replace of_property_read_string() with the preferred
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.

Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
---
 drivers/hwmon/tmp102.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index 3aa1a3fbeaa9..a89cc49798f5 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -313,7 +313,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);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (tmp102) Change mode to read label property
  2026-05-09 11:24 [PATCH] hwmon: (tmp102) Change mode to read label property Flaviu Nistor
@ 2026-05-09 11:37 ` sashiko-bot
  2026-05-09 11:39 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-05-09 11:37 UTC (permalink / raw)
  To: Flaviu Nistor; +Cc: linux-hwmon

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Incomplete transition to firmware-agnostic API due to remaining `of_match_ptr()` usage.
- [Low] Missing inclusion of `<linux/property.h>` for `device_property_read_string()`.
--

commit 1666c25db837ad9f0af1e26c9adc185e78ab62e5
Author: Flaviu Nistor <flaviu.nistor@gmail.com>

hwmon: (tmp102) Change mode to read label property

This commit replaces the Device Tree specific of_property_read_string()
with the firmware-agnostic device_property_read_string() in the probe
function. This is intended to improve driver compatibility beyond just
Device Tree.

>     Replace of_property_read_string() with the preferred
>     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.

If the goal is to improve compatibility beyond Device Tree, should the
driver also drop the use of of_match_ptr() around the match table?

When the kernel is configured without CONFIG_OF (such as on ACPI-only
systems leveraging PRP0001 for DT-style matching), of_match_ptr() evaluates
to NULL.

This drops the match table entirely and prevents the driver from binding,
which seems to contradict the intent of this patch.

> diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
> index 3aa1a3fbeaa92..a89cc49798f54 100644
> --- a/drivers/hwmon/tmp102.c
> +++ b/drivers/hwmon/tmp102.c
> @@ -313,7 +313,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);

Does this code require an explicit inclusion of <linux/property.h>?

While it may currently compile due to implicit transitive includes, relying
on them is fragile and could cause build regressions if those headers are
refactored in the future.

>  
>  	i2c_set_clientdata(client, tmp102);
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260509112417.51164-1-flaviu.nistor@gmail.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (tmp102) Change mode to read label property
  2026-05-09 11:24 [PATCH] hwmon: (tmp102) Change mode to read label property Flaviu Nistor
  2026-05-09 11:37 ` sashiko-bot
@ 2026-05-09 11:39 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-05-09 11:39 UTC (permalink / raw)
  To: Flaviu Nistor; +Cc: linux-hwmon, linux-kernel

On 5/9/26 04:24, Flaviu Nistor wrote:
> Replace of_property_read_string() with the preferred
> 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.
> 

The subject of this patch is completely off ...
"change mode" - what does this even mean ?

> Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
> ---
>   drivers/hwmon/tmp102.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
> index 3aa1a3fbeaa9..a89cc49798f5 100644
> --- a/drivers/hwmon/tmp102.c
> +++ b/drivers/hwmon/tmp102.c
> @@ -313,7 +313,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);
>   

Changing this also requires changing include files.
Instead of including linux/of.h, you'll need to include
linux/mod_devicetable.h and linux/property.h.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-09 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09 11:24 [PATCH] hwmon: (tmp102) Change mode to read label property Flaviu Nistor
2026-05-09 11:37 ` sashiko-bot
2026-05-09 11:39 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox