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:29:52 +0000 (10:29 +0200)
commit61f459e285b82d00377753f43c31c382cf149df5
treecbfdb59d4d5af8335f035c57c3370fb00362c525
parenta44a97639442e36fe755f8c513957f6856642d08
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