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>

authored by Hans-Christian Egtvedt and committed by Dmitry Torokhov 9460b652 494f6857

+5 -5
+5 -5
drivers/input/touchscreen/ads7846.c
··· 517 517 if (x == MAX_12BIT) 518 518 x = 0; 519 519 520 - if (likely(x && z1)) { 520 + if (ts->model == 7843) { 521 + Rt = ts->pressure_max / 2; 522 + } else if (likely(x && z1)) { 521 523 /* compute touch pressure resistance using equation #2 */ 522 524 Rt = z2; 523 525 Rt -= z1; ··· 527 525 Rt *= ts->x_plate_ohms; 528 526 Rt /= z1; 529 527 Rt = (Rt + 2047) >> 12; 530 - } else 528 + } else { 531 529 Rt = 0; 532 - 533 - if (ts->model == 7843) 534 - Rt = ts->pressure_max / 2; 530 + } 535 531 536 532 /* Sample found inconsistent by debouncing or pressure is beyond 537 533 * the maximum. Don't report it to user space, repeat at least