Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934302AbcKWWcH (ORCPT ); Wed, 23 Nov 2016 17:32:07 -0500 Received: from mx1a.mailbox.org ([80.241.60.218]:37515 "EHLO mx1a.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933256AbcKWWcG (ORCPT ); Wed, 23 Nov 2016 17:32:06 -0500 Subject: Re: [PATCH 2/2] staging: slicoss: replace UPDATE_STATS_GB macro into an inline function To: Sergio Paracuellos , gregkh@linuxfoundation.org References: <1479924629-20231-1-git-send-email-sergio.paracuellos@gmail.com> <1479924629-20231-3-git-send-email-sergio.paracuellos@gmail.com> Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, liodot@gmail.com From: =?UTF-8?Q?Markus_B=c3=b6hme?= Message-ID: <645cf6ab-73dd-4eec-e619-9df13e1e345b@mailbox.org> Date: Wed, 23 Nov 2016 23:32:00 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1480 Lines: 38 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 >> --- >> 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