From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751081AbdJBI1J (ORCPT ); Mon, 2 Oct 2017 04:27:09 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:48021 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbdJBI1H (ORCPT ); Mon, 2 Oct 2017 04:27:07 -0400 X-Google-Smtp-Source: AOwi7QBNZmnpxEYqJBxqkWRMymmpsM2Gqgrds3uGU8pDsI/AeJnAxjw1Mv+9O0UFeXdeHOtPgqEr8A== Date: Mon, 2 Oct 2017 10:27:03 +0200 From: Thierry Reding To: =?utf-8?B?SsOpcsOpbXk=?= Lefaure Cc: Alex Deucher , Christian =?utf-8?B?S8O2bmln?= , David Airlie , Patrik Jakobsson , Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ben Skeggs , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org Subject: Re: [PATCH 06/18] drm: use ARRAY_SIZE Message-ID: <20171002082703.GA24250@ulmo> References: <20171001193101.8898-1-jeremy.lefaure@lse.epita.fr> <20171001193101.8898-7-jeremy.lefaure@lse.epita.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline In-Reply-To: <20171001193101.8898-7-jeremy.lefaure@lse.epita.fr> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Oct 01, 2017 at 03:30:44PM -0400, J=C3=A9r=C3=A9my Lefaure wrote: > Using the ARRAY_SIZE macro improves the readability of the code. Also, > it is not always useful to use a variable to store this constant > calculated at compile time nor to re-invent the ARRAY_SIZE macro. >=20 > Found with Coccinelle with the following semantic patch: > @r depends on (org || report)@ > type T; > T[] E; > position p; > @@ > ( > (sizeof(E)@p /sizeof(*E)) > | > (sizeof(E)@p /sizeof(E[...])) > | > (sizeof(E)@p /sizeof(T)) > ) >=20 > Signed-off-by: J=C3=A9r=C3=A9my Lefaure > --- > drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 9 +++++---- > drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 9 +++++---- > drivers/gpu/drm/gma500/psb_intel_sdvo.c | 9 ++++----- > drivers/gpu/drm/i915/gvt/vgpu.c | 3 ++- > drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c | 7 ++++--- > drivers/gpu/drm/via/via_verifier.c | 10 ++++------ > 6 files changed, 24 insertions(+), 23 deletions(-) Reviewed-by: Thierry Reding --OgqxwSJOaUobr8KG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlnR+FAACgkQ3SOs138+ s6FqlA/+Ie73Rwh5+pod1oJoeYslPHTaGbLeIMLwB2ScPKaR65zvVrdQGCCKxd0M 2Agwzz4IDNSZszbiM9LSUAf85kGJOyOfSM/J5pII1vYknuxqprtvCDHbXyuYJSKt 9cwkAHokumHeC2iS1De026SkEUasTQod5JzTug0DGTWsQUt2Cg+Z/eEcxr/EJpQQ SsisGhNFGAz1hgQ/r2Q9U3c48tzE8ejgvwPI32nSK0Mt1wJGQfmhhAJCRhc9Sb2h 0HSYnRpSNIUB9qF9VI9hzU5cuquS6fPnq09DMxU0c45NefbfRLx/bjJuhrciLPDI TaNmy2qpwmhs5iPTGNqHPLjRTlSkmFZ+nciJQJG+pqeQa/nz/KKPNAy3ocvRCurs ZxeajR12fI5+oA+sBk0ugOo9lyURaaX2kY9Ur//98BaDlsb2f0BMfIoheY+aISuD 1gZLm1Igc8U9jjWbzIOklxFTh9iXJNriqGPy3STh62g2nYNIxmmcPENxneVMAuNg YQ2fJz8WYI6cqpyz44RI/uylwOMOF3qeLg9+we+YNnCrKhaUyy7WMMrXMPs+wm+T KPBMb3hnrVOeANHFTWBMIfbgZX9cduCq17NLcf4kYXGVirUgwLYZCot8uufCxFJK +kE3hQisTg4lbFZaBOCeAlICymlsRjQ1x5k+2gDFlcoiKAMPX4A= =k6eh -----END PGP SIGNATURE----- --OgqxwSJOaUobr8KG--