mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Gary Stein <lordcnidarian@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver/input/ff-memless.c
Date: Mon, 7 Dec 2009 20:24:18 -0800	[thread overview]
Message-ID: <20091208042417.GD11147@core.coreip.homeip.net> (raw)
In-Reply-To: <fce72f9b0912071137i1f2d7952tf70b83d4ba5686f8@mail.gmail.com>

Hi Gary,

On Mon, Dec 07, 2009 at 02:37:30PM -0500, Gary Stein wrote:
> I was experiencing force feedback joystick issues in my Force 3D Pro and
> when developing a new driver for the new Logitech G940 after I
> recompiled my kernel.
> 
> I was able to track it down to a signed vs unsigned problem in
> ff-memless.c and gcc 4.4.2.
> The code in question did not seem to give a problem with gcc 4.2.4.
> 
> According to gitweb, a signed vs unsigned was changed on May 8th by
> Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
> Input: ff-memless - fix signed to unsigned bit overflow
> 
> to change the gain from a signed to an unsigned int to fix a rumble
> issue, but it appears to broke a the
> constant force section of the code.
> 
> It is a simple, cast to fix and should not have any ill effects.
> 

Could I please have your "Signed-off-by: ..."? Thanks.

> gary
> 
> 
> --- linux-2.6.31.orig/drivers/input/ff-memless.c	2009-09-09
> 17:13:59.000000000 -0500
> +++ linux-2.6.31.int/drivers/input/ff-memless.c	2009-12-07
> 15:09:22.000000000 -0500
> @@ -239,8 +239,8 @@
>  		level = fixp_new16(apply_envelope(state,
>  					new->u.constant.level,
>  					&new->u.constant.envelope));
> -		x = fixp_mult(fixp_sin(i), level) * gain / 0xffff;
> -		y = fixp_mult(-fixp_cos(i), level) * gain / 0xffff;
> +		x = (int)(fixp_mult(fixp_sin(i), level) * gain) / 0xffff;
> +		y = (int)(fixp_mult(-fixp_cos(i), level) * gain) / 0xffff;
>  		/*
>  		 * here we abuse ff_ramp to hold x and y of constant force
>  		 * If in future any driver wants something else than x and y

-- 
Dmitry

      reply	other threads:[~2009-12-08  4:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07 19:37 Gary Stein
2009-12-08  4:24 ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091208042417.GD11147@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lordcnidarian@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome