mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-24 08:02:35 +00:00
the code was looping, setting s_move[i] to the following calculations
if (actual_step>= 0)
s_move[i] = ((((i + 1) * gain + 0x200) - (i * gain + 0x200)) / 0x400);
else
s_move[i] = ((((i + 1) * gain - 0x200) - (i * gain - 0x200)) / 0x400);
but, this code reduces to the expression
s_move[i] = gain>> 10;
The reason for the complexity was to generate a step function with
integer division and rounding to land on specific values. But these calculations
can be simplified to the following code:
gain = ((actual_step<< 10) / 5)>> 10;
for (i = 0; i<= 4; i++)
s_move[i] = gain;
Signed-off-by: Justin Madru<jdm64@gawab.com>
Reviewed-by: Ray Lee<ray-lk@madrabbit.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
History
|
|
|---|---|---|
| .. | ||
| camera | ||
| include | ||
| qdsp5 | ||
| smd | ||
| generic_gpio.c | ||
| gpio_axis.c | ||
| gpio_event.c | ||
| gpio_input.c | ||
| gpio_matrix.c | ||
| gpio_output.c | ||
| Kconfig | ||
| Makefile | ||
| pmem.c | ||
| synaptics_i2c_rmi.c | ||
| synaptics_i2c_rmi.h | ||
| TODO | ||