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