From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbdJLSaV (ORCPT ); Thu, 12 Oct 2017 14:30:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37920 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751937AbdJLSaU (ORCPT ); Thu, 12 Oct 2017 14:30:20 -0400 Date: Thu, 12 Oct 2017 11:30:17 -0700 From: Andrew Morton To: Lukas Wunner Cc: Linus Walleij , Mathias Duckeck , Phil Elwell , linux-gpio@vger.kernel.org, Bart Van Assche , Alasdair Kergon , Mike Snitzer , Neil Brown , Peter Zijlstra , Ingo Molnar , "Theodore Ts'o" , Borislav Petkov , "H. Peter Anvin" , Denys Vlasenko , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/5] bitops: Introduce assign_bit() Message-Id: <20171012113017.a088595ca60df1d591aebe38@linux-foundation.org> In-Reply-To: <2ca70faf07383482eed6263c00cf9141f930653b.1507797496.git.lukas@wunner.de> References: <2ca70faf07383482eed6263c00cf9141f930653b.1507797496.git.lukas@wunner.de> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 Oct 2017 12:40:10 +0200 Lukas Wunner wrote: > A common idiom is to assign a value to a bit with: > > if (value) > set_bit(nr, addr); > else > clear_bit(nr, addr); > > Likewise common is the one-line expression variant: > > value ? set_bit(nr, addr) : clear_bit(nr, addr); > > Commit 9a8ac3ae682e ("dm mpath: cleanup QUEUE_IF_NO_PATH bit > manipulation by introducing assign_bit()") introduced assign_bit() > to the md subsystem for brevity. > > Make it available to others, specifically gpiolib and the upcoming > driver for Maxim MAX3191x industrial serializer chips. > > As requested by Peter Zijlstra, change the argument order to reflect > traditional "dst = src" in C, hence "assign_bit(nr, addr, value)". Acked-by: Andrew Morton