From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751921AbcDOOVP (ORCPT ); Fri, 15 Apr 2016 10:21:15 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:51295 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbcDOOVM (ORCPT ); Fri, 15 Apr 2016 10:21:12 -0400 X-IronPort-AV: E=Sophos;i="5.24,487,1454972400"; d="scan'208";a="214354692" Date: Fri, 15 Apr 2016 16:20:58 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: =?ISO-8859-15?Q?Christian_K=F6nig?= cc: Julia Lawall , Dave Airlie , kbuild-all@01.org, Alex Deucher , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, joe@perches.com Subject: Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings In-Reply-To: <5710AA53.7070307@amd.com> Message-ID: References: <5710AA53.7070307@amd.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1376999137-1460730035=:3050" Content-ID: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1376999137-1460730035=:3050 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-ID: On Fri, 15 Apr 2016, Christian König wrote: > Am 15.04.2016 um 09:15 schrieb Julia Lawall: > > Move constants to the right of binary operators. > > > > Generated by: scripts/coccinelle/misc/compare_const_fl.cocci > > > > Signed-off-by: Fengguang Wu > > Signed-off-by: Julia Lawall > > In general the patch looks ok, but do we have a documented preference where to > place constants in the coding style docs? > > While it's not so much of a problem any more with modern compilers, some > people still prefer to have it on the left side to catch accidental value > assignments. I don't know if it is documented. Joe Perches suggested that on the right was better in general - maybe he knows if this is written somewhere. There are 504 occurrences of NULL == in the kernel, and 19524 occurrences of == NULL. julia > > Regards, > Christian. > > > --- > > > > Could be nice to put the thing being tested first. > > > > amdgpu_grph_object_id_helpers.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c > > @@ -169,11 +169,11 @@ struct graphics_object_id amdgpu_object_ > > struct graphics_object_id go_id = { 0 }; > > type = object_type_from_bios_object_id(bios_object_id); > > - if (OBJECT_TYPE_UNKNOWN == type) > > + if (type == OBJECT_TYPE_UNKNOWN) > > return go_id; > > enum_id = enum_id_from_bios_object_id(bios_object_id); > > - if (ENUM_ID_UNKNOWN == enum_id) > > + if (enum_id == ENUM_ID_UNKNOWN) > > return go_id; > > go_id = display_graphics_object_id_init( > > --8323329-1376999137-1460730035=:3050-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Subject: Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Date: Fri, 15 Apr 2016 16:20:58 +0200 (CEST) Message-ID: References: <5710AA53.7070307@amd.com> Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323329-1376999137-1460730035=:3050" Return-path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABEA989319 for ; Fri, 15 Apr 2016 14:21:11 +0000 (UTC) In-Reply-To: <5710AA53.7070307@amd.com> Content-ID: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: =?ISO-8859-15?Q?Christian_K=F6nig?= Cc: joe@perches.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Julia Lawall , kbuild-all@01.org, Alex Deucher , Dave Airlie List-Id: dri-devel@lists.freedesktop.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1376999137-1460730035=:3050 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15 Content-ID: Content-Transfer-Encoding: quoted-printable On Fri, 15 Apr 2016, Christian K=F6nig wrote: > Am 15.04.2016 um 09:15 schrieb Julia Lawall: > > Move constants to the right of binary operators. > > > > Generated by: scripts/coccinelle/misc/compare_const_fl.cocci > > > > Signed-off-by: Fengguang Wu > > Signed-off-by: Julia Lawall > > In general the patch looks ok, but do we have a documented preference w= here to > place constants in the coding style docs? > > While it's not so much of a problem any more with modern compilers, som= e > people still prefer to have it on the left side to catch accidental val= ue > assignments. I don't know if it is documented. Joe Perches suggested that on the righ= t was better in general - maybe he knows if this is written somewhere. There are 504 occurrences of NULL =3D=3D in the kernel, and 19524 occurre= nces of =3D=3D NULL. julia > > Regards, > Christian. > > > --- > > > > Could be nice to put the thing being tested first. > > > > amdgpu_grph_object_id_helpers.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c > > @@ -169,11 +169,11 @@ struct graphics_object_id amdgpu_object_ > > struct graphics_object_id go_id =3D { 0 }; > > type =3D object_type_from_bios_object_id(bios_object_id); > > - if (OBJECT_TYPE_UNKNOWN =3D=3D type) > > + if (type =3D=3D OBJECT_TYPE_UNKNOWN) > > return go_id; > > enum_id =3D enum_id_from_bios_object_id(bios_object_id); > > - if (ENUM_ID_UNKNOWN =3D=3D enum_id) > > + if (enum_id =3D=3D ENUM_ID_UNKNOWN) > > return go_id; > > go_id =3D display_graphics_object_id_init( > > --8323329-1376999137-1460730035=:3050 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --8323329-1376999137-1460730035=:3050--