Re: [PATCH 1/1] hwmon: (applesmc) Convert to hwmon_device_register_with_info
From: Guenter Roeck
Date: Fri Jul 10 2026 - 10:06:44 EST
On 7/10/26 05:32, Shih-Yuan Lee wrote:
The legacy hwmon_device_register() function is deprecated and triggers a
warning in dmesg during driver initialization:
[ 24.706091] applesmc: key=620 fan=0 temp=37 index=36 acc=0 lux=2 kbd=0
[ 24.706270] applesmc applesmc.768: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().
To silence this warning, convert the driver to use the modern
hwmon_device_register_with_info() API.
Because the driver creates all its sysfs attributes dynamically on the platform
device, we define a minimal struct hwmon_chip_info with a single temperature
channel and implement a visibility callback that returns 0 (hidden) for it.
This satisfies the new API requirements while keeping all existing sysfs paths
and attributes completely unchanged, ensuring backwards compatibility.
Novel, but that would completely defeat the purpose of the new API.
NACK.
Guenter