From 0df00131bb9af86866c4c7ff21e3fff133547139 Mon Sep 17 00:00:00 2001 From: Bernat Arlandis Date: Sat, 8 Jun 2024 10:31:53 +0200 Subject: [PATCH] Cast FFB level operations to s32 --- hid-lg4ff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hid-lg4ff.c b/hid-lg4ff.c index 9e6afc6..ba055b2 100644 --- a/hid-lg4ff.c +++ b/hid-lg4ff.c @@ -872,15 +872,15 @@ static __always_inline int lg4ff_timer(struct lg4ff_device_entry *entry) spin_unlock_irqrestore(&entry->timer_lock, flags); - parameters[0].level = (long)parameters[0].level * gain / 0xffff; + parameters[0].level = (s32)parameters[0].level * (s32)gain / 0xffff; parameters[1].clip = parameters[1].clip * spring_level / 100; parameters[2].clip = parameters[2].clip * damper_level / 100; parameters[3].clip = parameters[3].clip * friction_level / 100; ffb_level = abs(parameters[0].level); for (i = 1; i < 4; i++) { - parameters[i].k1 = (long)parameters[i].k1 * gain / 0xffff; - parameters[i].k2 = (long)parameters[i].k2 * gain / 0xffff; + parameters[i].k1 = (s32)parameters[i].k1 * (s32)gain / 0xffff; + parameters[i].k2 = (s32)parameters[i].k2 * (s32)gain / 0xffff; parameters[i].clip = parameters[i].clip * gain / 0xffff; ffb_level += parameters[i].clip * 0x7fff / 0xffff; }