All of lore.kernel.org
 help / color / mirror / Atom feed
From: laurentiu.tudor@nxp.com (Laurentiu Tudor)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects
Date: Fri, 23 Jun 2017 07:26:18 +0000	[thread overview]
Message-ID: <594CC299.6010308@nxp.com> (raw)
In-Reply-To: <1498147673.24295.6.camel@perches.com>

Hi Joe,

On 06/22/2017 07:07 PM, Joe Perches wrote:
> On Thu, 2017-06-22 at 16:35 +0300, laurentiu.tudor at nxp.com wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>>
>> Several macros were triggering this checkpatch.pl warning:
>>    "Macro argument reuse '$arg' - possible side-effects?"
>> Fix the warning by turning them into real functions.
>
> good idea and
>
>> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
> []
>> +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
>> +				struct dprc_obj_desc *obj_desc)
>> +{
>> +	return !strcmp(mc_dev->obj_desc.type, obj_desc->type) &&
>> +		mc_dev->obj_desc.id == obj_desc->id;
>> +}
>
> I'd reverse the test order and do the strcmp after the comparison
>
> 	return mc_dev->obj_desc.id == obj_desc->id &&
> 	       !strcmp(mc_dev->obj_desc.type, obj_desc->type);
>
> []
>
>> +static bool __must_check fsl_mc_is_allocatable(const char *obj_type)
>> +{
>> +	return strcmp(obj_type, "dpbp") == 0 ||
>> +	       strcmp(obj_type, "dpmcp") == 0 ||
>> +	       strcmp(obj_type, "dpcon") == 0;
>> +}
>
> please be consistent in using either == 0 or !
> when using strcmp
>

Thanks for the suggestions. Will take care of them in the next round.

---
Best Regards, Laurentiu

WARNING: multiple messages have this Message-ID (diff)
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Joe Perches <joe@perches.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"stuyoder@gmail.com" <stuyoder@gmail.com>
Cc: "devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"marc.zyngier@arm.com" <marc.zyngier@arm.com>,
	"agraf@suse.de" <agraf@suse.de>, "arnd@arndb.de" <arnd@arndb.de>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Ruxandra Ioana Radulescu <ruxandra.radulescu@nxp.com>,
	Bharat Bhushan <bharat.bhushan@nxp.com>,
	Catalin Horghidan <catalin.horghidan@nxp.com>,
	Leo Li <leoyang.li@nxp.com>, Roy Pledge <roy.pledge@nxp.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects
Date: Fri, 23 Jun 2017 07:26:18 +0000	[thread overview]
Message-ID: <594CC299.6010308@nxp.com> (raw)
In-Reply-To: <1498147673.24295.6.camel@perches.com>

Hi Joe,

On 06/22/2017 07:07 PM, Joe Perches wrote:
> On Thu, 2017-06-22 at 16:35 +0300, laurentiu.tudor@nxp.com wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>>
>> Several macros were triggering this checkpatch.pl warning:
>>    "Macro argument reuse '$arg' - possible side-effects?"
>> Fix the warning by turning them into real functions.
>
> good idea and
>
>> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
> []
>> +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
>> +				struct dprc_obj_desc *obj_desc)
>> +{
>> +	return !strcmp(mc_dev->obj_desc.type, obj_desc->type) &&
>> +		mc_dev->obj_desc.id == obj_desc->id;
>> +}
>
> I'd reverse the test order and do the strcmp after the comparison
>
> 	return mc_dev->obj_desc.id == obj_desc->id &&
> 	       !strcmp(mc_dev->obj_desc.type, obj_desc->type);
>
> []
>
>> +static bool __must_check fsl_mc_is_allocatable(const char *obj_type)
>> +{
>> +	return strcmp(obj_type, "dpbp") == 0 ||
>> +	       strcmp(obj_type, "dpmcp") == 0 ||
>> +	       strcmp(obj_type, "dpcon") == 0;
>> +}
>
> please be consistent in using either == 0 or !
> when using strcmp
>

Thanks for the suggestions. Will take care of them in the next round.

---
Best Regards, Laurentiu

  reply	other threads:[~2017-06-23  7:26 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 13:35 [PATCH 00/14] staging: fsl-mc: clean up header files laurentiu.tudor at nxp.com
2017-06-22 13:35 ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 16:07   ` Joe Perches
2017-06-22 16:07     ` Joe Perches
2017-06-23  7:26     ` Laurentiu Tudor [this message]
2017-06-23  7:26       ` Laurentiu Tudor
2017-06-22 13:35 ` [PATCH 02/14] staging: fsl-mc: drop useless #includes laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 03/14] staging: fsl-mc: decouple the mc-bus public headers from dprc.h laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 04/14] staging: fsl-mc: delete duplicated function prototypes laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 05/14] staging: fsl-mc: delete prototype of unimplemented function laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 06/14] staging: fsl-mc: turn several exported functions static laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 07/14] staging: fsl-mc: move irq domain creation prototype to public header laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 08/14] staging: fsl-mc: move couple of definitions " laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 09/14] staging: fsl-mc: move rest of mc-bus.h to private header laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 10/14] staging: fsl-mc: remove dpmng API files laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 11/14] staging: fsl-mc: fix a few implicit includes laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 12/14] staging: fsl-mc: move mc-sys.h contents in the public header laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:35 ` [PATCH 13/14] staging: fsl-mc: move mc-cmd.h " laurentiu.tudor at nxp.com
2017-06-22 13:35   ` laurentiu.tudor
2017-06-22 13:36 ` [PATCH 14/14] staging: fsl-mc: make dprc.h header private laurentiu.tudor at nxp.com
2017-06-22 13:36   ` laurentiu.tudor

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=594CC299.6010308@nxp.com \
    --to=laurentiu.tudor@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.