From mboxrd@z Thu Jan 1 00:00:00 1970 From: Javier Martinez Canillas Subject: Re: [PATCH 0/4] use BIT() macro instead manually shifting bits Date: Sun, 27 Apr 2014 12:46:04 +0200 Message-ID: References: <1398556850-27751-1-git-send-email-javier@dowhile0.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-we0-f178.google.com ([74.125.82.178]:63898 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751430AbaD0KqG (ORCPT ); Sun, 27 Apr 2014 06:46:06 -0400 Received: by mail-we0-f178.google.com with SMTP id u56so5173364wes.37 for ; Sun, 27 Apr 2014 03:46:04 -0700 (PDT) In-Reply-To: Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Alexandre Courbot Cc: Linus Walleij , Santosh Shilimkar , "linux-gpio@vger.kernel.org" Hello Alexandre, Thanks a lot for your feedback. On Sun, Apr 27, 2014 at 12:16 PM, Alexandre Courbot wrote: > On Sun, Apr 27, 2014 at 9:00 AM, Javier Martinez Canillas > wrote: >> Hello Linus and Alexandre, >> >> While learning coccinelle towards doing the big gpio_chip/gpio_chip_ops >> split refactoring I wrote this trivial semantic patch that replaces a >> manual bit shift by using the BIT macro from >> >> @hasbitops@ >> @@ >> >> #include >> >> @depends on hasbitops@ >> expression E; >> @@ >> >> - 1 << E >> + BIT(E) >> >> @depends on hasbitops@ >> expression E; >> @@ >> >> - BIT((E)) >> + BIT(E) >> >> When applying to the drivers/gpio subdirectory I got >> the following clean up patches for some GPIO drivers. > > I personally find "1 << n" easier to read than a macro, but you are > right that the macro is less error-prone. Nice use of Coccinelle btw, > I should really spend the time to learn it. > > Reviewed-by: Alexandre Courbot Yes I agree that the readability is a matter of personal taste. Do you want me to send a v2 with a better wording on the commit message? Best regards, Javier