On 10/02/2018 06:33 PM, Cao Van Dong wrote:
Dear Guenter-san,

Thanks for your comment!

In __hwmon_device_register() function of hwmon.c, we have assigned 'dev' directly 
to 'hdev->parent'.
Formerly, when registering the hwmon device, we pass NULL as the device. This 
is not affected.
Recently, the developer has replaced the parameter NULL as the device by the 
actual device.
This causes the "No sensors found" error. This patch is to fix this error.

This patch is based on the v4.19-rc3 tag.


NACK.

This is wrong. The passed device is the hwmon driver's parent device. Using 
that device's
parent would be wrong. Indeed, that device could be a platform device with no 
parent.
Maybe I did not know all problem. If I'm wrong, sorry for the inconvenience.

The problem must be fixed in the calling code.

I will see the feedback from Marc-san.


The "No sensors found" message is from the "sensors" application.
The device type associated with the passed device is unknown to
libsensors (it is parsed from the parent device subsystem name -
what is that, anyway ?). This could be addressed in libsensors,
or the thermal subsystem could attach itself to a known subsystem,
or the thermal subsystem must pass a pointer the parent device.

Again, trying to address the problem in the hwmon core is simply wrong.

Guenter


Regards,
Dong/Jinso

---
  drivers/hwmon/hwmon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 33d5128..7c8d3cb 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -610,7 +610,7 @@ __hwmon_device_register(struct device *dev, const char 
*name, void *drvdata,
        hwdev->name = name;
      hdev->class = &hwmon_class;
-    hdev->parent = dev;
+    hdev->parent = dev->parent;
      hdev->of_node = dev ? dev->of_node : NULL;
      hwdev->chip = chip;
      dev_set_drvdata(hdev, drvdata);


Reply via email to