hwmon: (occ) Fix poll rate limiting
authorEddie James <eajames@linux.ibm.com>
Thu, 29 Apr 2021 15:13:36 +0000 (10:13 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:13:13 +0000 (10:13 +0200)
commit550473900f80945cb1a48c6d252d9da41ddc48ec
tree2026e754d7d572ec2f329dc70923bb350e2a46f8
parent0becd19b211aab0a0b017fb5fe584431482eab0a
hwmon: (occ) Fix poll rate limiting

[ Upstream commit 5216dff22dc2bbbbe6f00335f9fd2879670e753b ]

The poll rate limiter time was initialized at zero. This breaks the
comparison in time_after if jiffies is large. Switch to storing the
next update time rather than the previous time, and initialize the
time when the device is probed.

Fixes: c10e753d43eb ("hwmon (occ): Add sensor types and versions")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20210429151336.18980-1-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/occ/common.c
drivers/hwmon/occ/common.h