diff options
| author | Luiz Angelo Daros de Luca <luizluca@gmail.com> | 2026-08-05 10:15:18 -0300 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-08-10 08:59:43 -0700 |
| commit | 75eae6e1fa6ea8dd6319ca6d8bce9a466654f809 (patch) | |
| tree | c6da4c8b0a95b36b5a80b8ffd1003d7f5b673dcb | |
| parent | 7d9d401d98bc93e134481139fe9dfa6f4fe25dd7 (diff) | |
hwmon: (adt7470) Add ADT7470_PWM_MAX macro
Instead of a magic 255, use a macro to refer to it.
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260805-adt7470_thermalzone-v6-2-5605a5f95467@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| -rw-r--r-- | drivers/hwmon/adt7470.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index c45b984c02e6..87ddd7b8ddae 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c @@ -100,6 +100,7 @@ static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END }; #define ADT7470_REG_FAN_MAX(x) (ADT7470_REG_FAN_MAX_BASE_ADDR + ((x) * 2)) #define ADT7470_PWM_COUNT 4 +#define ADT7470_PWM_MAX 255 #define ADT7470_REG_PWM(x) (ADT7470_REG_PWM_BASE_ADDR + (x)) #define ADT7470_REG_PWM_MAX(x) (ADT7470_REG_PWM_MAX_BASE_ADDR + (x)) #define ADT7470_REG_PWM_MIN(x) (ADT7470_REG_PWM_MIN_BASE_ADDR + (x)) @@ -850,7 +851,7 @@ static int adt7470_pwm_write(struct device *dev, u32 attr, int channel, long val switch (attr) { case hwmon_pwm_input: - val = clamp_val(val, 0, 255); + val = clamp_val(val, 0, ADT7470_PWM_MAX); mutex_lock(&data->lock); err = regmap_write(data->regmap, ADT7470_REG_PWM(channel), val); @@ -910,7 +911,7 @@ static ssize_t pwm_max_store(struct device *dev, if (kstrtol(buf, 10, &temp)) return -EINVAL; - temp = clamp_val(temp, 0, 255); + temp = clamp_val(temp, 0, ADT7470_PWM_MAX); mutex_lock(&data->lock); data->pwm_max[attr->index] = temp; @@ -945,7 +946,7 @@ static ssize_t pwm_min_store(struct device *dev, if (kstrtol(buf, 10, &temp)) return -EINVAL; - temp = clamp_val(temp, 0, 255); + temp = clamp_val(temp, 0, ADT7470_PWM_MAX); mutex_lock(&data->lock); data->pwm_min[attr->index] = temp; |
