Re: [PATCH] ACPI: fan: Add hwmon support

From: Thomas Weißschuh
Date: Mon Apr 08 2024 - 11:12:19 EST


Hi,

On 2024-04-08 14:37:18+0200, Armin Wolf wrote:
> Currently, the driver does only supports a custom sysfs
> interface to allow userspace to read the fan speed.
> Add support for the standard hwmon interface so users
> can read the fan speed with standard tools like "sensors".
>
> Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
> ---
> drivers/acpi/Makefile | 1 +
> drivers/acpi/fan.h | 2 ++
> drivers/acpi/fan_core.c | 7 ++++
> drivers/acpi/fan_hwmon.c | 78 ++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 88 insertions(+)
> create mode 100644 drivers/acpi/fan_hwmon.c

[snip]

> +
> +int devm_acpi_fan_create_hwmon(struct acpi_device *device)
> +{
> + struct device *hdev;
> +
> + hdev = devm_hwmon_device_register_with_info(&device->dev, "acpi_fan", device,
> + &acpi_fan_chip_info, NULL);

This fails to link if CONFIG_ACPI_FAN=y and CONFIG_HWMON=n:

ld: vmlinux.o: in function `devm_acpi_fan_create_hwmon':
../drivers/acpi/fan_hwmon.c:74:(.text+0x819e65): undefined reference to `devm_hwmon_device_register_with_info'

With this fixed:

Reviewed-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>

> +
> + return PTR_ERR_OR_ZERO(hdev);
> +}
> --
> 2.39.2
>
>