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


Groups > linux.kernel > #1528806

Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function

From Markus Böhme <markus.boehme@mailbox.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function
Date 2016-11-23 23:40 +0100
Message-ID <sGOmR-2pg-3@gated-at.bofh.it> (permalink)
References <sGK9B-8fN-59@gated-at.bofh.it> <sGKjg-8nq-21@gated-at.bofh.it> <sGL5D-rk-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/23/2016 08:00 PM, Markus Böhme wrote:
> On 11/23/2016 07:10 PM, Sergio Paracuellos wrote:
>> This patch replaces UPDATE_STATS_GB macro in slic.h header file
>> into an inline function. This provides type safety and readability.
>>
>> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> ---
>>  drivers/staging/slicoss/slic.h    |  6 ++---
>>  drivers/staging/slicoss/slicoss.c | 56 ++++++++++++++++++++-------------------
>>  2 files changed, 32 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
>> index 2c05868..b19ddc9 100644
>> --- a/drivers/staging/slicoss/slic.h
>> +++ b/drivers/staging/slicoss/slic.h
>> @@ -548,9 +548,9 @@ static inline void slic_flush_write(struct adapter *adapter)
>>  	ioread32(adapter->regs + SLIC_REG_HOSTID);
>>  }
>>  
>> -#define UPDATE_STATS_GB(largestat, newstat, oldstat)                     \
>> -{                                                                        \
>> -	(largestat) += ((newstat) - (oldstat));                          \
>> +static inline u64 update_stats_gb(const u64 newstat, const u64 oldstat)
>> +{
>> +	return (newstat - oldstat);
>>  }
>>  
> 
> I suggest dropping the parentheses here. They are unnecessary and likely
> to lead to a cleanup patch.
> 

Giving it a second thought, perhaps one should do without this
macro/function and just inline the calculation. IMO this would improve
readability even more.

Regards,
Markus

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


Thread

[PATCH 0/2] staging: slicoss: minor changes to clean some code Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-11-23 19:10 +0100
  [PATCH 1/2] staging: slicoss: remove not used UPDATE_STATS macro Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-11-23 19:20 +0100
  [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-11-23 19:20 +0100
    Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into  an inline function Markus Böhme <markus.boehme@mailbox.org> - 2016-11-23 20:10 +0100
      Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into  an inline function Markus Böhme <markus.boehme@mailbox.org> - 2016-11-23 23:40 +0100
        Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into  an inline function Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-11-24 20:10 +0100

csiph-web