Unverified Commit 6d5a0be9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!7910 hwmon: (mlxreg-fan) Return non-zero value when fan current state is enforced from sysfs

parents 091e780d 1ebdfd51
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -307,8 +307,8 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev,
{
	struct mlxreg_fan *fan = cdev->devdata;
	unsigned long cur_state;
	int i, config = 0;
	u32 regval;
	int i;
	int err;

	/*
@@ -321,6 +321,12 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev,
	 * overwritten.
	 */
	if (state >= MLXREG_FAN_SPEED_MIN && state <= MLXREG_FAN_SPEED_MAX) {
		/*
		 * This is configuration change, which is only supported through sysfs.
		 * For configuration non-zero value is to be returned to avoid thermal
		 * statistics update.
		 */
		config = 1;
		state -= MLXREG_FAN_MAX_STATE;
		for (i = 0; i < state; i++)
			fan->cooling_levels[i] = state;
@@ -335,7 +341,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev,

		cur_state = MLXREG_FAN_PWM_DUTY2STATE(regval);
		if (state < cur_state)
			return 0;
			return config;

		state = cur_state;
	}
@@ -351,7 +357,7 @@ static int mlxreg_fan_set_cur_state(struct thermal_cooling_device *cdev,
		dev_err(fan->dev, "Failed to write PWM duty\n");
		return err;
	}
	return 0;
	return config;
}

static const struct thermal_cooling_device_ops mlxreg_fan_cooling_ops = {