From owner-svn-src-all@freebsd.org Mon May 23 13:18:16 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B821B46C3D; Mon, 23 May 2016 13:18:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 363851083; Mon, 23 May 2016 13:18:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4NDIFfe033088; Mon, 23 May 2016 13:18:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4NDIFsO033087; Mon, 23 May 2016 13:18:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605231318.u4NDIFsO033087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 23 May 2016 13:18:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300506 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 13:18:16 -0000 Author: hselasky Date: Mon May 23 13:18:15 2016 New Revision: 300506 URL: https://svnweb.freebsd.org/changeset/base/300506 Log: Fix some data types and add "inline" keyword for __reg_op() function. Obtained from: kmacy @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 13:17:37 2016 (r300505) +++ head/sys/compat/linuxkpi/common/include/linux/bitops.h Mon May 23 13:18:15 2016 (r300506) @@ -93,7 +93,7 @@ static inline int get_count_order(unsign } static inline unsigned long -find_first_bit(unsigned long *addr, unsigned long size) +find_first_bit(const unsigned long *addr, unsigned long size) { long mask; int bit; @@ -115,7 +115,7 @@ find_first_bit(unsigned long *addr, unsi } static inline unsigned long -find_first_zero_bit(unsigned long *addr, unsigned long size) +find_first_zero_bit(const unsigned long *addr, unsigned long size) { long mask; int bit; @@ -137,7 +137,7 @@ find_first_zero_bit(unsigned long *addr, } static inline unsigned long -find_last_bit(unsigned long *addr, unsigned long size) +find_last_bit(const unsigned long *addr, unsigned long size) { long mask; int offs; @@ -163,7 +163,7 @@ find_last_bit(unsigned long *addr, unsig } static inline unsigned long -find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset) +find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { long mask; int offs; @@ -202,7 +202,7 @@ find_next_bit(unsigned long *addr, unsig } static inline unsigned long -find_next_zero_bit(unsigned long *addr, unsigned long size, +find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { long mask; @@ -306,23 +306,23 @@ bitmap_empty(unsigned long *addr, int si } #define __set_bit(i, a) \ - atomic_set_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define set_bit(i, a) \ - atomic_set_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define __clear_bit(i, a) \ - atomic_clear_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define clear_bit(i, a) \ - atomic_clear_long(&((volatile long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) #define test_bit(i, a) \ - !!(atomic_load_acq_long(&((volatile long *)(a))[BIT_WORD(i)]) & \ + !!(atomic_load_acq_long(&((volatile unsigned long *)(a))[BIT_WORD(i)]) & \ BIT_MASK(i)) -static inline long -test_and_clear_bit(long bit, long *var) +static inline int +test_and_clear_bit(long bit, volatile unsigned long *var) { long val; @@ -330,14 +330,14 @@ test_and_clear_bit(long bit, long *var) bit %= BITS_PER_LONG; bit = (1UL << bit); do { - val = *(volatile long *)var; + val = *var; } while (atomic_cmpset_long(var, val, val & ~bit) == 0); return !!(val & bit); } -static inline long -test_and_set_bit(long bit, long *var) +static inline int +test_and_set_bit(long bit, volatile unsigned long *var) { long val; @@ -345,7 +345,7 @@ test_and_set_bit(long bit, long *var) bit %= BITS_PER_LONG; bit = (1UL << bit); do { - val = *(volatile long *)var; + val = *var; } while (atomic_cmpset_long(var, val, val | bit) == 0); return !!(val & bit); @@ -399,7 +399,8 @@ enum { REG_OP_RELEASE, }; -static int __reg_op(unsigned long *bitmap, int pos, int order, int reg_op) +static inline int +__reg_op(unsigned long *bitmap, int pos, int order, int reg_op) { int nbits_reg; int index;