Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378434 > unrolled thread

[PATCH V3 17/29] input: use parity16 in ams_delta_serio

Started byzengzhaoxiu@163.com
First post2016-04-14 05:20 +0200
Last post2016-04-14 05:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V3 17/29] input: use parity16 in ams_delta_serio zengzhaoxiu@163.com - 2016-04-14 05:20 +0200

#1378434 — [PATCH V3 17/29] input: use parity16 in ams_delta_serio

Fromzengzhaoxiu@163.com
Date2016-04-14 05:20 +0200
Subject[PATCH V3 17/29] input: use parity16 in ams_delta_serio
Message-ID<rnFZ0-3tc-3@gated-at.bofh.it>
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/input/serio/ams_delta_serio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 45887e3..85459b3 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -48,13 +48,9 @@ static int check_data(int data)
 				data);
 		return SERIO_FRAME;
 	}
-	/* calculate the parity */
-	for (i = 1; i < 10; i++) {
-		if (data & (1 << i))
-			parity++;
-	}
 	/* it should be odd */
-	if (!(parity & 0x01)) {
+	parity = parity16(data & 0x3fe);
+	if (!parity) {
 		dev_warn(&ams_delta_serio->dev,
 				"paritiy check failed, data=0x%X parity=0x%X\n",
 				data, parity);
-- 
2.5.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web