lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMhs-H-eCa1nx0T4t2RG1pKt5BJ_M_rBB6WgV=hSLTkys7kjtg@mail.gmail.com>
Date:   Thu, 24 Nov 2016 20:01:54 +0100
From:   Sergio Paracuellos <sergio.paracuellos@...il.com>
To:     Markus Böhme <markus.boehme@...lbox.org>
Cc:     Greg KH <gregkh@...uxfoundation.org>, devel@...verdev.osuosl.org,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Lior Dotan <liodot@...il.com>
Subject: Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into
 an inline function

On Wed, Nov 23, 2016 at 11:32 PM, Markus Böhme
<markus.boehme@...lbox.org> wrote:
> 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@...il.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.

I see. Ok, I'll remove this inline function and macro and send a V2
patchset with just the calculation inlined.

Thanks,

Sergio Paracuellos

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ