Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbcDNDKL (ORCPT ); Wed, 13 Apr 2016 23:10:11 -0400 Received: from m50-134.163.com ([123.125.50.134]:41094 "EHLO m50-134.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752980AbcDNDKG (ORCPT ); Wed, 13 Apr 2016 23:10:06 -0400 From: zengzhaoxiu@163.com To: linux-kernel@vger.kernel.org Cc: Zhaoxiu Zeng , Mauro Carvalho Chehab , Hans Verkuil , Krzysztof Kozlowski , Arnd Bergmann , linux-media@vger.kernel.org Subject: [PATCH V3 14/29] media: use parity functions in saa7115 Date: Thu, 14 Apr 2016 11:09:50 +0800 Message-Id: <1460603392-5171-1-git-send-email-zengzhaoxiu@163.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460601525-3822-1-git-send-email-zengzhaoxiu@163.com> References: <1460601525-3822-1-git-send-email-zengzhaoxiu@163.com> X-CM-TRANSID: DtGowAD3VWABCg9Xg1oBAg--.33654S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7ArWUCw1kurWDury5Cry7GFg_yoW8GF48pa nxJry0kFyfta17ZF47Xa1qya4Yyr97W347Kr43W3s7WFsxCF18tryrta9avF9avFWxtFW7 ZrnxurWDZrWqyr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bF18PUUUUU= X-Originating-IP: [112.95.225.98] X-CM-SenderInfo: p2hqw6xkdr5xrx6rljoofrz/1tbiGQVLgFXlSLvGVQAAsH Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1420 Lines: 60 From: Zhaoxiu Zeng Signed-off-by: Zhaoxiu Zeng --- drivers/media/i2c/saa7115.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c index d2a1ce2..4c22df8 100644 --- a/drivers/media/i2c/saa7115.c +++ b/drivers/media/i2c/saa7115.c @@ -672,15 +672,6 @@ static const unsigned char saa7115_init_misc[] = { 0x00, 0x00 }; -static int saa711x_odd_parity(u8 c) -{ - c ^= (c >> 4); - c ^= (c >> 2); - c ^= (c >> 1); - - return c & 1; -} - static int saa711x_decode_vps(u8 *dst, u8 *p) { static const u8 biphase_tbl[] = { @@ -733,7 +724,6 @@ static int saa711x_decode_wss(u8 *p) static const int wss_bits[8] = { 0, 0, 0, 1, 0, 1, 1, 1 }; - unsigned char parity; int wss = 0; int i; @@ -745,11 +735,8 @@ static int saa711x_decode_wss(u8 *p) return -1; wss |= b2 << i; } - parity = wss & 15; - parity ^= parity >> 2; - parity ^= parity >> 1; - if (!(parity & 1)) + if (!parity4(wss)) return -1; return wss; @@ -1235,7 +1222,7 @@ static int saa711x_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vb vbi->type = V4L2_SLICED_TELETEXT_B; break; case 4: - if (!saa711x_odd_parity(p[0]) || !saa711x_odd_parity(p[1])) + if (!parity8(p[0]) || !parity8(p[1])) return 0; vbi->type = V4L2_SLICED_CAPTION_525; break; -- 2.5.0