From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: "Drokin, Oleg" <oleg.drokin@intel.com>,
James Simmons <jsimmons@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"lustre-devel@lists.lustre.org" <lustre-devel@lists.lustre.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"outreachy-kernel@googlegroups.com"
<outreachy-kernel@googlegroups.com>
Subject: Re: [PATCH] staging: lustre: Replace a bit shift by a use of BIT.
Date: Thu, 23 Mar 2017 20:43:59 +0000 [thread overview]
Message-ID: <B070C8EE-1F72-4D6B-A80E-C33DB22151ED@intel.com> (raw)
In-Reply-To: <FE801B69-BCDE-4A58-B61D-B33E46826D5F@intel.com>
On Mar 22, 2017, at 06:12, Dilger, Andreas <andreas.dilger@intel.com> wrote:
>
> On Mar 21, 2017, at 22:39, Arushi Singhal <arushisinghal19971997@gmail.com> wrote:
>>
>> This patch replaces bit shifting on 1 with the BIT(x) macro.
>> This was done with coccinelle:
[snip]
>> diff --git a/drivers/staging/lustre/lnet/lnet/net_fault.c b/drivers/staging/lustre/lnet/lnet/net_fault.c
>> index 18183cbb9859..e83761a77d22 100644
>> --- a/drivers/staging/lustre/lnet/lnet/net_fault.c
>> +++ b/drivers/staging/lustre/lnet/lnet/net_fault.c
>> @@ -997,10 +997,10 @@ lnet_fault_ctl(int opc, struct libcfs_ioctl_data *data)
>> int
>> lnet_fault_init(void)
>> {
>> - BUILD_BUG_ON(LNET_PUT_BIT != 1 << LNET_MSG_PUT);
>> - BUILD_BUG_ON(LNET_ACK_BIT != 1 << LNET_MSG_ACK);
>> - BUILD_BUG_ON(LNET_GET_BIT != 1 << LNET_MSG_GET);
>> - BUILD_BUG_ON(LNET_REPLY_BIT != 1 << LNET_MSG_REPLY);
>> + BUILD_BUG_ON(LNET_PUT_BIT != BIT(LNET_MSG_PUT));
>> + BUILD_BUG_ON(LNET_ACK_BIT != BIT(LNET_MSG_ACK));
>> + BUILD_BUG_ON(LNET_GET_BIT != BIT(LNET_MSG_GET));
>> + BUILD_BUG_ON(LNET_REPLY_BIT != BIT(LNET_MSG_REPLY));
>
> This looks reasonable at first glance, though on further thought it seems kind of
> pointless since this is really:
>
> #defined LET_PUT_BIT BIT(LNET_MSG_PUT)
>
> BUILD_BUG_ON(BIT(LNET_MSG_PUT) != BIT(LNET_MSG_PUT))
>
> so it is just checking that the macro's value is the same when called two times.
> I'd suggest just getting rid of these BUILD_BUG_ON() checks completely .
Arushi, it would be great if you could submit a patch to remove the above
BUILD_BUG_ON() lines completely. I don't think they have any value anymore.
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
prev parent reply other threads:[~2017-03-23 20:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 2:39 [PATCH] staging: lustre: Replace a bit shift by a use of BIT Arushi Singhal
2017-03-22 12:12 ` Dilger, Andreas
2017-03-23 20:43 ` Dilger, Andreas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B070C8EE-1F72-4D6B-A80E-C33DB22151ED@intel.com \
--to=andreas.dilger@intel.com \
--cc=arushisinghal19971997@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jsimmons@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox