]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
hwmon: (max6639) Fix pulses-per-revolution implementation
authorGuenter Roeck <linux@roeck-us.net>
Fri, 20 Mar 2026 04:31:22 +0000 (21:31 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 20 Mar 2026 23:50:58 +0000 (16:50 -0700)
commite7bae9a7a5e1251ab414291f4e9304d702bb9221
tree70b5dbd77b732e301fc2540252106fc6cb4dfac0
parent86259558e422b250aa6aa57163a6d759074573f5
hwmon: (max6639) Fix pulses-per-revolution implementation

The valid range for the pulses-per-revolution devicetree property is
1..4. The current code checks for a range of 1..5. Fix it.

Declare the variable used to retrieve pulses per revolution from
devicetree as u32 (unsigned) to match the of_property_read_u32() API.

The current code uses a postfix decrement when writing the pulses per
resolution into the chip. This has no effect since the value is evaluated
before it is decremented. Fix it by decrementing before evaluating the
value.

Fixes: 7506ebcd662b ("hwmon: (max6639) : Configure based on DT property")
Cc: Naresh Solanki <naresh.solanki@9elements.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max6639.c