From 3fd55c0cbc7d3746d68a75d1c239b1e074eb85af Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Wed, 22 Jul 2015 11:50:55 +0200 Subject: [PATCH] Update to kernel-4.2 modified fixed-point arithmetics (breaks build on pre-4.2 kernels) --- klgd_ff_plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/klgd_ff_plugin.c b/klgd_ff_plugin.c index 92951e2..2886760 100644 --- a/klgd_ff_plugin.c +++ b/klgd_ff_plugin.c @@ -4,6 +4,7 @@ #include #define DIR_TO_DEGREES(dir) (360 - ((((dir > 0xc000) ? (u32)dir + 0x4000 - 0xffff : (u32)dir + 0x4000) * 360) / 0xffff)) +#define FRAC_16 8 #define RECALC_DELTA_T_MSEC 20 static int ffpl_handle_state_change(struct klgd_plugin_private *priv, struct klgd_command_stream *s, struct ffpl_effect *eff, @@ -154,8 +155,8 @@ bool ffpl_constant_force_to_x_y(const struct ff_effect *eff, s32 *x, s32 *y) degrees = DIR_TO_DEGREES(eff->direction); printk(KERN_NOTICE "KLGDFF: DIR_TO_DEGREES > Dir: %u, Deg: %u\n", eff->direction, degrees); - *x += (eff->u.constant.level * fixp_cos(degrees)) >> FRAC_N; - *y += (eff->u.constant.level * fixp_sin(degrees)) >> FRAC_N; + *x += (eff->u.constant.level * fixp_cos16(degrees)) >> FRAC_16; + *y += (eff->u.constant.level * fixp_sin16(degrees)) >> FRAC_16; return true; } -- 2.43.5