From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:44457 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbdLZVl4 (ORCPT ); Tue, 26 Dec 2017 16:41:56 -0500 Message-ID: <1514324496.2714.69.camel@decadent.org.uk> Subject: Re: [PATCH 4.14 015/159] bitops: Add clear/set_bit32() to linux/bitops.h From: Ben Hutchings To: Greg Kroah-Hartman , Andi Kleen Cc: inux-kernel@vger.kernel.org, stable@vger.kernel.org, Thomas Gleixner , Linus Torvalds , Peter Zijlstra , Ingo Molnar Date: Tue, 26 Dec 2017 21:41:36 +0000 In-Reply-To: <20171222084624.604335610@linuxfoundation.org> References: <20171222084623.668990192@linuxfoundation.org> <20171222084624.604335610@linuxfoundation.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-uxfP1LFnmbFAh6Dj0Ay4" Mime-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: --=-uxfP1LFnmbFAh6Dj0Ay4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2017-12-22 at 09:45 +0100, Greg Kroah-Hartman wrote: > 4.14-stable review patch. If anyone has any objections, please let me kn= ow. >=20 > ------------------ >=20 > From: Andi Kleen >=20 > commit cbe96375025e14fc76f9ed42ee5225120d7210f8 upstream. >=20 > 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. These won't work correctly on big-endian 64-bit systems. They are also unsafe to use on u32 arrays with an odd length, on 64-bit systems. This is why lib/bitmap.c has conversion functions for u32 arrays. Ben. > 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 > Signed-off-by: Greg Kroah-Hartman >=20 > --- > include/linux/bitops.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) >=20 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -228,6 +228,32 @@ static inline unsigned long __ffs64(u64 > return __ffs((unsigned long)word); > } > =20 > +/* > + * clear_bit32 - Clear a bit in memory for u32 array > + * @nr: Bit to clear > + * @addr: u32 * address of bitmap > + * > + * Same as clear_bit, but avoids needing casts for u32 arrays. > + */ > + > +static __always_inline void clear_bit32(long nr, volatile u32 *addr) > +{ > + clear_bit(nr, (volatile unsigned long *)addr); > +} > + > +/* > + * 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); > +} > + > #ifdef __KERNEL__ > =20 > #ifndef set_mask_bits >=20 >=20 --=20 Ben Hutchings The world is coming to an end. Please log off. --=-uxfP1LFnmbFAh6Dj0Ay4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErCspvTSmr92z9o8157/I7JWGEQkFAlpCwhAACgkQ57/I7JWG EQm6kw//fSWJ9gffxx9OFgRwXhmLhkAzpWXeiod5nblMtb6vtPBA425+9oiwyFln 5UnMS7CZSczfqXxGfVo8Ze+2OZscuBjTVw8N151WVQlaTwPccKY6BtwO0WwpsQNo VaJXPppz2ZMArVX9PpZZix47R+yeIqdcR85TKOMTwL+Xe2jE7IvzJIexw7sZO2Kb oEZGRjMEKv9eYUnpR2urhFiuKbF8JP39A6BTdaOdqh69RX/3Liy4qCr1BPnG9VnC cROnaYIt2BmDUARUHoBgSxsaI3IYQGb0gbinn/lAUfZjDvnt6wwo0jHN+UznCoaX JRArZ+PLnzzlhXt1QMWeDX0KlbOMUdAswrxp5zTPp7xUJqjI4Ke3czqlCpNhlacf N9+h2efm93mop4aqFnVPxLNhcAuAZshBYQm41Sxxlwi9aDmC2QXClSseV1Rfvmyp wa++NOTpha5xcKZx9bQQNhpP+hayWpV08neudt23il3YqcTnIsNXLte+NNJnPivI 1R2ZnSzUobIEwo67l5YhSOM+puYj5cQxAmboYuK38TcJP/lrjsQD7aSpGVmeD9em iUDyVLrBnr81X97P6Dl4SKvBuk3jHtsEFlGRpVoXr6rgv//fikkSyz7zOGYzCuxr 0+RuTcYUa0wDKFEoqDuljXcUiwuyDwo64mOy9Nx1xdtOA3vmjy0= =Vv50 -----END PGP SIGNATURE----- --=-uxfP1LFnmbFAh6Dj0Ay4--