Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753305AbcC0HKv (ORCPT ); Sun, 27 Mar 2016 03:10:51 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35994 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbcC0HKo (ORCPT ); Sun, 27 Mar 2016 03:10:44 -0400 Subject: [PATCH 16/31] media: saa7115: use parity functions To: Mauro Carvalho Chehab , Arnd Bergmann , Krzysztof Kozlowski , Hans Verkuil References: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org From: "zhaoxiu.zeng" Message-ID: <56F78758.5050307@gmail.com> Date: Sun, 27 Mar 2016 15:10:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1419 Lines: 59 From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- 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.5