Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbdFWH0Z (ORCPT ); Fri, 23 Jun 2017 03:26:25 -0400 Received: from mail-eopbgr50069.outbound.protection.outlook.com ([40.107.5.69]:60704 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751240AbdFWH0X (ORCPT ); Fri, 23 Jun 2017 03:26:23 -0400 From: Laurentiu Tudor To: Joe Perches , "gregkh@linuxfoundation.org" , "stuyoder@gmail.com" CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "marc.zyngier@arm.com" , "agraf@suse.de" , "arnd@arndb.de" , Ioana Ciornei , Ruxandra Ioana Radulescu , Bharat Bhushan , Catalin Horghidan , Leo Li , Roy Pledge , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects Thread-Topic: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects Thread-Index: AQHS61yIhMhLG3rBsEyDE4F2nFjCf6IxDK6AgAEAmYA= Date: Fri, 23 Jun 2017 07:26:18 +0000 Message-ID: <594CC299.6010308@nxp.com> References: <20170622133600.31694-1-laurentiu.tudor@nxp.com> <20170622133600.31694-2-laurentiu.tudor@nxp.com> <1498147673.24295.6.camel@perches.com> In-Reply-To: <1498147673.24295.6.camel@perches.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: perches.com; dkim=none (message not signed) header.d=none;perches.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.88.146.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM4PR0401MB1716;7:A7g6GJcDJFZS3T4/KG48SuBG+3R1l8qydPftQaDeS6wlh4a4xUc1R417simvzmd5/bbTW6hy2CZLZkZtkfWsr021IvnfMY/zmjZBxUp2S/k8Ju+tVmDRZGGnBKKPjFCLgIZogLY4MIBt+QcGGdVWNpNcefMi7o2zirwhu3+XXxB7rkp1IbSfOwAnl3rn9Z7PHs6QnZOC8iYEmu1rpHN6JM0zb4kRuVVoVUHnuZxaQJhI6MddaoczQQxaDa7as0DqNVZMBlXsUEIfED2/OnZbHPPyaOYvWdZCt6gAQKgM47IIbf/qAQqT7gi0mtCNmodsxZUQl5gMVK32Wul2BYOCf1WRsMY0ZcTTg3illoqyCmld9l2VoEIa8DzPe9iNDoBtOqrzp1s8LsHXMqoOBxu2HXX3vyTHOxJPOoMnmwpPvpyAsDccQTT7oOpOd51AkU67XXWqDlypd8UquU9W0tN7qqG3Dfp+gr7TAcaHwBeTSZquADgnrlO7G2Megf2Eg9sFY50aXRpnaml/h2D1envJSlTwjew5yTtU8hdN1Z4UPoDcKAvoGLrGZUpU+GNoyEm5cwpHiVdwm1Z/sbFJAlgZ73ZKbbIgEM7URMXWUi5fO57LdkCnSJ9ShJK2aVEf0pXE1u4sFmJplGwE8mOVUtyPTmZv5N/HB4QeegiyFEa97Prku5CQLe9AVFsLH16I3lAlIbDG8YuhvT7VElH4Ibq+IZYVEh/zXQ4vIYZ4egVhckyZ2I95LIe958F5+mYgue6ekinh1IhlxUNC0AEiLQN757ydroCrbFESX8sxXGI7Amo= x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(39850400002)(39400400002)(39410400002)(39450400003)(39840400002)(39860400002)(43544003)(377424004)(377454003)(24454002)(51914003)(81166006)(54356999)(87266999)(86362001)(8936002)(50986999)(2201001)(76176999)(2906002)(3280700002)(3660700001)(36756003)(53546010)(5250100002)(33656002)(53936002)(5660300001)(59896002)(38730400002)(6246003)(66066001)(14454004)(25786009)(39060400002)(8676002)(65816999)(189998001)(2900100001)(6506006)(2501003)(478600001)(6512007)(54906002)(3846002)(6116002)(2950100002)(6436002)(7736002)(305945005)(80316001)(99286003)(4326008)(6486002)(102836003)(229853002)(56340200001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR0401MB1716;H:AM4PR0401MB1841.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; x-ms-office365-filtering-correlation-id: fcc84655-7a22-4c88-ce1d-08d4ba0923af x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:AM4PR0401MB1716; x-ms-traffictypediagnostic: AM4PR0401MB1716: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123555025)(20161123560025)(20161123558100)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:AM4PR0401MB1716;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:AM4PR0401MB1716; x-forefront-prvs: 0347410860 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="Windows-1252" Content-ID: MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jun 2017 07:26:18.1028 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB1716 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5N7QUbd008445 Content-Length: 1282 Lines: 43 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 >> >> 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