On Tue, Dec 15, 2009 at 02:53:26PM +0100, Jiri Kosina wrote: > On Thu, 10 Dec 2009, Gary Stein wrote: > > > This is a cleaned up and updated driver for the G940. I followed most > > of the checkpatch notes except for some of the 80 column stuff, the > > sections of where most of that code is hid-core.c also doesn't seem to > > care about it. > > Yup, that's OK, thanks. > > Please also fix up a few comments on various places which are wrongly > intended, such as > > > + /* maxusage should be 63, maximum fields > > + likely a better way to ensure this data is clean */ > > which should rather be in a format more similar to > > /* > * first comment line > * second comment line > */ > > > However, also in this code is the (int) cast fix that I send before to > > linux-kernel in ff-memless. Without this, my driver or the normal > > logitech driver for other sticks seems to work for me. > > Dmitry, will you pick that one up for your tree? > Yes, but not quite like that - I think there may be more issues with 'gain' being unsigned int. How about below instead? [Some more people added to CC.] -- Dmitry Input: ff-memless - another fix for signed to unsigned overflow From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> The commit 9e68177ef93b2f34eee5a1e1707bceef4b9ba69c changed 'gain' from signed to unsigned to fix an issue with rumble effect calculation, however it introduced problems when calculating constant effects. Having 'gain' being unsigned int was an unfortunate choice since it dominates all implicit type conversions causing everything to be treated as unsigned int. Let's change it back to signed int and simply add proper casts to rumble effect calculations. Reported-by: Gary Stein <lordcnidarian@xxxxxxxxx> Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx> --- drivers/input/ff-memless.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index b483b29..768a9a2 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c @@ -225,7 +225,7 @@ static int get_compatible_type(struct ff_device *ff, int effect_type) */ static void ml_combine_effects(struct ff_effect *effect, struct ml_effect_state *state, - unsigned int gain) + int gain) { struct ff_effect *new = state->effect; unsigned int strong, weak, i; @@ -252,8 +252,8 @@ static void ml_combine_effects(struct ff_effect *effect, break; case FF_RUMBLE: - strong = new->u.rumble.strong_magnitude * gain / 0xffff; - weak = new->u.rumble.weak_magnitude * gain / 0xffff; + strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff; + weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff; effect->u.rumble.strong_magnitude = min(strong + effect->u.rumble.strong_magnitude, 0xffffU); -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html