platform/x86/drivers/acerhdf: Check the interval value when it is set
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Thu, 3 Dec 2020 07:17:38 +0000 (08:17 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 7 Dec 2020 16:04:50 +0000 (17:04 +0100)
commitf34a32fae7fde6655ada6b33dc6739c9d1b6a82c
treeb53372772ba14afbe7f7a0ed84f8e1ce7053b890
parenta65181c41e57709053892832d261956afe281deb
platform/x86/drivers/acerhdf: Check the interval value when it is set

Currently the code checks the interval value when the temperature is
read which is bad for two reasons:

 - checking and setting the interval in the get_temp callback is
   inaccurate and awful, that can be done when changing the value.

 - Changing the thermal zone structure internals is an abuse of the
   exported structure, moreover no lock is taken here.

The goal of this patch is to solve the first item by using the 'set'
function called when changing the interval. The check is done there
and removed from the get_temp function. If the thermal zone was not
initialized yet, the interval is not updated in this case as that will
happen in the init function when registering the thermal zone device.

I don't have any hardware to test the changes.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter Kaestle <peter@piie.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201203071738.2363701-2-daniel.lezcano@linaro.org
drivers/platform/x86/acerhdf.c