From: "Markus Böhme" <markus.boehme@mailbox.org>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>,
gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
liodot@gmail.com
Subject: Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function
Date: Wed, 23 Nov 2016 23:32:00 +0100 [thread overview]
Message-ID: <645cf6ab-73dd-4eec-e619-9df13e1e345b@mailbox.org> (raw)
In-Reply-To: <fce3814c-6516-f5cb-5adf-84f4af2c89bf@mailbox.org>
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
next prev parent reply other threads:[~2016-11-23 22:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 18:10 [PATCH 0/2] staging: slicoss: minor changes to clean some code Sergio Paracuellos
2016-11-23 18:10 ` [PATCH 1/2] staging: slicoss: remove not used UPDATE_STATS macro Sergio Paracuellos
2016-11-23 18:10 ` [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function Sergio Paracuellos
2016-11-23 19:00 ` Markus Böhme
2016-11-23 22:32 ` Markus Böhme [this message]
2016-11-24 19:01 ` Sergio Paracuellos
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=645cf6ab-73dd-4eec-e619-9df13e1e345b@mailbox.org \
--to=markus.boehme@mailbox.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liodot@gmail.com \
--cc=sergio.paracuellos@gmail.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
Powered by JetHome