Re: [PATCH v4 2/2] hwmon: add AMD Promontory 21 xHCI temperature sensor support

From: Jihong Min

Date: Fri May 08 2026 - 13:39:13 EST


> I am sure I understand the reasoning here. What is the problem if it is attached
> to the auxiliary device ? Other drivers do that, so I don't immediate see why
> that would be a problem here.

I kept the hwmon device parented to the PCI function intentionally because the
temperature value is read from that PCI function's MMIO BAR, and systems may
have more than one PROM21 xHCI PCI function.

If the hwmon device is parented to the auxiliary device, userspace may report it
as a virtual adapter. Parenting it to the PCI function lets userspace identify
which PCI endpoint each reading belongs to, which is useful on systems with
multiple PROM21 xHCI functions.

The auxiliary driver still owns the hwmon lifetime. Its remove path unregisters
the hwmon device before the PROM21 xHCI PCI glue tears down the HCD/MMIO
mapping.

> +#include <linux/math.h>
>
> Is this needed ?

Yes. It is used for DIV_ROUND_CLOSEST() in the raw-to-millicelsius conversion.

The other review comments have been addressed locally, including dropping the
extra mutex, removing the unnecessary channel checks, passing the MMIO resource
through platform data instead of looking at the parent's driver data, removing
the redundant hwmon ABI wording from the documentation, and the small style
cleanups.

Following Mario's advice from the v3 discussion, I will wait for the current
review discussion to settle before sending v5. I am keeping the current
work-in-progress branch here for reference only:

  https://github.com/hurryman2212/linux/tree/prom21_hwmon

Sincerely,
Jihong Min