From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751007AbdKEPxq (ORCPT ); Sun, 5 Nov 2017 10:53:46 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43908 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750731AbdKEPxo (ORCPT ); Sun, 5 Nov 2017 10:53:44 -0500 Date: Sun, 5 Nov 2017 16:53:34 +0100 From: Heiko Carstens To: hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, ak@linux.intel.com Cc: linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/fpu] bitops: Add clear/set_bit32() to linux/bitops.h References: <20171013215645.23166-2-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 x-cbid: 17110515-0008-0000-0000-000004A7BA79 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110515-0009-0000-0000-00001E3A4AFF Message-Id: <20171105155334.GA3225@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-05_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711050230 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 17, 2017 at 09:21:46AM -0700, tip-bot for Andi Kleen wrote: > Commit-ID: cbe96375025e14fc76f9ed42ee5225120d7210f8 > Gitweb: https://git.kernel.org/tip/cbe96375025e14fc76f9ed42ee5225120d7210f8 > Author: Andi Kleen > AuthorDate: Fri, 13 Oct 2017 14:56:41 -0700 > Committer: Ingo Molnar > CommitDate: Tue, 17 Oct 2017 17:14:56 +0200 > > bitops: Add clear/set_bit32() to linux/bitops.h > > Add two simple wrappers around set_bit/clear_bit() that accept > the common case of an u32 array. This avoids writing > casts in all callers. > > Signed-off-by: Andi Kleen > Reviewed-by: Thomas Gleixner > Cc: Linus Torvalds > Cc: Peter Zijlstra > Link: http://lkml.kernel.org/r/20171013215645.23166-2-andi@firstfloor.org > Signed-off-by: Ingo Molnar > --- > include/linux/bitops.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) ... > + * set_bit32 - Set a bit in memory for u32 array > + * @nr: Bit to clear > + * @addr: u32 * address of bitmap > + * > + * Same as set_bit, but avoids needing casts for u32 arrays. > + */ > + > +static __always_inline void set_bit32(long nr, volatile u32 *addr) > +{ > + set_bit(nr, (volatile unsigned long *)addr); > +} This does not work at all on 64 bit big endian machines. If e.g. the array would contain only one 32 bit member set_bit() would write to whatever is behind the array.