mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jihong Min <hurryman2212@gmail.com>
Cc: linux-hwmon@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-api@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] hwmon: Export sensor and attribute definitions to userspace
Date: Sun, 18 Oct 2026 08:52:47 -0700	[thread overview]
Message-ID: <7d3e68b2-3abb-4bf8-bf0b-c8590006dc4d@roeck-us.net> (raw)
In-Reply-To: <583573c30df45e4498737a89138e6f4f8911c631.1791559095.git.hurryman2212@gmail.com>

On Sat, Oct 10, 2026 at 12:38:40AM +0900, Jihong Min wrote:
> Move sensor types, attribute identifiers and configuration bits to
> linux/hwmon.h in the UAPI so kernel and userspace drivers share them.
> Keep existing values unchanged and use userspace-safe bit definitions.
> 
> Keep operations, channel structures and registration helpers in the
> kernel header.
> 
> Assisted-by: Codex:gpt-6-astra
> Signed-off-by: Jihong Min <hurryman2212@gmail.com>

NACK. Those definitions are kernel internal and subject to change.

Guenter

> ---
>  MAINTAINERS                |   1 +
>  include/linux/hwmon.h      | 353 +----------------------------------
>  include/uapi/linux/hwmon.h | 372 +++++++++++++++++++++++++++++++++++++
>  3 files changed, 374 insertions(+), 352 deletions(-)
>  create mode 100644 include/uapi/linux/hwmon.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 65e8a4b5c90b..f3f0292832bb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11492,6 +11492,7 @@ F:	Documentation/hwmon/
>  F:	drivers/hwmon/
>  F:	include/linux/hwmon*.h
>  F:	include/trace/events/hwmon*.h
> +F:	include/uapi/linux/hwmon.h
>  K:	(devm_)?hwmon_device_(un)?register(|_with_groups|_with_info)
>  
>  HARDWARE RANDOM NUMBER GENERATOR CORE
> diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
> index dd713e193d0c..d48e0aa82bc5 100644
> --- a/include/linux/hwmon.h
> +++ b/include/linux/hwmon.h
> @@ -14,362 +14,11 @@
>  
>  #include <linux/bitops.h>
>  #include <linux/cleanup.h>
> +#include <uapi/linux/hwmon.h>
>  
>  struct device;
>  struct attribute_group;
>  
> -enum hwmon_sensor_types {
> -	hwmon_chip,
> -	hwmon_temp,
> -	hwmon_in,
> -	hwmon_curr,
> -	hwmon_power,
> -	hwmon_energy,
> -	hwmon_energy64,
> -	hwmon_humidity,
> -	hwmon_fan,
> -	hwmon_pwm,
> -	hwmon_intrusion,
> -	hwmon_max,
> -};
> -
> -enum hwmon_chip_attributes {
> -	hwmon_chip_temp_reset_history,
> -	hwmon_chip_in_reset_history,
> -	hwmon_chip_curr_reset_history,
> -	hwmon_chip_power_reset_history,
> -	hwmon_chip_register_tz,
> -	hwmon_chip_update_interval,
> -	hwmon_chip_update_interval_us,
> -	hwmon_chip_alarms,
> -	hwmon_chip_samples,
> -	hwmon_chip_curr_samples,
> -	hwmon_chip_in_samples,
> -	hwmon_chip_power_samples,
> -	hwmon_chip_temp_samples,
> -	hwmon_chip_beep_enable,
> -	hwmon_chip_pec,
> -};
> -
> -#define HWMON_C_TEMP_RESET_HISTORY	BIT(hwmon_chip_temp_reset_history)
> -#define HWMON_C_IN_RESET_HISTORY	BIT(hwmon_chip_in_reset_history)
> -#define HWMON_C_CURR_RESET_HISTORY	BIT(hwmon_chip_curr_reset_history)
> -#define HWMON_C_POWER_RESET_HISTORY	BIT(hwmon_chip_power_reset_history)
> -#define HWMON_C_REGISTER_TZ		BIT(hwmon_chip_register_tz)
> -#define HWMON_C_UPDATE_INTERVAL		BIT(hwmon_chip_update_interval)
> -#define HWMON_C_UPDATE_INTERVAL_US	BIT(hwmon_chip_update_interval_us)
> -#define HWMON_C_ALARMS			BIT(hwmon_chip_alarms)
> -#define HWMON_C_SAMPLES			BIT(hwmon_chip_samples)
> -#define HWMON_C_CURR_SAMPLES		BIT(hwmon_chip_curr_samples)
> -#define HWMON_C_IN_SAMPLES		BIT(hwmon_chip_in_samples)
> -#define HWMON_C_POWER_SAMPLES		BIT(hwmon_chip_power_samples)
> -#define HWMON_C_TEMP_SAMPLES		BIT(hwmon_chip_temp_samples)
> -#define HWMON_C_BEEP_ENABLE		BIT(hwmon_chip_beep_enable)
> -#define HWMON_C_PEC			BIT(hwmon_chip_pec)
> -
> -enum hwmon_temp_attributes {
> -	hwmon_temp_enable,
> -	hwmon_temp_input,
> -	hwmon_temp_type,
> -	hwmon_temp_lcrit,
> -	hwmon_temp_lcrit_hyst,
> -	hwmon_temp_min,
> -	hwmon_temp_min_hyst,
> -	hwmon_temp_max,
> -	hwmon_temp_max_hyst,
> -	hwmon_temp_crit,
> -	hwmon_temp_crit_hyst,
> -	hwmon_temp_emergency,
> -	hwmon_temp_emergency_hyst,
> -	hwmon_temp_alarm,
> -	hwmon_temp_lcrit_alarm,
> -	hwmon_temp_min_alarm,
> -	hwmon_temp_max_alarm,
> -	hwmon_temp_crit_alarm,
> -	hwmon_temp_emergency_alarm,
> -	hwmon_temp_fault,
> -	hwmon_temp_offset,
> -	hwmon_temp_label,
> -	hwmon_temp_lowest,
> -	hwmon_temp_highest,
> -	hwmon_temp_reset_history,
> -	hwmon_temp_rated_min,
> -	hwmon_temp_rated_max,
> -	hwmon_temp_beep,
> -};
> -
> -#define HWMON_T_ENABLE		BIT(hwmon_temp_enable)
> -#define HWMON_T_INPUT		BIT(hwmon_temp_input)
> -#define HWMON_T_TYPE		BIT(hwmon_temp_type)
> -#define HWMON_T_LCRIT		BIT(hwmon_temp_lcrit)
> -#define HWMON_T_LCRIT_HYST	BIT(hwmon_temp_lcrit_hyst)
> -#define HWMON_T_MIN		BIT(hwmon_temp_min)
> -#define HWMON_T_MIN_HYST	BIT(hwmon_temp_min_hyst)
> -#define HWMON_T_MAX		BIT(hwmon_temp_max)
> -#define HWMON_T_MAX_HYST	BIT(hwmon_temp_max_hyst)
> -#define HWMON_T_CRIT		BIT(hwmon_temp_crit)
> -#define HWMON_T_CRIT_HYST	BIT(hwmon_temp_crit_hyst)
> -#define HWMON_T_EMERGENCY	BIT(hwmon_temp_emergency)
> -#define HWMON_T_EMERGENCY_HYST	BIT(hwmon_temp_emergency_hyst)
> -#define HWMON_T_ALARM		BIT(hwmon_temp_alarm)
> -#define HWMON_T_MIN_ALARM	BIT(hwmon_temp_min_alarm)
> -#define HWMON_T_MAX_ALARM	BIT(hwmon_temp_max_alarm)
> -#define HWMON_T_CRIT_ALARM	BIT(hwmon_temp_crit_alarm)
> -#define HWMON_T_LCRIT_ALARM	BIT(hwmon_temp_lcrit_alarm)
> -#define HWMON_T_EMERGENCY_ALARM	BIT(hwmon_temp_emergency_alarm)
> -#define HWMON_T_FAULT		BIT(hwmon_temp_fault)
> -#define HWMON_T_OFFSET		BIT(hwmon_temp_offset)
> -#define HWMON_T_LABEL		BIT(hwmon_temp_label)
> -#define HWMON_T_LOWEST		BIT(hwmon_temp_lowest)
> -#define HWMON_T_HIGHEST		BIT(hwmon_temp_highest)
> -#define HWMON_T_RESET_HISTORY	BIT(hwmon_temp_reset_history)
> -#define HWMON_T_RATED_MIN	BIT(hwmon_temp_rated_min)
> -#define HWMON_T_RATED_MAX	BIT(hwmon_temp_rated_max)
> -#define HWMON_T_BEEP		BIT(hwmon_temp_beep)
> -
> -enum hwmon_in_attributes {
> -	hwmon_in_enable,
> -	hwmon_in_input,
> -	hwmon_in_min,
> -	hwmon_in_max,
> -	hwmon_in_lcrit,
> -	hwmon_in_crit,
> -	hwmon_in_average,
> -	hwmon_in_lowest,
> -	hwmon_in_highest,
> -	hwmon_in_reset_history,
> -	hwmon_in_label,
> -	hwmon_in_alarm,
> -	hwmon_in_min_alarm,
> -	hwmon_in_max_alarm,
> -	hwmon_in_lcrit_alarm,
> -	hwmon_in_crit_alarm,
> -	hwmon_in_rated_min,
> -	hwmon_in_rated_max,
> -	hwmon_in_beep,
> -	hwmon_in_fault,
> -};
> -
> -#define HWMON_I_ENABLE		BIT(hwmon_in_enable)
> -#define HWMON_I_INPUT		BIT(hwmon_in_input)
> -#define HWMON_I_MIN		BIT(hwmon_in_min)
> -#define HWMON_I_MAX		BIT(hwmon_in_max)
> -#define HWMON_I_LCRIT		BIT(hwmon_in_lcrit)
> -#define HWMON_I_CRIT		BIT(hwmon_in_crit)
> -#define HWMON_I_AVERAGE		BIT(hwmon_in_average)
> -#define HWMON_I_LOWEST		BIT(hwmon_in_lowest)
> -#define HWMON_I_HIGHEST		BIT(hwmon_in_highest)
> -#define HWMON_I_RESET_HISTORY	BIT(hwmon_in_reset_history)
> -#define HWMON_I_LABEL		BIT(hwmon_in_label)
> -#define HWMON_I_ALARM		BIT(hwmon_in_alarm)
> -#define HWMON_I_MIN_ALARM	BIT(hwmon_in_min_alarm)
> -#define HWMON_I_MAX_ALARM	BIT(hwmon_in_max_alarm)
> -#define HWMON_I_LCRIT_ALARM	BIT(hwmon_in_lcrit_alarm)
> -#define HWMON_I_CRIT_ALARM	BIT(hwmon_in_crit_alarm)
> -#define HWMON_I_RATED_MIN	BIT(hwmon_in_rated_min)
> -#define HWMON_I_RATED_MAX	BIT(hwmon_in_rated_max)
> -#define HWMON_I_BEEP		BIT(hwmon_in_beep)
> -#define HWMON_I_FAULT		BIT(hwmon_in_fault)
> -
> -enum hwmon_curr_attributes {
> -	hwmon_curr_enable,
> -	hwmon_curr_input,
> -	hwmon_curr_min,
> -	hwmon_curr_max,
> -	hwmon_curr_lcrit,
> -	hwmon_curr_crit,
> -	hwmon_curr_average,
> -	hwmon_curr_lowest,
> -	hwmon_curr_highest,
> -	hwmon_curr_reset_history,
> -	hwmon_curr_label,
> -	hwmon_curr_alarm,
> -	hwmon_curr_min_alarm,
> -	hwmon_curr_max_alarm,
> -	hwmon_curr_lcrit_alarm,
> -	hwmon_curr_crit_alarm,
> -	hwmon_curr_rated_min,
> -	hwmon_curr_rated_max,
> -	hwmon_curr_beep,
> -};
> -
> -#define HWMON_C_ENABLE		BIT(hwmon_curr_enable)
> -#define HWMON_C_INPUT		BIT(hwmon_curr_input)
> -#define HWMON_C_MIN		BIT(hwmon_curr_min)
> -#define HWMON_C_MAX		BIT(hwmon_curr_max)
> -#define HWMON_C_LCRIT		BIT(hwmon_curr_lcrit)
> -#define HWMON_C_CRIT		BIT(hwmon_curr_crit)
> -#define HWMON_C_AVERAGE		BIT(hwmon_curr_average)
> -#define HWMON_C_LOWEST		BIT(hwmon_curr_lowest)
> -#define HWMON_C_HIGHEST		BIT(hwmon_curr_highest)
> -#define HWMON_C_RESET_HISTORY	BIT(hwmon_curr_reset_history)
> -#define HWMON_C_LABEL		BIT(hwmon_curr_label)
> -#define HWMON_C_ALARM		BIT(hwmon_curr_alarm)
> -#define HWMON_C_MIN_ALARM	BIT(hwmon_curr_min_alarm)
> -#define HWMON_C_MAX_ALARM	BIT(hwmon_curr_max_alarm)
> -#define HWMON_C_LCRIT_ALARM	BIT(hwmon_curr_lcrit_alarm)
> -#define HWMON_C_CRIT_ALARM	BIT(hwmon_curr_crit_alarm)
> -#define HWMON_C_RATED_MIN	BIT(hwmon_curr_rated_min)
> -#define HWMON_C_RATED_MAX	BIT(hwmon_curr_rated_max)
> -#define HWMON_C_BEEP		BIT(hwmon_curr_beep)
> -
> -enum hwmon_power_attributes {
> -	hwmon_power_enable,
> -	hwmon_power_average,
> -	hwmon_power_average_interval,
> -	hwmon_power_average_interval_max,
> -	hwmon_power_average_interval_min,
> -	hwmon_power_average_highest,
> -	hwmon_power_average_lowest,
> -	hwmon_power_average_max,
> -	hwmon_power_average_min,
> -	hwmon_power_input,
> -	hwmon_power_input_highest,
> -	hwmon_power_input_lowest,
> -	hwmon_power_reset_history,
> -	hwmon_power_accuracy,
> -	hwmon_power_cap,
> -	hwmon_power_cap_hyst,
> -	hwmon_power_cap_max,
> -	hwmon_power_cap_min,
> -	hwmon_power_min,
> -	hwmon_power_max,
> -	hwmon_power_crit,
> -	hwmon_power_lcrit,
> -	hwmon_power_label,
> -	hwmon_power_alarm,
> -	hwmon_power_cap_alarm,
> -	hwmon_power_min_alarm,
> -	hwmon_power_max_alarm,
> -	hwmon_power_lcrit_alarm,
> -	hwmon_power_crit_alarm,
> -	hwmon_power_rated_min,
> -	hwmon_power_rated_max,
> -};
> -
> -#define HWMON_P_ENABLE			BIT(hwmon_power_enable)
> -#define HWMON_P_AVERAGE			BIT(hwmon_power_average)
> -#define HWMON_P_AVERAGE_INTERVAL	BIT(hwmon_power_average_interval)
> -#define HWMON_P_AVERAGE_INTERVAL_MAX	BIT(hwmon_power_average_interval_max)
> -#define HWMON_P_AVERAGE_INTERVAL_MIN	BIT(hwmon_power_average_interval_min)
> -#define HWMON_P_AVERAGE_HIGHEST		BIT(hwmon_power_average_highest)
> -#define HWMON_P_AVERAGE_LOWEST		BIT(hwmon_power_average_lowest)
> -#define HWMON_P_AVERAGE_MAX		BIT(hwmon_power_average_max)
> -#define HWMON_P_AVERAGE_MIN		BIT(hwmon_power_average_min)
> -#define HWMON_P_INPUT			BIT(hwmon_power_input)
> -#define HWMON_P_INPUT_HIGHEST		BIT(hwmon_power_input_highest)
> -#define HWMON_P_INPUT_LOWEST		BIT(hwmon_power_input_lowest)
> -#define HWMON_P_RESET_HISTORY		BIT(hwmon_power_reset_history)
> -#define HWMON_P_ACCURACY		BIT(hwmon_power_accuracy)
> -#define HWMON_P_CAP			BIT(hwmon_power_cap)
> -#define HWMON_P_CAP_HYST		BIT(hwmon_power_cap_hyst)
> -#define HWMON_P_CAP_MAX			BIT(hwmon_power_cap_max)
> -#define HWMON_P_CAP_MIN			BIT(hwmon_power_cap_min)
> -#define HWMON_P_MIN			BIT(hwmon_power_min)
> -#define HWMON_P_MAX			BIT(hwmon_power_max)
> -#define HWMON_P_LCRIT			BIT(hwmon_power_lcrit)
> -#define HWMON_P_CRIT			BIT(hwmon_power_crit)
> -#define HWMON_P_LABEL			BIT(hwmon_power_label)
> -#define HWMON_P_ALARM			BIT(hwmon_power_alarm)
> -#define HWMON_P_CAP_ALARM		BIT(hwmon_power_cap_alarm)
> -#define HWMON_P_MIN_ALARM		BIT(hwmon_power_min_alarm)
> -#define HWMON_P_MAX_ALARM		BIT(hwmon_power_max_alarm)
> -#define HWMON_P_LCRIT_ALARM		BIT(hwmon_power_lcrit_alarm)
> -#define HWMON_P_CRIT_ALARM		BIT(hwmon_power_crit_alarm)
> -#define HWMON_P_RATED_MIN		BIT(hwmon_power_rated_min)
> -#define HWMON_P_RATED_MAX		BIT(hwmon_power_rated_max)
> -
> -enum hwmon_energy_attributes {
> -	hwmon_energy_enable,
> -	hwmon_energy_input,
> -	hwmon_energy_label,
> -};
> -
> -#define HWMON_E_ENABLE			BIT(hwmon_energy_enable)
> -#define HWMON_E_INPUT			BIT(hwmon_energy_input)
> -#define HWMON_E_LABEL			BIT(hwmon_energy_label)
> -
> -enum hwmon_humidity_attributes {
> -	hwmon_humidity_enable,
> -	hwmon_humidity_input,
> -	hwmon_humidity_label,
> -	hwmon_humidity_min,
> -	hwmon_humidity_min_hyst,
> -	hwmon_humidity_max,
> -	hwmon_humidity_max_hyst,
> -	hwmon_humidity_alarm,
> -	hwmon_humidity_fault,
> -	hwmon_humidity_rated_min,
> -	hwmon_humidity_rated_max,
> -	hwmon_humidity_min_alarm,
> -	hwmon_humidity_max_alarm,
> -};
> -
> -#define HWMON_H_ENABLE			BIT(hwmon_humidity_enable)
> -#define HWMON_H_INPUT			BIT(hwmon_humidity_input)
> -#define HWMON_H_LABEL			BIT(hwmon_humidity_label)
> -#define HWMON_H_MIN			BIT(hwmon_humidity_min)
> -#define HWMON_H_MIN_HYST		BIT(hwmon_humidity_min_hyst)
> -#define HWMON_H_MAX			BIT(hwmon_humidity_max)
> -#define HWMON_H_MAX_HYST		BIT(hwmon_humidity_max_hyst)
> -#define HWMON_H_ALARM			BIT(hwmon_humidity_alarm)
> -#define HWMON_H_FAULT			BIT(hwmon_humidity_fault)
> -#define HWMON_H_RATED_MIN		BIT(hwmon_humidity_rated_min)
> -#define HWMON_H_RATED_MAX		BIT(hwmon_humidity_rated_max)
> -#define HWMON_H_MIN_ALARM		BIT(hwmon_humidity_min_alarm)
> -#define HWMON_H_MAX_ALARM		BIT(hwmon_humidity_max_alarm)
> -
> -enum hwmon_fan_attributes {
> -	hwmon_fan_enable,
> -	hwmon_fan_input,
> -	hwmon_fan_label,
> -	hwmon_fan_min,
> -	hwmon_fan_max,
> -	hwmon_fan_div,
> -	hwmon_fan_pulses,
> -	hwmon_fan_target,
> -	hwmon_fan_alarm,
> -	hwmon_fan_min_alarm,
> -	hwmon_fan_max_alarm,
> -	hwmon_fan_fault,
> -	hwmon_fan_beep,
> -};
> -
> -#define HWMON_F_ENABLE			BIT(hwmon_fan_enable)
> -#define HWMON_F_INPUT			BIT(hwmon_fan_input)
> -#define HWMON_F_LABEL			BIT(hwmon_fan_label)
> -#define HWMON_F_MIN			BIT(hwmon_fan_min)
> -#define HWMON_F_MAX			BIT(hwmon_fan_max)
> -#define HWMON_F_DIV			BIT(hwmon_fan_div)
> -#define HWMON_F_PULSES			BIT(hwmon_fan_pulses)
> -#define HWMON_F_TARGET			BIT(hwmon_fan_target)
> -#define HWMON_F_ALARM			BIT(hwmon_fan_alarm)
> -#define HWMON_F_MIN_ALARM		BIT(hwmon_fan_min_alarm)
> -#define HWMON_F_MAX_ALARM		BIT(hwmon_fan_max_alarm)
> -#define HWMON_F_FAULT			BIT(hwmon_fan_fault)
> -#define HWMON_F_BEEP			BIT(hwmon_fan_beep)
> -
> -enum hwmon_pwm_attributes {
> -	hwmon_pwm_input,
> -	hwmon_pwm_enable,
> -	hwmon_pwm_mode,
> -	hwmon_pwm_freq,
> -	hwmon_pwm_auto_channels_temp,
> -};
> -
> -#define HWMON_PWM_INPUT			BIT(hwmon_pwm_input)
> -#define HWMON_PWM_ENABLE		BIT(hwmon_pwm_enable)
> -#define HWMON_PWM_MODE			BIT(hwmon_pwm_mode)
> -#define HWMON_PWM_FREQ			BIT(hwmon_pwm_freq)
> -#define HWMON_PWM_AUTO_CHANNELS_TEMP	BIT(hwmon_pwm_auto_channels_temp)
> -
> -enum hwmon_intrusion_attributes {
> -	hwmon_intrusion_alarm,
> -	hwmon_intrusion_beep,
> -};
> -#define HWMON_INTRUSION_ALARM		BIT(hwmon_intrusion_alarm)
> -#define HWMON_INTRUSION_BEEP		BIT(hwmon_intrusion_beep)
> -
>  /**
>   * struct hwmon_ops - hwmon device operations
>   * @visible:	Static visibility. If non-zero, 'is_visible' is ignored.
> diff --git a/include/uapi/linux/hwmon.h b/include/uapi/linux/hwmon.h
> new file mode 100644
> index 000000000000..274f9c9dcb87
> --- /dev/null
> +++ b/include/uapi/linux/hwmon.h
> @@ -0,0 +1,372 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +/*
> + * Hardware monitoring sensor types, attributes and configuration bits.
> + *
> + * Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com>
> + * Copyright (C) 2026 Jihong Min <hurryman2212@gmail.com>
> + */
> +
> +#ifndef _UAPI_LINUX_HWMON_H
> +#define _UAPI_LINUX_HWMON_H
> +
> +#include <linux/const.h>
> +
> +/*
> + * Existing identifiers are ABI: never change their values. Append new attributes
> + * at the end of their enum and new sensor types before hwmon_max.
> + */
> +
> +enum hwmon_sensor_types {
> +	hwmon_chip = 0,
> +	hwmon_temp = 1,
> +	hwmon_in = 2,
> +	hwmon_curr = 3,
> +	hwmon_power = 4,
> +	hwmon_energy = 5,
> +	hwmon_energy64 = 6,
> +	hwmon_humidity = 7,
> +	hwmon_fan = 8,
> +	hwmon_pwm = 9,
> +	hwmon_intrusion = 10,
> +	hwmon_max = 11,
> +};
> +
> +enum hwmon_chip_attributes {
> +	hwmon_chip_temp_reset_history = 0,
> +	hwmon_chip_in_reset_history = 1,
> +	hwmon_chip_curr_reset_history = 2,
> +	hwmon_chip_power_reset_history = 3,
> +	hwmon_chip_register_tz = 4,
> +	hwmon_chip_update_interval = 5,
> +	hwmon_chip_update_interval_us = 6,
> +	hwmon_chip_alarms = 7,
> +	hwmon_chip_samples = 8,
> +	hwmon_chip_curr_samples = 9,
> +	hwmon_chip_in_samples = 10,
> +	hwmon_chip_power_samples = 11,
> +	hwmon_chip_temp_samples = 12,
> +	hwmon_chip_beep_enable = 13,
> +	hwmon_chip_pec = 14,
> +};
> +
> +#define HWMON_C_TEMP_RESET_HISTORY _BITUL(hwmon_chip_temp_reset_history)
> +#define HWMON_C_IN_RESET_HISTORY _BITUL(hwmon_chip_in_reset_history)
> +#define HWMON_C_CURR_RESET_HISTORY _BITUL(hwmon_chip_curr_reset_history)
> +#define HWMON_C_POWER_RESET_HISTORY _BITUL(hwmon_chip_power_reset_history)
> +#define HWMON_C_REGISTER_TZ _BITUL(hwmon_chip_register_tz)
> +#define HWMON_C_UPDATE_INTERVAL _BITUL(hwmon_chip_update_interval)
> +#define HWMON_C_UPDATE_INTERVAL_US _BITUL(hwmon_chip_update_interval_us)
> +#define HWMON_C_ALARMS _BITUL(hwmon_chip_alarms)
> +#define HWMON_C_SAMPLES _BITUL(hwmon_chip_samples)
> +#define HWMON_C_CURR_SAMPLES _BITUL(hwmon_chip_curr_samples)
> +#define HWMON_C_IN_SAMPLES _BITUL(hwmon_chip_in_samples)
> +#define HWMON_C_POWER_SAMPLES _BITUL(hwmon_chip_power_samples)
> +#define HWMON_C_TEMP_SAMPLES _BITUL(hwmon_chip_temp_samples)
> +#define HWMON_C_BEEP_ENABLE _BITUL(hwmon_chip_beep_enable)
> +#define HWMON_C_PEC _BITUL(hwmon_chip_pec)
> +
> +enum hwmon_temp_attributes {
> +	hwmon_temp_enable = 0,
> +	hwmon_temp_input = 1,
> +	hwmon_temp_type = 2,
> +	hwmon_temp_lcrit = 3,
> +	hwmon_temp_lcrit_hyst = 4,
> +	hwmon_temp_min = 5,
> +	hwmon_temp_min_hyst = 6,
> +	hwmon_temp_max = 7,
> +	hwmon_temp_max_hyst = 8,
> +	hwmon_temp_crit = 9,
> +	hwmon_temp_crit_hyst = 10,
> +	hwmon_temp_emergency = 11,
> +	hwmon_temp_emergency_hyst = 12,
> +	hwmon_temp_alarm = 13,
> +	hwmon_temp_lcrit_alarm = 14,
> +	hwmon_temp_min_alarm = 15,
> +	hwmon_temp_max_alarm = 16,
> +	hwmon_temp_crit_alarm = 17,
> +	hwmon_temp_emergency_alarm = 18,
> +	hwmon_temp_fault = 19,
> +	hwmon_temp_offset = 20,
> +	hwmon_temp_label = 21,
> +	hwmon_temp_lowest = 22,
> +	hwmon_temp_highest = 23,
> +	hwmon_temp_reset_history = 24,
> +	hwmon_temp_rated_min = 25,
> +	hwmon_temp_rated_max = 26,
> +	hwmon_temp_beep = 27,
> +};
> +
> +#define HWMON_T_ENABLE _BITUL(hwmon_temp_enable)
> +#define HWMON_T_INPUT _BITUL(hwmon_temp_input)
> +#define HWMON_T_TYPE _BITUL(hwmon_temp_type)
> +#define HWMON_T_LCRIT _BITUL(hwmon_temp_lcrit)
> +#define HWMON_T_LCRIT_HYST _BITUL(hwmon_temp_lcrit_hyst)
> +#define HWMON_T_MIN _BITUL(hwmon_temp_min)
> +#define HWMON_T_MIN_HYST _BITUL(hwmon_temp_min_hyst)
> +#define HWMON_T_MAX _BITUL(hwmon_temp_max)
> +#define HWMON_T_MAX_HYST _BITUL(hwmon_temp_max_hyst)
> +#define HWMON_T_CRIT _BITUL(hwmon_temp_crit)
> +#define HWMON_T_CRIT_HYST _BITUL(hwmon_temp_crit_hyst)
> +#define HWMON_T_EMERGENCY _BITUL(hwmon_temp_emergency)
> +#define HWMON_T_EMERGENCY_HYST _BITUL(hwmon_temp_emergency_hyst)
> +#define HWMON_T_ALARM _BITUL(hwmon_temp_alarm)
> +#define HWMON_T_MIN_ALARM _BITUL(hwmon_temp_min_alarm)
> +#define HWMON_T_MAX_ALARM _BITUL(hwmon_temp_max_alarm)
> +#define HWMON_T_CRIT_ALARM _BITUL(hwmon_temp_crit_alarm)
> +#define HWMON_T_LCRIT_ALARM _BITUL(hwmon_temp_lcrit_alarm)
> +#define HWMON_T_EMERGENCY_ALARM _BITUL(hwmon_temp_emergency_alarm)
> +#define HWMON_T_FAULT _BITUL(hwmon_temp_fault)
> +#define HWMON_T_OFFSET _BITUL(hwmon_temp_offset)
> +#define HWMON_T_LABEL _BITUL(hwmon_temp_label)
> +#define HWMON_T_LOWEST _BITUL(hwmon_temp_lowest)
> +#define HWMON_T_HIGHEST _BITUL(hwmon_temp_highest)
> +#define HWMON_T_RESET_HISTORY _BITUL(hwmon_temp_reset_history)
> +#define HWMON_T_RATED_MIN _BITUL(hwmon_temp_rated_min)
> +#define HWMON_T_RATED_MAX _BITUL(hwmon_temp_rated_max)
> +#define HWMON_T_BEEP _BITUL(hwmon_temp_beep)
> +
> +enum hwmon_in_attributes {
> +	hwmon_in_enable = 0,
> +	hwmon_in_input = 1,
> +	hwmon_in_min = 2,
> +	hwmon_in_max = 3,
> +	hwmon_in_lcrit = 4,
> +	hwmon_in_crit = 5,
> +	hwmon_in_average = 6,
> +	hwmon_in_lowest = 7,
> +	hwmon_in_highest = 8,
> +	hwmon_in_reset_history = 9,
> +	hwmon_in_label = 10,
> +	hwmon_in_alarm = 11,
> +	hwmon_in_min_alarm = 12,
> +	hwmon_in_max_alarm = 13,
> +	hwmon_in_lcrit_alarm = 14,
> +	hwmon_in_crit_alarm = 15,
> +	hwmon_in_rated_min = 16,
> +	hwmon_in_rated_max = 17,
> +	hwmon_in_beep = 18,
> +	hwmon_in_fault = 19,
> +};
> +
> +#define HWMON_I_ENABLE _BITUL(hwmon_in_enable)
> +#define HWMON_I_INPUT _BITUL(hwmon_in_input)
> +#define HWMON_I_MIN _BITUL(hwmon_in_min)
> +#define HWMON_I_MAX _BITUL(hwmon_in_max)
> +#define HWMON_I_LCRIT _BITUL(hwmon_in_lcrit)
> +#define HWMON_I_CRIT _BITUL(hwmon_in_crit)
> +#define HWMON_I_AVERAGE _BITUL(hwmon_in_average)
> +#define HWMON_I_LOWEST _BITUL(hwmon_in_lowest)
> +#define HWMON_I_HIGHEST _BITUL(hwmon_in_highest)
> +#define HWMON_I_RESET_HISTORY _BITUL(hwmon_in_reset_history)
> +#define HWMON_I_LABEL _BITUL(hwmon_in_label)
> +#define HWMON_I_ALARM _BITUL(hwmon_in_alarm)
> +#define HWMON_I_MIN_ALARM _BITUL(hwmon_in_min_alarm)
> +#define HWMON_I_MAX_ALARM _BITUL(hwmon_in_max_alarm)
> +#define HWMON_I_LCRIT_ALARM _BITUL(hwmon_in_lcrit_alarm)
> +#define HWMON_I_CRIT_ALARM _BITUL(hwmon_in_crit_alarm)
> +#define HWMON_I_RATED_MIN _BITUL(hwmon_in_rated_min)
> +#define HWMON_I_RATED_MAX _BITUL(hwmon_in_rated_max)
> +#define HWMON_I_BEEP _BITUL(hwmon_in_beep)
> +#define HWMON_I_FAULT _BITUL(hwmon_in_fault)
> +
> +enum hwmon_curr_attributes {
> +	hwmon_curr_enable = 0,
> +	hwmon_curr_input = 1,
> +	hwmon_curr_min = 2,
> +	hwmon_curr_max = 3,
> +	hwmon_curr_lcrit = 4,
> +	hwmon_curr_crit = 5,
> +	hwmon_curr_average = 6,
> +	hwmon_curr_lowest = 7,
> +	hwmon_curr_highest = 8,
> +	hwmon_curr_reset_history = 9,
> +	hwmon_curr_label = 10,
> +	hwmon_curr_alarm = 11,
> +	hwmon_curr_min_alarm = 12,
> +	hwmon_curr_max_alarm = 13,
> +	hwmon_curr_lcrit_alarm = 14,
> +	hwmon_curr_crit_alarm = 15,
> +	hwmon_curr_rated_min = 16,
> +	hwmon_curr_rated_max = 17,
> +	hwmon_curr_beep = 18,
> +};
> +
> +#define HWMON_C_ENABLE _BITUL(hwmon_curr_enable)
> +#define HWMON_C_INPUT _BITUL(hwmon_curr_input)
> +#define HWMON_C_MIN _BITUL(hwmon_curr_min)
> +#define HWMON_C_MAX _BITUL(hwmon_curr_max)
> +#define HWMON_C_LCRIT _BITUL(hwmon_curr_lcrit)
> +#define HWMON_C_CRIT _BITUL(hwmon_curr_crit)
> +#define HWMON_C_AVERAGE _BITUL(hwmon_curr_average)
> +#define HWMON_C_LOWEST _BITUL(hwmon_curr_lowest)
> +#define HWMON_C_HIGHEST _BITUL(hwmon_curr_highest)
> +#define HWMON_C_RESET_HISTORY _BITUL(hwmon_curr_reset_history)
> +#define HWMON_C_LABEL _BITUL(hwmon_curr_label)
> +#define HWMON_C_ALARM _BITUL(hwmon_curr_alarm)
> +#define HWMON_C_MIN_ALARM _BITUL(hwmon_curr_min_alarm)
> +#define HWMON_C_MAX_ALARM _BITUL(hwmon_curr_max_alarm)
> +#define HWMON_C_LCRIT_ALARM _BITUL(hwmon_curr_lcrit_alarm)
> +#define HWMON_C_CRIT_ALARM _BITUL(hwmon_curr_crit_alarm)
> +#define HWMON_C_RATED_MIN _BITUL(hwmon_curr_rated_min)
> +#define HWMON_C_RATED_MAX _BITUL(hwmon_curr_rated_max)
> +#define HWMON_C_BEEP _BITUL(hwmon_curr_beep)
> +
> +enum hwmon_power_attributes {
> +	hwmon_power_enable = 0,
> +	hwmon_power_average = 1,
> +	hwmon_power_average_interval = 2,
> +	hwmon_power_average_interval_max = 3,
> +	hwmon_power_average_interval_min = 4,
> +	hwmon_power_average_highest = 5,
> +	hwmon_power_average_lowest = 6,
> +	hwmon_power_average_max = 7,
> +	hwmon_power_average_min = 8,
> +	hwmon_power_input = 9,
> +	hwmon_power_input_highest = 10,
> +	hwmon_power_input_lowest = 11,
> +	hwmon_power_reset_history = 12,
> +	hwmon_power_accuracy = 13,
> +	hwmon_power_cap = 14,
> +	hwmon_power_cap_hyst = 15,
> +	hwmon_power_cap_max = 16,
> +	hwmon_power_cap_min = 17,
> +	hwmon_power_min = 18,
> +	hwmon_power_max = 19,
> +	hwmon_power_crit = 20,
> +	hwmon_power_lcrit = 21,
> +	hwmon_power_label = 22,
> +	hwmon_power_alarm = 23,
> +	hwmon_power_cap_alarm = 24,
> +	hwmon_power_min_alarm = 25,
> +	hwmon_power_max_alarm = 26,
> +	hwmon_power_lcrit_alarm = 27,
> +	hwmon_power_crit_alarm = 28,
> +	hwmon_power_rated_min = 29,
> +	hwmon_power_rated_max = 30,
> +};
> +
> +#define HWMON_P_ENABLE _BITUL(hwmon_power_enable)
> +#define HWMON_P_AVERAGE _BITUL(hwmon_power_average)
> +#define HWMON_P_AVERAGE_INTERVAL _BITUL(hwmon_power_average_interval)
> +#define HWMON_P_AVERAGE_INTERVAL_MAX _BITUL(hwmon_power_average_interval_max)
> +#define HWMON_P_AVERAGE_INTERVAL_MIN _BITUL(hwmon_power_average_interval_min)
> +#define HWMON_P_AVERAGE_HIGHEST _BITUL(hwmon_power_average_highest)
> +#define HWMON_P_AVERAGE_LOWEST _BITUL(hwmon_power_average_lowest)
> +#define HWMON_P_AVERAGE_MAX _BITUL(hwmon_power_average_max)
> +#define HWMON_P_AVERAGE_MIN _BITUL(hwmon_power_average_min)
> +#define HWMON_P_INPUT _BITUL(hwmon_power_input)
> +#define HWMON_P_INPUT_HIGHEST _BITUL(hwmon_power_input_highest)
> +#define HWMON_P_INPUT_LOWEST _BITUL(hwmon_power_input_lowest)
> +#define HWMON_P_RESET_HISTORY _BITUL(hwmon_power_reset_history)
> +#define HWMON_P_ACCURACY _BITUL(hwmon_power_accuracy)
> +#define HWMON_P_CAP _BITUL(hwmon_power_cap)
> +#define HWMON_P_CAP_HYST _BITUL(hwmon_power_cap_hyst)
> +#define HWMON_P_CAP_MAX _BITUL(hwmon_power_cap_max)
> +#define HWMON_P_CAP_MIN _BITUL(hwmon_power_cap_min)
> +#define HWMON_P_MIN _BITUL(hwmon_power_min)
> +#define HWMON_P_MAX _BITUL(hwmon_power_max)
> +#define HWMON_P_LCRIT _BITUL(hwmon_power_lcrit)
> +#define HWMON_P_CRIT _BITUL(hwmon_power_crit)
> +#define HWMON_P_LABEL _BITUL(hwmon_power_label)
> +#define HWMON_P_ALARM _BITUL(hwmon_power_alarm)
> +#define HWMON_P_CAP_ALARM _BITUL(hwmon_power_cap_alarm)
> +#define HWMON_P_MIN_ALARM _BITUL(hwmon_power_min_alarm)
> +#define HWMON_P_MAX_ALARM _BITUL(hwmon_power_max_alarm)
> +#define HWMON_P_LCRIT_ALARM _BITUL(hwmon_power_lcrit_alarm)
> +#define HWMON_P_CRIT_ALARM _BITUL(hwmon_power_crit_alarm)
> +#define HWMON_P_RATED_MIN _BITUL(hwmon_power_rated_min)
> +#define HWMON_P_RATED_MAX _BITUL(hwmon_power_rated_max)
> +
> +enum hwmon_energy_attributes {
> +	hwmon_energy_enable = 0,
> +	hwmon_energy_input = 1,
> +	hwmon_energy_label = 2,
> +};
> +
> +#define HWMON_E_ENABLE _BITUL(hwmon_energy_enable)
> +#define HWMON_E_INPUT _BITUL(hwmon_energy_input)
> +#define HWMON_E_LABEL _BITUL(hwmon_energy_label)
> +
> +enum hwmon_humidity_attributes {
> +	hwmon_humidity_enable = 0,
> +	hwmon_humidity_input = 1,
> +	hwmon_humidity_label = 2,
> +	hwmon_humidity_min = 3,
> +	hwmon_humidity_min_hyst = 4,
> +	hwmon_humidity_max = 5,
> +	hwmon_humidity_max_hyst = 6,
> +	hwmon_humidity_alarm = 7,
> +	hwmon_humidity_fault = 8,
> +	hwmon_humidity_rated_min = 9,
> +	hwmon_humidity_rated_max = 10,
> +	hwmon_humidity_min_alarm = 11,
> +	hwmon_humidity_max_alarm = 12,
> +};
> +
> +#define HWMON_H_ENABLE _BITUL(hwmon_humidity_enable)
> +#define HWMON_H_INPUT _BITUL(hwmon_humidity_input)
> +#define HWMON_H_LABEL _BITUL(hwmon_humidity_label)
> +#define HWMON_H_MIN _BITUL(hwmon_humidity_min)
> +#define HWMON_H_MIN_HYST _BITUL(hwmon_humidity_min_hyst)
> +#define HWMON_H_MAX _BITUL(hwmon_humidity_max)
> +#define HWMON_H_MAX_HYST _BITUL(hwmon_humidity_max_hyst)
> +#define HWMON_H_ALARM _BITUL(hwmon_humidity_alarm)
> +#define HWMON_H_FAULT _BITUL(hwmon_humidity_fault)
> +#define HWMON_H_RATED_MIN _BITUL(hwmon_humidity_rated_min)
> +#define HWMON_H_RATED_MAX _BITUL(hwmon_humidity_rated_max)
> +#define HWMON_H_MIN_ALARM _BITUL(hwmon_humidity_min_alarm)
> +#define HWMON_H_MAX_ALARM _BITUL(hwmon_humidity_max_alarm)
> +
> +enum hwmon_fan_attributes {
> +	hwmon_fan_enable = 0,
> +	hwmon_fan_input = 1,
> +	hwmon_fan_label = 2,
> +	hwmon_fan_min = 3,
> +	hwmon_fan_max = 4,
> +	hwmon_fan_div = 5,
> +	hwmon_fan_pulses = 6,
> +	hwmon_fan_target = 7,
> +	hwmon_fan_alarm = 8,
> +	hwmon_fan_min_alarm = 9,
> +	hwmon_fan_max_alarm = 10,
> +	hwmon_fan_fault = 11,
> +	hwmon_fan_beep = 12,
> +};
> +
> +#define HWMON_F_ENABLE _BITUL(hwmon_fan_enable)
> +#define HWMON_F_INPUT _BITUL(hwmon_fan_input)
> +#define HWMON_F_LABEL _BITUL(hwmon_fan_label)
> +#define HWMON_F_MIN _BITUL(hwmon_fan_min)
> +#define HWMON_F_MAX _BITUL(hwmon_fan_max)
> +#define HWMON_F_DIV _BITUL(hwmon_fan_div)
> +#define HWMON_F_PULSES _BITUL(hwmon_fan_pulses)
> +#define HWMON_F_TARGET _BITUL(hwmon_fan_target)
> +#define HWMON_F_ALARM _BITUL(hwmon_fan_alarm)
> +#define HWMON_F_MIN_ALARM _BITUL(hwmon_fan_min_alarm)
> +#define HWMON_F_MAX_ALARM _BITUL(hwmon_fan_max_alarm)
> +#define HWMON_F_FAULT _BITUL(hwmon_fan_fault)
> +#define HWMON_F_BEEP _BITUL(hwmon_fan_beep)
> +
> +enum hwmon_pwm_attributes {
> +	hwmon_pwm_input = 0,
> +	hwmon_pwm_enable = 1,
> +	hwmon_pwm_mode = 2,
> +	hwmon_pwm_freq = 3,
> +	hwmon_pwm_auto_channels_temp = 4,
> +};
> +
> +#define HWMON_PWM_INPUT _BITUL(hwmon_pwm_input)
> +#define HWMON_PWM_ENABLE _BITUL(hwmon_pwm_enable)
> +#define HWMON_PWM_MODE _BITUL(hwmon_pwm_mode)
> +#define HWMON_PWM_FREQ _BITUL(hwmon_pwm_freq)
> +#define HWMON_PWM_AUTO_CHANNELS_TEMP _BITUL(hwmon_pwm_auto_channels_temp)
> +
> +enum hwmon_intrusion_attributes {
> +	hwmon_intrusion_alarm = 0,
> +	hwmon_intrusion_beep = 1,
> +};
> +
> +#define HWMON_INTRUSION_ALARM _BITUL(hwmon_intrusion_alarm)
> +#define HWMON_INTRUSION_BEEP _BITUL(hwmon_intrusion_beep)
> +
> +#endif /* _UAPI_LINUX_HWMON_H */

  reply	other threads:[~2026-10-18 15:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 15:38 [PATCH 0/5] hwmon: Introduce uhwmon for userspace implementations Jihong Min
2026-10-09 15:38 ` [PATCH 1/5] hwmon: Export sensor and attribute definitions to userspace Jihong Min
2026-10-18 15:52   ` Guenter Roeck [this message]
2026-10-09 15:38 ` [PATCH 2/5] hwmon: Expose attribute validation and string helpers Jihong Min
2026-10-09 15:38 ` [PATCH 3/5] hwmon: Add a generic interface for userspace implementations Jihong Min
2026-10-10 14:50   ` Markus Elfring
2026-10-09 15:38 ` [PATCH 4/5] hwmon: Reject truncated attribute names Jihong Min
2026-10-09 15:38 ` [PATCH 5/5] docs: hwmon: Document the uhwmon userspace interface Jihong Min
2026-10-18 16:06   ` Guenter Roeck
2026-10-18 17:30     ` Jihong Min

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d3e68b2-3abb-4bf8-bf0b-c8590006dc4d@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=corbet@lwn.net \
    --cc=hurryman2212@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®