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; }