Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754442AbbETTxA (ORCPT ); Wed, 20 May 2015 15:53:00 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:35021 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753042AbbETTw5 (ORCPT ); Wed, 20 May 2015 15:52:57 -0400 Message-ID: <555CE617.2040201@kernel.dk> Date: Wed, 20 May 2015 13:52:55 -0600 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Jagan Teki CC: "linux-kernel@vger.kernel.org" , Wolfram Sang Subject: Re: [PATCH] block: Use BIT macro from include/linux/bitops.h References: <1431976472-27596-1-git-send-email-jteki@openedev.com> <555CDF0A.9080006@kernel.dk> <555CE3C4.7010406@kernel.dk> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1538 Lines: 45 On 05/20/2015 01:50 PM, Jagan Teki wrote: > On 21 May 2015 at 01:13, Jens Axboe wrote: >> On 05/20/2015 01:41 PM, Jagan Teki wrote: >>> >>> On 21 May 2015 at 00:52, Jens Axboe wrote: >>>> >>>> On 05/18/2015 01:14 PM, Jagan Teki wrote: >>>>> >>>>> >>>>> Replace (1 << nr) to BIT(nr) where nr = 0, 1, 2 .... 31 >>>> >>>> >>>> >>>> I don't like it, I think it hurts readability. >>> >>> >>> What do you mean by don't like, using kernel defined macro instead of >>> numerical assignments huts readability? >> >> >> In the context of the patch, BIT(0) == (1 << 0) is obvious. But if I just >> came across BIT(7) in the code, I'd have to check, whereas anyone would >> immediately know that (1 << 7) is the 7th bit set. Hence, readability is >> worse, and that's important. > > I don't how that BIT(7) is tricky to understand as BIT(0) implies to > be set 0th bit. > If understanding of BIT(0) is same like to be as BIT(7) and these were > simplified > macro's used most of the code in kernel. Well of course, if you know what BIT(7) is, you know what BIT(0) is. My point is that I don't know what either of them are, I'd have to look it up. Whereas anyone would immediately know what (1 << 7) or (1 << 0) is without having to look further. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/