diff options
author | Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> | 2008-07-23 14:38:27 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-07-23 14:41:28 -0400 |
commit | 9460b6529d8a0bfabf241ddda8b0e469d219844c (patch) | |
tree | 53c1bd90ef0510c661cb52a011bd274983322801 /drivers/input | |
parent | 494f685775ee4c2f3db4081209f00ff0633243fc (diff) | |
download | op-kernel-dev-9460b6529d8a0bfabf241ddda8b0e469d219844c.zip op-kernel-dev-9460b6529d8a0bfabf241ddda8b0e469d219844c.tar.gz |
Input: ads7846 - optimize order of calculating Rt in ads7846_rx()
Alter the if expression for calculating Rt. The old implementation would
run unnecessary code when the ADS7843 device was used.
The patch also fixes the code style to kernel standard.
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 4d06032..ce6f48c 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -517,7 +517,9 @@ static void ads7846_rx(void *ads) if (x == MAX_12BIT) x = 0; - if (likely(x && z1)) { + if (ts->model == 7843) { + Rt = ts->pressure_max / 2; + } else if (likely(x && z1)) { /* compute touch pressure resistance using equation #2 */ Rt = z2; Rt -= z1; @@ -525,11 +527,9 @@ static void ads7846_rx(void *ads) Rt *= ts->x_plate_ohms; Rt /= z1; Rt = (Rt + 2047) >> 12; - } else + } else { Rt = 0; - - if (ts->model == 7843) - Rt = ts->pressure_max / 2; + } /* Sample found inconsistent by debouncing or pressure is beyond * the maximum. Don't report it to user space, repeat at least |