Skip to contentSkip to conversation

thermal: thermal_hwmon: Convert to hwmon_device_register_with_info()

RFC In review Fabio Estevam 2 participants 3 messages Dec 27, 2016 Thermal

lore
Share & tools
lore
#0 lore raw

RFC 1/1 thermal: thermal_hwmon: Convert to hwmon_device_register_with_info()

From: Fabio Estevam <[email protected]>

Booting Linux on a mx6q based board leads to the following warning:

(NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().

,so do as suggested.

---
 drivers/thermal/thermal_hwmon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/thermal_hwmon.c +2 -1
index 541af59..22397dd 100644
@@ -165,7 +165,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 
 	INIT_LIST_HEAD(&hwmon->tz_list);
 	strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
-	hwmon->device = hwmon_device_register(NULL);
+	hwmon->device = hwmon_device_register_with_info(NULL, NULL, NULL,
+							NULL, NULL);
 	if (IS_ERR(hwmon->device)) {
 		result = PTR_ERR(hwmon->device);
 		goto free_mem;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 19 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Booting Linux on a mx6q based board leads to the following warning:

(NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().

,so do as suggested.

---
 drivers/thermal/thermal_hwmon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/thermal_hwmon.c +0 -0
index 541af59..22397dd 100644

drivers/thermal/thermal_hwmon.c int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) · line 169

Quoted 6 lines
drivers/thermal/thermal_hwmon.c +2 -1
@@ -165,7 +165,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
 
 	INIT_LIST_HEAD(&hwmon->tz_list);
 	strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
-	hwmon->device = hwmon_device_register(NULL);
+	hwmon->device = hwmon_device_register_with_info(NULL, NULL, NULL,
+							NULL, NULL);

Interesting way of defeating the purpose ;-).

Any interest in at least trying (NULL, hwmon->type, hwmon, NULL, NULL) ?

This should result in the core taking care of creating the 'name' attribute, so it should be possible to drop the code doing that from the thermal driver.

Guenter

Quoted 4 lines
drivers/thermal/thermal_hwmon.c +0 -0
 	if (IS_ERR(hwmon->device)) {
 		result = PTR_ERR(hwmon->device);
 		goto free_mem;
#2 lore raw
Quoted 1 line · Guenter Roeck

Interesting way of defeating the purpose ;-).

Yes, that's why I marked it as RFC. Thanks for your feedback.

Quoted 1 line

Any interest in at least trying (NULL, hwmon->type, hwmon, NULL, NULL) ?

Yes, it works.

Quoted 3 lines

This should result in the core taking care of creating the 'name' attribute, so it should be possible to drop the code doing that from the thermal driver.

Correct. I had to remove the device_create_file() call from the thermal driver so that it can successfully probe.

Will resend it soon, thanks!