Re: [PATCH v2 5/7] hwmon: add driver for the hwmon parts of qnap-mcu devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 28, 2024 at 11:17:49PM +0200, Heiko Stuebner wrote:
> The MCU can be found on network-attached-storage devices made by QNAP
> and provides access to fan control including reading back its RPM as
> well as reading the temperature of the NAS case.
> 
> Signed-off-by: Heiko Stuebner <heiko@xxxxxxxxx>

Minor comment inline, in case you resend, otherwise

Acked-by: Guenter Roeck <linux@xxxxxxxxxxxx>

> +static int qnap_mcu_hwmon_write(struct device *dev, enum hwmon_sensor_types type,
> +				u32 attr, int channel, long val)
> +{
> +	struct qnap_mcu_hwmon *hwm = dev_get_drvdata(dev);
> +
> +	switch (attr) {
> +	case hwmon_pwm_input:
> +		if (val < 0 || val > 255)
> +			return -EINVAL;
> +
> +		if (val < hwm->pwm_min)
> +			val = hwm->pwm_min;
> +
> +		if (val > hwm->pwm_max)
> +			val = hwm->pwm_max;
> +
		val = clamp_val(val, hwm->pwm_min, hwm->pwm_max);

Guenter




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux