Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbcC0Fra (ORCPT ); Sun, 27 Mar 2016 01:47:30 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36334 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750701AbcC0Fr3 (ORCPT ); Sun, 27 Mar 2016 01:47:29 -0400 Subject: [PATCH 04/31] Add avr32-specific parity functions To: Haavard Skinnemoen , Hans-Christian Egtvedt , Zeng Zhaoxiu References: <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com> Cc: "linux-kernel@vger.kernel.org" From: "zhaoxiu.zeng" Message-ID: <56F773D6.9070502@gmail.com> Date: Sun, 27 Mar 2016 13:47:02 +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: 1333 Lines: 52 From: Zeng Zhaoxiu Signed-off-by: Zeng Zhaoxiu --- arch/avr32/include/asm/bitops.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/avr32/include/asm/bitops.h b/arch/avr32/include/asm/bitops.h index 910d537..80d7005 100644 --- a/arch/avr32/include/asm/bitops.h +++ b/arch/avr32/include/asm/bitops.h @@ -300,6 +300,38 @@ static inline int ffs(unsigned long word) #include #include +static inline unsigned int __arch_parity4(unsigned int w) +{ + w ^= w >> 2; + w ^= w >> 1; + return w & 1; +} + +static inline unsigned int __arch_parity8(unsigned int w) +{ + w ^= w >> 4; + return __arch_parity4(w); +} + +static inline unsigned int __arch_parity16(unsigned int w) +{ + w ^= w >> 8; + return __arch_parity8(w); +} + +static inline unsigned int __arch_parity32(unsigned int w) +{ + w ^= w >> 16; + return __arch_parity16(w); +} + +static inline unsigned int __arch_parity64(__u64 w) +{ + return __arch_parity32((unsigned int)(w >> 32) ^ (unsigned int)w); +} + +#include + extern unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset); #define find_next_zero_bit_le find_next_zero_bit_le -- 2.5.5