Skip to contentSkip to conversation

Input: ads7846: fix byteorder in the filtering logic

PATCH New Imre Deak 1 participant 1 message May 12, 2006 Input drivers

lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 Input: ads7846: fix byteorder in the filtering logic

The BE->CPU conversion must be done also in the filtering logic.

drivers/input/touchscreen/ads7846.c +1 -1
Index: linux-2.6/drivers/input/touchscreen/ads7846.c
===================================================================
@@ -471,7 +471,7 @@ static void ads7846_debounce(void *ads)
 
 	m = &ts->msg[ts->msg_idx];
 	t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
-	val = (*(u16 *)t->rx_buf) >> 3;
+	val = (be16_to_cpu(*(__be16 *)t->rx_buf) >> 3) & 0x0fff;
 	if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) {
 		/* Repeat it, if this was the first read or the read
 		 * wasn't consistent enough. */