On Sat, Feb 12, 2022 at 11:54:18PM +0100, Armin Wolf wrote:
commit c0d79987a0d82671bff374c07f2201f9bdf4aaa2 upstream.
When setting the fan speed, i8k_set_fan() calls i8k_get_fan_status(), causing an unnecessary SMM call since from the two users of this function, only i8k_ioctl_unlocked() needs to know the new fan status while dell_smm_write() ignores the new fan status. Since SMM calls can be very slow while also making error reporting difficult for dell_smm_write(), remove the function call from i8k_set_fan() and call it separately in i8k_ioctl_unlocked().
Since this patch was backported from kernel 5.16, the data argument of i8k_set_fan and i8k_get_fan_status was omitted (it exists since kernel 5.15).
This patch was originally a performance optimization, but it turned out a user with a buggy machine requires this patch since it also fixes error reporting when i8k_get_fan_status fails. https://github.com/lm-sensors/lm-sensors/pull/383
Tested on a Dell Inspiron 3505.
Cc: stable@vger.kernel.org # 5.10.x Cc: stable@vger.kernel.org # 5.4.x Cc: stable@vger.kernel.org # 4.x.x Signed-off-by: Armin Wolf W_Armin@gmx.de
drivers/hwmon/dell-smm-hwmon.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
All now queued up, thanks!