Re: [PATCH 2/4] hwmon: (adt7475) Convert to hwmon_device_register_with_info()

From: Guenter Roeck

Date: Sun Nov 15 2026 - 19:42:04 EST


On 11/15/26 14:41, Davíð Steinn Geirsson wrote:
...
Apologies if that's how it came off, that was not the intent. I
understand your earlier guidance that new drivers need to use the hwmon
subsystem lock for this kind of thing. The reason I mentioned those
other drivers was to try to explain why I believe this is a novel issue
other hwmon drivers have not hit before.


The pwm maintainer (Wolfgang) insists that all chips with pwm output,
including fan controllers like this one, register with the pwm subsystem
as pwm controllers. I resisted that for a long time because I find that
it adds pointless complexity, but that time is gone. People now find
reasons, such as claiming that they want to connect LEDs instead of fans,
to those pwm outputs. This results in recursive calls into the hwmon
subsystem, for example if such a pwm output is indeed connected to a fan
and the pwm-fan driver is used to control it. Yes, this is novel. I never
imagined that this would ever be the case. That happens when new and
more complex use cases are introduced into a system.

...



Anyway, you want to add the complexity of getting the pwm subsystem and
the pwm-fan driver involved, even though this could as well be handled
in the adt7475 driver, so you'll have to suffer the consequences.

I have no attachment to this implementation, in truth I just expected an
adt7475 driver registering cooling devices itself would be rejected. If

It appears that you had no problems finding examples for drivers not (or rather
not yet) using the hardware monitoring subsystem lock. Yet, it seems that you
had trouble finding hardware monitoring drivers which also register cooling
devices (besides pwm-fan). Here are some for reference.

$ git grep devm_thermal_of_child_cooling_device_register
amc6821.c: return PTR_ERR_OR_ZERO(devm_thermal_of_child_cooling_device_register(dev,
aspeed-pwm-tacho.c: cdev->tcdev = devm_thermal_of_child_cooling_device_register(dev, child,
emc2305.c: devm_thermal_of_child_cooling_device_register(dev, fan_node,
gpio-fan.c: fan_data->cdev = devm_thermal_of_child_cooling_device_register(dev, np,
max6650.c: cooling_dev = devm_thermal_of_child_cooling_device_register(dev, dev->of_node,
npcm750-pwm-fan.c: cdev->tcdev = devm_thermal_of_child_cooling_device_register(dev, child,
pwm-fan.c: cdev = devm_thermal_of_child_cooling_device_register(dev, dev->of_node,
qnap-mcu-hwmon.c: cdev = devm_thermal_of_child_cooling_device_register(dev, to_of_node(hwm->fan_node),
tc654.c: cdev = devm_thermal_of_child_cooling_device_register(dev, dev->of_node,

Of those, amc6821, emc2305 and max6650, are quite similar to adt7475.

Anyway, I instructed my AI agent to look into the problem and fix it,
so I'll send a patch to fix the problem shortly.

Thanks,
Guenter