auto-adjust loop threshold to changes in the array size
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
2
it87.c
2
it87.c
@@ -1982,7 +1982,7 @@ static ssize_t set_pwm_freq(struct device *dev, struct device_attribute *attr,
|
|||||||
val *= has_newer_autopwm(data) ? 256 : 128;
|
val *= has_newer_autopwm(data) ? 256 : 128;
|
||||||
|
|
||||||
/* Search for the nearest available frequency */
|
/* Search for the nearest available frequency */
|
||||||
for (i = 0; i < 7; i++) {
|
for (i = 0; i < ARRAY_SIZE(pwm_freq) - 1; i++) {
|
||||||
if (val > (pwm_freq[i] + pwm_freq[i + 1]) / 2)
|
if (val > (pwm_freq[i] + pwm_freq[i + 1]) / 2)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user