Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1607893

Re: [PATCH] staging: lustre: Replace a bit shift by a use of BIT.

From "Dilger, Andreas" <andreas.dilger@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: lustre: Replace a bit shift by a use of BIT.
Date 2017-03-23 21:50 +0100
Message-ID <tohQe-7EA-5@gated-at.bofh.it> (permalink)
References <tnEYy-4sn-5@gated-at.bofh.it> <tnNp7-2fJ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] staging: lustre: Replace a bit shift by a use of BIT. Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-22 04:20 +0100
  Re: [PATCH] staging: lustre: Replace a bit shift by a use of BIT. "Dilger, Andreas" <andreas.dilger@intel.com> - 2017-03-22 13:20 +0100
    Re: [PATCH] staging: lustre: Replace a bit shift by a use of BIT. "Dilger, Andreas" <andreas.dilger@intel.com> - 2017-03-23 21:50 +0100

csiph-web