From patchwork Fri Apr 23 01:55:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 94577 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3N1rAaW028232 for ; Fri, 23 Apr 2010 01:53:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754757Ab0DWBwQ (ORCPT ); Thu, 22 Apr 2010 21:52:16 -0400 Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:39604 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754596Ab0DWBwP (ORCPT ); Thu, 22 Apr 2010 21:52:15 -0400 Received: from serv2.oss.ntt.co.jp (localhost [127.0.0.1]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id 5D27B2482EA; Fri, 23 Apr 2010 10:52:14 +0900 (JST) Received: from serv1.oss.ntt.co.jp (serv1.oss.ntt.co.jp [172.19.0.2]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id 4C64324826A; Fri, 23 Apr 2010 10:52:14 +0900 (JST) Received: from yshtky3.kern.oss.ntt.co.jp (unknown [172.17.1.163]) by serv1.oss.ntt.co.jp (Postfix) with SMTP id 3639F11C00B; Fri, 23 Apr 2010 10:52:14 +0900 (JST) Date: Fri, 23 Apr 2010 10:55:57 +0900 From: Takuya Yoshikawa To: arnd@arndb.de Cc: linux-arch@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, fernando@oss.ntt.co.jp Subject: [RFC PATCH] asm-generic: bitops: introduce le bit offset macro Message-Id: <20100423105557.b6128879.yoshikawa.takuya@oss.ntt.co.jp> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.16.1; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 23 Apr 2010 01:53:10 +0000 (UTC) diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h index 80e3bf1..6af2e54 100644 --- a/include/asm-generic/bitops/le.h +++ b/include/asm-generic/bitops/le.h @@ -9,6 +9,8 @@ #if defined(__LITTLE_ENDIAN) +#define generic_le_bit_offset(nr) (nr) + #define generic_test_le_bit(nr, addr) test_bit(nr, addr) #define generic___set_le_bit(nr, addr) __set_bit(nr, addr) #define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr) @@ -25,22 +27,24 @@ #elif defined(__BIG_ENDIAN) +#define generic_le_bit_offset(nr) ((nr) ^ BITOP_LE_SWIZZLE) + #define generic_test_le_bit(nr, addr) \ - test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_bit(generic_le_bit_offset(nr), (addr)) #define generic___set_le_bit(nr, addr) \ - __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __set_bit(generic_le_bit_offset(nr), (addr)) #define generic___clear_le_bit(nr, addr) \ - __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __clear_bit(generic_le_bit_offset(nr), (addr)) #define generic_test_and_set_le_bit(nr, addr) \ - test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_and_set_bit(generic_le_bit_offset(nr), (addr)) #define generic_test_and_clear_le_bit(nr, addr) \ - test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + test_and_clear_bit(generic_le_bit_offset(nr), (addr)) #define generic___test_and_set_le_bit(nr, addr) \ - __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __test_and_set_bit(generic_le_bit_offset(nr), (addr)) #define generic___test_and_clear_le_bit(nr, addr) \ - __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) + __test_and_clear_bit(generic_le_bit_offset(nr), (addr)) extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned long size, unsigned long offset);