[PATCH 06/18] drm: use ARRAY_SIZE
Thierry Reding
thierry.reding at gmail.com
Mon Oct 2 08:27:03 UTC 2017
On Sun, Oct 01, 2017 at 03:30:44PM -0400, Jérémy 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.
>
> 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))
> )
>
> Signed-off-by: Jérémy Lefaure <jeremy.lefaure at lse.epita.fr>
> ---
> 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 <treding at nvidia.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20171002/d2dc12f2/attachment.sig>
More information about the amd-gfx
mailing list